From 07a1368b0781ab4525619e609350adb99182103e Mon Sep 17 00:00:00 2001 From: Andrew Parker Date: Mon, 23 Jun 2014 22:39:45 -0600 Subject: [PATCH] Added the option to specify a download directory. This allows you to configure where the download will be saved, and where it looks for existing files. Specify the full path to the download directory, without a trailing slash. --- plexupdate.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index 8068b63..f10fece 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -39,9 +39,11 @@ ################################################################# # Set these two to what you need, or create a .plexupdate file # in your home directory with these two (avoids changing this) +# DOWNLOADDIR is the full directory path you would like the download to go, without trailing slash. # EMAIL= PASS= +DOWNLOADDIR="." ################################################################# # Don't change anything below this point @@ -204,13 +206,13 @@ if [ $? -ne 0 ]; then exit 3 fi -if [ -f "${FILENAME}" -a "${FORCE}" != "yes" ]; then +if [ -f "${DOWNLOADDIR}/${FILENAME}" -a "${FORCE}" != "yes" ]; then echo "File already exists, won't download." exit 2 fi echo -ne "Downloading release \"${FILENAME}\"..." -ERROR=$(wget --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies "${DOWNLOAD}" 2>&1) +ERROR=$(wget --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies "${DOWNLOAD}" -O "${DOWNLOADDIR}/${FILENAME}" 2>&1) CODE=$? if [ ${CODE} -ne 0 ]; then echo -e "\n !! Download failed with code ${CODE}, \"${ERROR}\"" @@ -220,9 +222,9 @@ echo "OK" if [ "${AUTOINSTALL}" == "yes" ]; then if [ "${REDHAT}" == "yes" ]; then - rpm -i "${FILENAME}" + rpm -i "${DOWNLOADDIR}/${FILENAME}" else - dpkg -i "${FILENAME}" + dpkg -i "${DOWNLOADDIR}/${FILENAME}" fi fi