From 5ef0da84893e7f39f876d88d4a367fce2fc37041 Mon Sep 17 00:00:00 2001 From: Henric Andersson Date: Sun, 25 Oct 2015 11:43:56 -0700 Subject: [PATCH 1/3] Moved root test for autostart Better to fail early than to wait until the last moment. Also improved help text. --- plexupdate.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index dd52ecc..dc952f4 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -80,7 +80,7 @@ set -- $(getopt aufhko: -- "$@") while true; do case "$1" in - (-h) echo -e "Usage: $(basename $0) [-afhkop]\n\na = Auto install if download was successful (requires root)\nd = Auto delete after auto install\nf = Force download even if it's the same version or file already exists (WILL NOT OVERWRITE)\nh = This help\nk = Reuse last authentication\no = 32-bit version (default 64 bit)\np = Public Plex Media Server version\nu = Auto update plexupdate.sh before running it (experimental)\n"; exit 0;; + (-h) echo -e "Usage: $(basename $0) [-afhkopsuU]\n\na = Auto install if download was successful (requires root)\nd = Auto delete after auto install\nf = Force download even if it's the same version or file already exists (WILL NOT OVERWRITE)\nh = This help\nk = Reuse last authentication\no = 32-bit version (default 64 bit)\np = Public Plex Media Server version\nu = Auto update plexupdate.sh before running it (experimental)\nU = Do not autoupdate plexupdate.sh (experimental, default)\ns = Auto start (needed for some distros)\n"; exit 0;; (-a) AUTOINSTALL=yes;; (-d) AUTODELETE=yes;; (-f) FORCE=yes;; @@ -131,10 +131,10 @@ if [ "${EMAIL}" == "" -o "${PASS}" == "" ] && [ "${PUBLIC}" == "no" ]; then exit 1 fi -if [ "${AUTOINSTALL}" == "yes" ]; then +if [ "${AUTOINSTALL}" == "yes" -o "${AUTOSTART}" == "yes" ]; then id | grep 'uid=0(' 2>&1 >/dev/null if [ $? -ne 0 ]; then - echo "Error: You need to be root to use autoinstall option." + echo "Error: You need to be root to use autoinstall/autostart option." exit 1 fi fi @@ -314,14 +314,10 @@ if [ "${AUTODELETE}" == "yes" ]; then fi if [ "${AUTOSTART}" == "yes" ]; then - id | grep 'uid=0(' 2>&1 >/dev/null - if [ $? -ne 0 ]; then - echo "Error: You need to be root to use autoinstall option." - exit 1 - elif [ "${REDHAT}" == "no" ]; then + if [ "${REDHAT}" == "no" ]; then echo "The AUTOSTART [-s] option may not be needed on your distribution." fi - sudo service plexmediaserver start + service plexmediaserver start fi exit 0 From 8b556f20f02d83d7733f2f949e394ddb552e3ad5 Mon Sep 17 00:00:00 2001 From: Henric Andersson Date: Sun, 25 Oct 2015 11:47:01 -0700 Subject: [PATCH 2/3] Added FAQ section to README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 0caf3ae..ae45ed8 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,11 @@ echo -e > ~/.plexupdate 'EMAIL=\nPASS=""' nano -w ~/.plexupdate sudo ./plexupdate.sh -a ``` + +# FAQ + +## My password is rejected even though correct + +If you use certain characters, such as dollar sign, in your password, bash will interpret that as a reference to a variable. To resolve this, enclose your password with single quotes instead of the normal quotes. + +Ie, `PASS="MyP4$$w0rD"` will not work, but changing to it to `PASS='MyP4$$w0rD'` will From 3a8244306b4dfedbf6b7fb6ae660177d9a619135 Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 27 Oct 2015 13:10:20 -0500 Subject: [PATCH 3/3] Added systemd support to AUTOSTART --- plexupdate.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plexupdate.sh b/plexupdate.sh index dc952f4..2d483ad 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -317,7 +317,12 @@ if [ "${AUTOSTART}" == "yes" ]; then if [ "${REDHAT}" == "no" ]; then echo "The AUTOSTART [-s] option may not be needed on your distribution." fi - service plexmediaserver start + # Check for systemd + if [ -f "/bin/systemctl" ]; then + systemctl start plexmediaserver.service + else + service plexmediaserver start + fi fi exit 0