-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update while the version is the same #28
Comments
I investegated this issue before I noticed this ticket. My brother installed your script on his Synology and turned to me because I "speak bash".
The script correctly identifies the available version at plex.tv being 1.22.2.4282-a97b03fad
It then checks the already Installed version and that is indeed 1.22.2.4282-6000
I have found out that it then downloads "PlexMediaServer-1.22.2.4282-a97b03fad-armv7hf_DSM6.spk" I haven't looked that hard into Plex's versioning conventions to know this is a Plex screw-up or not, but I think it's safe to just ignore everything behind the dash EDITED
It now does this:
|
This does not work for me |
This does not work for me: No, because I wrote ${available_version-%*} EDIT
I copy/pasted the wrong part out of the whatsapp chat I sent to my brother |
Weird I wrote |
you should post it as code in github to prevent it from getting mangled. In my case it wasn't mangled, I sent the correct code to my brother in whatsapp, but then did it a 2nd time with the dash and the percent swapped. As he never used the 2nd time code it wasn't noticed that it was incorrect. When you prove or disprove something, you should lose all the superfluous code, keep it as simple as possible enter the lines on the prompt and then paste the commands and the result in the github window. Your double percent is working, but the 2nd percent is just superfluous as is proved here:
A single percent strips the shortest substring, a double percent strips the longest substring. |
@notlebowski Thanks for writing that up, your changes worked for me. There may be some consequence for omitting build versions but I assume if they had to replace a build because of a bug or error they would just increment the smallest digit in the version number. Maybe @cowboy can chime in with a reason check against those build strings. |
@notlebowski LOL... I should have checked here before, would have saved me a couple of minutes debugging mine... Essentially came up with the same answer as you did, but yours is more "elegant"... I had gone with: |
Side note: Pretty sure this is a side effect of the Plex team changing their spk build process after they started adding DSM7 builds... I noticed that DSM6 builds have "-6000" appended and DSM7 builds have "-7000" appended. |
@notlebowski / @cowboy : Another potential solution would be to get the "installed_version" from the actual binary that's currently installed:
|
Thanks for looking into this! I like the idea of running @oscaritoro would you be interested in creating a PR to update the script Just an FYI: I'm in the middle of moving, so it might be some time before my PC is all set up again. I'll check back in soon. |
I don't really know what you mean by that. I'm convinced everything behind the dash is irrelevant. One shouldn't overthink the issue at hand. |
@notlebowski I've dealt with enough weird inconsistencies while writing this script that I'm feeling very cautious about removing the number / hash from after the dash. Do you think there's a problem with running |
@cowboy I'll try to get one up this week. FYSA: I'll test on the only platform I currently have available, my DS918+ with DSM v6.2.4. |
@notlebowski the script correctly detects the version that the Plex Devs put into the synology package(.spk), but the Plex Devs recently changed the logic they used to set the version within the spk and it no longer matches their full versioning scheme... they take the final component of their version number (the one after the dash) and change it to either "-6000" for Synology DSM6 builds, or "-7000" for Synology DSM7 builds... what I wrote before was just another potential source of currently installed version that should match the version schemes for what they make available for download. |
@cowboy : Quick update on my progress investigating this:
Though, interesting side note, they don't actually use that variable they defined to start the process... they all use then end up using a full path to start it:
5- All 5 of the DSM7 specific packages have new logic, as in different from DSM6 but same for all 5 of DSM7... A review of their "start-stop-status" script shows this as how they start the Plex Media Server:
According to this: https://help.synology.com/developer-guide/synology_package/script_env_var.html , SYNOPKG_PKGDEST is "exported by Package Center and can be used in the scripts"... but, unfortunately, it doesn't appear to be usable inside "update-lex.sh" I'll continue my investigation later... for now it seems that if I can find a way to access $SYNOPKG_PKGDEST then I can create a simple patch that would work on all synology NAS (DSM6 & DSM7)... other wise for now I have a way that would work in DSM6 but is questionable for DSM7... ... To Be Continued... |
Another note for those following along... This developer's guide page for DSM6 confirms the official location of package installs is indeed "/var/packages/[package identity]/target" : https://help.synology.com/developer-guide/integrate_dsm/manage_storage.html |
@cowboy : Found the DMS7 Beta Developer's Guide - https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/7.0/enu/DSM_Developer_Guide_7_0_Beta.pdf function set_installed_version() {
#installed_version=$(synopkg version 'Plex Media Server') # Previous solution; broken when Plex Devs modified synopkg version for DSM7 prep
#installed_version=${installed_version%-*} # Potential Patch to ignore the final component of the synopkg version
installed_version=$(/var/packages/Plex\ Media\ Server/target/Plex\ Media\ Server --version)
installed_version=${installed_version:1}
echo "Installed version: $installed_version"
} Thoughts? |
like I wrote before, you're overthinking it. You want to check if there's a newer Plex than the one you already have installed before starting an update procedure. You don't want to start an update process for nothing. On the other hand you don't want to miss any interesting update. It's absurd to think you're missing anything if you're ignoring what's behind the dash. |
@notlebowski : I'm tracking, this is most probably overkill and ignoring what's behind the dash may be enough... But lets explore a hypothetical scenario which I'm guessing might be what @cowboy might concerned with: |
- Get installed_version from PMS executable instead of synopkg - Addresses cowboy#28
I believe I've addressed this by just stripping the build suffix in 436280f. Please let me know if it's not fixed and I can revisit. (Sorry for the late reply!) |
This fix has been addressed in the latest release https://github.com/cowboy/synology-update-plex/releases |
I run the bash to test
`Checking for a Plex Media Server update...
[ Initializing notification system ]
Notifications installed
[ Enabling Plex Pass releases ]
Found Plex Token
[ Retrieving version data ]
Available version: 1.22.2.4282-a97b03fad
Installed version: 1.22.2.4282-6000
New version available!
[ Finding release ]
{
"label": "Intel 64-bit (DSM 6.0 and newer)",
"build": "linux-x86_64",
"distro": "synology",
"url": "https://downloads.plex.tv/plex-media-server-new/1.22.2.4282-a97b03fad/synology/PlexMediaServer-1.22.2.4282-a97b03fad-x86_64_DSM6.spk",
"checksum": "3538303aae00573167770d018b668654406d4233"
}
[ Downloading release package ]
[ Verifying checksum ]
Checksum valid!
[ Installing package ]
/tmp/plex.i9qQb5/PlexMediaServer-1.22.2.4282-a97b03fad-x86_64_DSM6.spk install successfully
[ Restarting Plex Media Server ]
package Plex Media Server start successfully
[ Cleaning up ]
Removing /tmp/plex.i9qQb5
Done!`
I restart the bash to test, and the update starts again ...
`Checking for a Plex Media Server update...
[ Enabling Plex Pass releases ]
Found Plex Token
[ Retrieving version data ]
Available version: 1.22.2.4282-a97b03fad
Installed version: 1.22.2.4282-6000
New version available!
[ Finding release ]
{
"label": "Intel 64-bit (DSM 6.0 and newer)",
"build": "linux-x86_64",
"distro": "synology",
"url": "https://downloads.plex.tv/plex-media-server-new/1.22.2.4282-a97b03fad/synology/PlexMediaServer-1.22.2.4282-a97b03fad-x86_64_DSM6.spk",
"checksum": "3538303aae00573167770d018b668654406d4233"
}
[ Downloading release package ]
[ Verifying checksum ]
Checksum valid!
[ Installing package ]
/tmp/plex.q6sXaj/PlexMediaServer-1.22.2.4282-a97b03fad-x86_64_DSM6.spk install successfully
[ Restarting Plex Media Server ]
package Plex Media Server start successfully
[ Cleaning up ]
Removing /tmp/plex.q6sXaj
Done!`
The bash does not detect that the version is the same.
DS920+
DSM 6.2.4-25556
The text was updated successfully, but these errors were encountered: