Updating the updater script, some questions around plexpass version

I am in the process of rewriting parts of the PMS_Updater.sh script located here: https://github.com/mstinaff/PMS_Updater I have 2 diff pull requests on it. As I’ve been updating it I’ve noticed a few things in my testing and I wanted to confirm them as it will affect how this goes.

Do you still need to provide credentials to download the plexpass json file? And is there even a difference between the plexpass json file and the normal json file? When I download them currently(both without authentication), the file is exactly the same.

I’ve just re-written the perl section to use the PMS included python considering freenas jails don’t seem to ship with perl. Python is just sitting there though to use. As for the downloading portion, it also has a dependency on wget and I’d like to alleviate that, and clean up any unused portions of the script. My two main questions:

Do you still need authentication to download plexpass versions of PMS?

Is there even a difference anymore between “normal” and plexpass" for the purposes of downloading the server code.

Thanks,

Yes you would need creds to see the plexpass versions, or the beta channel if you will.

The way it works is that there a public and beta channel, if you don’t have a plexpass we fallback to the public build (this means plex.tv API will still return you a valid response but it will show the last version on PUBLIC not BETA if yo don’t provide proper auth)

As for the other question the thing to note is that “Plexpass” is tied to the account and gives you access to certain features, including the ability to download beta builds.

When you download however you are either getting a public or beta build, if you download a beta build via a plexpass account but then sign-in the server with a normal account you won’t get any plexpass features.

If I can suggest an idea is maybe using PMS updater API, this can be used to check for updates and if you use a validate token and the server is signed with plexpass it should get you the version you want (meaning that in pms pref the user can actually select if he want public or beta) and the API will return the most recent version for that and provide the URL and changelog, which might actually be quite useful for the script.

Also I’ve seen loads of reports here cause the script doesn’t consider the rc.d file, so you could do and even more crazy re-write and base the script on ports and update the Makefile, or even just grab the most recent rc.d from github freebsd-ports.

Or even create you’re own based on or start.sh (if anything changes here it should be updated in the rc.d file).

1 Like

I appreciate this info. I’m not a very strong programmer, so I’m sure some of what you’re telling me here will be useful as I progress through working on this. My first step was to get it functional as is without adding additional tools to the jail. Then I want to optimize the process with the goal of making it as easy as possible for the users. My first pass at it, because of the perl dep I actually modified the script to run in the freenas host and update the jail from above, but I’d rather it run contained inside of the jail and not sit up top. I did that last night, and this morning I looked at the perl code and looked around for python and figured out that the Plex Script Host is actually python so I redid that section in python, its functioning, but still need wget installed(very minor). This post came out of seeing if i still needed to pass auth. My two options at this point to get around wget dep are to use fetch or python again. My first pass with python yielded some ssl errors I’d have to work through, but i dont even know how to pass auth to that yet. Same for fetch but no ssl errors.

I think the API will be the next thing I look at.

Having little to no experience as a coder I may lack some wisdom in future proofing changes but I’m sure that’ll come with time as I start to realize what kinds of things I need to rewrite in the future.

Latest version . I believe everything is working as intended now.

I think I’ve fixed the remove function, which was broken in the original script.

I removed the dependency on perl5 and wget by switching to python and fetch respectively.

I’ve removed the username/password functionality, this was used I believe insecurely with wget. It’s been replaced with token auth to the API. The token will use your server’s token in the preferences file you shouldn’t need to even touch it.

Shouldn’t need to edit anything it will auto detect. Tested on iocage jail in fnas 11

@mikec_pt I’m trying to look into the rc.d thing now, looks like its for older plex jails and I’m using an iocage jail install… so if I can see exactly whats going on there I might be able to correct it.

quick replying to last post, rc.d script apply to both types, its just the way it works in FreeBSD world, you can thing of it as the alternative to init.d/upstart in Linux to manage “services”

1 Like

I’ve used FreeBSD for a very long time I just wasn’t sure on the issue WRT plex, but looking at the other thread it seems like people are confused because the names are different to start the service.
plexmediaserver for normal plex and plexmediaserver_plexpass for plexpass service. To add to the confusion, the installation directory for the plexpass version is plexmediaserver-plexpass with a dash instead of an underscore. I don’t have an older jail version of the plugin handy, just using iocage on my box. It should work for both though with the script. I was looking through the rc.d script and some of the things in there are confusing. They have logic to call the vendor FreeNAS reading from a version file, but everyone installs plex in a jail or vm on freenas, no one installs it on the base system, and as such that version file doesn’t even exist. Makes me wonder if its just from a prior version.

Now I’m trying to see if its possible to alter the update available banner so I can click a button or link that launches this updater script on the server instead of bringing me out to the plex website to manually download.

Yeah that “different” is just cause for some reason in the past the port maintainers(s) decide to create a flavor port that installs using those different paths/names.

But “plexpass” is a user thing… for pms there’s really “public” and “beta” channels (last one can ONLY be seen by plexpass users) but in essence its just and earlier beta build.

Looks like freenas should only offer one plugin not two, and install the plexpass version off the bat to bootstrap it. And like you said before, the plexpass features won’t be available to the users that don’t have it once they authenticate. I don’t think its a huge priority for them. Infact the update script was born from the fact they take a little while to update the repo and people want the update as soon as its released.

I agree.

But we do understand that if we provide ready to install txz’s this would be less of an issue (the script would still be useful as it would make it easier to update, but you could just have it download and run pkng.

But as for the PMS auto update API its pretty easy (you can see from web inspector what it does but some pointers)

GET IP:32400/updater/status gives you the status on updates, while download URL, version and release notes.
PUT IP:32400/updater/check forces a check for updates

This checks against the channel the server is pointed too (public or beta) so it would be that complicated to have the script using this for getting updates and always get them for whatever channel the user sets here. Meaning the script doesn’t need to care about this.

This is what I use locally, I then download to /usr/ports/distfiles

and then cd into /usr/ports/multimedia/plexmediaserver; update the Makefile and run make clean; make makesum; make package
Then pkg remove plexmediaserver; pkg install work/pkg/....txz

This way the pkg is always registered in pkgng.

Some of this is in a shell script but I do the upgrade manually as I prefer to snapshot the dataset first… but even this could be automated.

My first crack at this I modified the original script to run on the freenas host box, and it leverages iocage exec to crack off commands inside of the jail from above. It’s on my github. Sure some zfs commands could go in there to snapshot too, but that’s probably alot of extra nonsense. I’m sure you could write something for the freenas host above the jail to issue the commands down.

I’ll give these api paths a look, currently im just hitting the GET with my browser and passing the token, I don’t have a good dev environment hah.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.