From 5bad5cbe0fa91b38db8f650ace8e35f0906e187a Mon Sep 17 00:00:00 2001 From: Henric Andersson Date: Mon, 11 Apr 2016 07:47:00 -0700 Subject: [PATCH 1/4] Added control of package manager Also fixed long-standing issue with KEEP not working --- README.md | 4 ++++ plexupdate.sh | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d700fe4..0affaa4 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,10 @@ There are a few other options for the more enterprising user. Setting any of the Normally plexupdate.sh will avoid downloading a file it already has or if it's the same as the installed version, but this allows you to override. - PRINT_URL Authenticate, fetch the download URL, print it, and then exit. +- REDHAT_INSTALL + The commandline used to install .rpm packages, only change if you need special options +- DEBIAN_INSTALL + The commandline used to install .deb packages, only change if you need special options Most of these options can be specified on the command-line as well, this is just a more convenient way of doing it if you're scripting it. Which brings us to... diff --git a/plexupdate.sh b/plexupdate.sh index d5dfbe9..2ed27b0 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -57,6 +57,10 @@ AUTODELETE=no AUTOUPDATE=no AUTOSTART=no +# Default options for package managers, override if needed +REDHAT_INSTALL="yum -y install" +DEBIAN_INSTALL="dpkg -i" + # Sanity, make sure wget is in our path... wget >/dev/null 2>/dev/null if [ $? -eq 127 ]; then @@ -205,9 +209,11 @@ keypair() { # Setup an exit handler so we cleanup function cleanup { - rm /tmp/kaka 2>/dev/null >/dev/null rm /tmp/postdata 2>/dev/null >/dev/null rm /tmp/raw 2>/dev/null >/dev/null + if [ "${KEEP}" != "yes" ]; then + rm /tmp/kaka 2>/dev/null >/dev/null + fi } trap cleanup EXIT @@ -328,9 +334,9 @@ fi if [ "${AUTOINSTALL}" == "yes" ]; then if [ "${REDHAT}" == "yes" ]; then - sudo yum -y install "${DOWNLOADDIR}/${FILENAME}" + sudo ${REDHAT_INSTALL} "${DOWNLOADDIR}/${FILENAME}" else - sudo dpkg -i "${DOWNLOADDIR}/${FILENAME}" + sudo ${DEBIAN_INSTALL} "${DOWNLOADDIR}/${FILENAME}" fi fi From 76db00e42a375641adfdb46c56491bb18dfe1c6b Mon Sep 17 00:00:00 2001 From: Alex Malinovich Date: Mon, 11 Apr 2016 11:03:53 -0700 Subject: [PATCH 2/4] Fix KEEP option for plexpass users --- plexupdate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexupdate.sh b/plexupdate.sh index 2ed27b0..3de5176 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -263,7 +263,7 @@ if [ "${KEEP}" != "yes" -o ! -f /tmp/kaka ] && [ "${PUBLIC}" == "no" ]; then exit 1 fi echo "OK" -else +elif [ "$PUBLIC" != "no" ]; then # It's a public version, so change URL and make doubly sure that cookies are empty rm 2>/dev/null >/dev/null /tmp/kaka touch /tmp/kaka From 732b503daea89df9b10443ecad625ed7530e7657 Mon Sep 17 00:00:00 2001 From: Alex Malinovich Date: Mon, 11 Apr 2016 11:18:50 -0700 Subject: [PATCH 3/4] Skip email/pass sanity check if stored cookie exists --- plexupdate.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index 3de5176..cb8654b 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -151,8 +151,8 @@ if [ "${AUTOUPDATE}" == "yes" ]; then fi # Sanity check -if [ "${EMAIL}" == "" -o "${PASS}" == "" ] && [ "${PUBLIC}" == "no" ]; then - echo "Error: Need username & password to download PlexPass version. Otherwise run with -p to download public version." +if [ "${EMAIL}" == "" -o "${PASS}" == "" ] && [ "${PUBLIC}" == "no" ] && [ ! -f /tmp/kaka ]; then + echo "Error: Need username & password or -k optoin to download PlexPass version. Otherwise run with -p to download public version." exit 1 fi From 0ab9cc6ccfe26a1e56e45f2663d067fcf4444938 Mon Sep 17 00:00:00 2001 From: Alex Malinovich Date: Mon, 11 Apr 2016 13:43:47 -0700 Subject: [PATCH 4/4] Spelling is hard --- plexupdate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexupdate.sh b/plexupdate.sh index cb8654b..ef99506 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -152,7 +152,7 @@ fi # Sanity check if [ "${EMAIL}" == "" -o "${PASS}" == "" ] && [ "${PUBLIC}" == "no" ] && [ ! -f /tmp/kaka ]; then - echo "Error: Need username & password or -k optoin to download PlexPass version. Otherwise run with -p to download public version." + echo "Error: Need username & password or -k option to download PlexPass version. Otherwise run with -p to download public version." exit 1 fi