From 49fd3806eab3a705bc6da33295c80289b004711e Mon Sep 17 00:00:00 2001 From: Henric Andersson Date: Sat, 27 Aug 2016 11:41:10 -0700 Subject: [PATCH] Improved handling of auto update No longer gets stuck in a loop --- plexupdate.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index ad7ca3d..3d55aad 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -60,6 +60,7 @@ AUTOSTART=no CRON=no QUIET=no ARCH=$(uname -m) +IGNOREAUTOUPDATE=no # Default options for package managers, override if needed REDHAT_INSTALL="yum -y install" @@ -207,7 +208,7 @@ do (-s) AUTOSTART=yes;; (-S) echo "ERROR: SILENT option has been removed, please use QUIET (-q) instead" >&2; cronexit 255;; (-u) AUTOUPDATE=yes;; - (-U) AUTOUPDATE=no;; + (-U) IGNOREAUTOUPDATE=yes;; (--) ;; (-*) echo "ERROR: unrecognized option $1" >&2; usage; cronexit 1;; (*) break;; @@ -215,6 +216,10 @@ do shift done +if [ "${IGNOREAUTOUPDATE}" = "yes" ]; then + AUTOUPDATE=no +fi + if [ "${KEEP}" = "yes" ]; then echo "ERROR: KEEP is deprecated and should be removed from .plexupdate" >&2 cronexit 255 @@ -265,14 +270,6 @@ if [ "${AUTOUPDATE}" = "yes" ]; then echo "OK" popd >/dev/null - ALLARGS2=() - for A in ${ALLARGS[@]} ; do - if [ ! "${A}" = "-u" ]; then - ALLARGS2+=(${A}) - fi - done - ALLARGS=("${ALLARGS2[@]}") - if ! type "$0" 2>/dev/null >/dev/null ; then if [ -f "$0" ]; then /bin/bash "$0" -U ${ALLARGS[@]}