Tweaked PMS_Updater to work in latest freenas 11.2-U5

jbeez

Dabbler
Joined
Feb 9, 2015
Messages
48
I was running into some issues with this script so I made some tweaks.

Quick notes

  • I run it as root in an ssh session on my main freenas box, not inside of a jail.
  • Edit the variable up top to match your jail name
  • I run it with the following command switches myself, ./newPMS_Updater.sh -a -v -c credentialfile

Edit: revised a little and merge with another pull request I saw that fixes the normal vs plexpass option. Find the updated version HERE. If your jail name is plex you shouldn't even need to change anything.

Remove is acting weird for me, need to look at that. it echos out that it's removing a bunch of directories in that /usr/local/share/ but it fails in the backend because they are directories and not normal files. When I look at the script its trying to reference a variable I don't see get set at all called PMSPATTERN. Not sure if that's a bug with how I'm working this or if that is also existent in the original.
 
Last edited:

jbeez

Dabbler
Joined
Feb 9, 2015
Messages
48
Worked some more on this, I have an injail version working but still requires you to install the wget tool. Working on rewriting that, but if you want to get it working in the jail without perl, I leverage the builtin python thats including with PMS, edit the original PMS_Updater script that is available on github(Not my version). I'll update more and clean this up when I get further.

Add this export line up top and then swap the code here,
export PYTHONHOME="$PMSPARENTPATH/$PMSLIVEFOLDER/Resources/Python"


ORIGINAL
Code:
DOWNLOADURL=`cat $DOWNLOADPATH/$SCRAPEFILE | perl -MJSON::PP -E 'say decode_json(<STDIN>)->{computer}{FreeBSD}{releases}[0]{url}'`


NEW
Code:
DOWNLOADURL=`cat $DOWNLOADPATH/$SCRAPEFILE | $PMSPARENTPATH/$PMSLIVEFOLDER/Plex\ Script\ Host -c 'import sys, json; myobj = json.load(sys.stdin); print(myobj["computer"]["FreeBSD"]["releases"][0]["url"]);'`
 
Last edited:

jbeez

Dabbler
Joined
Feb 9, 2015
Messages
48
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.

You shouldn't need to touch anything, but the hard coded options are at the top of the file. I turn on autoupdate, verbose, remove, and logging.
 
Last edited:
Top