From a4896420fcb655604d76915cc36362137c64d45e Mon Sep 17 00:00:00 2001 From: Mike Dawson Date: Fri, 26 Jun 2015 23:35:40 -0700 Subject: [PATCH] Add delete after auto install switch --- plexupdate.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plexupdate.sh b/plexupdate.sh index f90f11a..7ad0843 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -47,6 +47,7 @@ KEEP=no FORCE=no PUBLIC=no AUTOINSTALL=no +AUTODELETE=no # Sanity, make sure wget is in our path... wget >/dev/null 2>/dev/null @@ -70,8 +71,9 @@ set -- $(getopt fhko: -- "$@") while true; do case "$1" in - (-h) echo -e "Usage: $(basename $0) [-afhkop]\n\na = Auto install if download was successful (requires root)\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"; exit 0;; + (-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"; exit 0;; (-a) AUTOINSTALL=yes;; + (-d) AUTODELETE=yes;; (-f) FORCE=yes;; (-k) KEEP=yes;; (-o) RELEASE="32-bit";; @@ -249,4 +251,13 @@ if [ "${AUTOINSTALL}" == "yes" ]; then fi fi +if [ "${AUTODELETE}" == "yes" ]; then + if [ "${AUTOINSTALL}" == "yes" ]; then + rm -rf "${DOWNLOADDIR}/${FILENAME}" + echo "Deleted \"${FILENAME}\"" + else + echo "Will not auto delete without [-a] auto install" + fi +fi + exit 0