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.

This commit is contained in:
Andrew Parker 2014-06-23 22:39:45 -06:00
commit 07a1368b07

View file

@ -39,9 +39,11 @@
################################################################# #################################################################
# Set these two to what you need, or create a .plexupdate file # Set these two to what you need, or create a .plexupdate file
# in your home directory with these two (avoids changing this) # 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= EMAIL=
PASS= PASS=
DOWNLOADDIR="."
################################################################# #################################################################
# Don't change anything below this point # Don't change anything below this point
@ -204,13 +206,13 @@ if [ $? -ne 0 ]; then
exit 3 exit 3
fi fi
if [ -f "${FILENAME}" -a "${FORCE}" != "yes" ]; then if [ -f "${DOWNLOADDIR}/${FILENAME}" -a "${FORCE}" != "yes" ]; then
echo "File already exists, won't download." echo "File already exists, won't download."
exit 2 exit 2
fi fi
echo -ne "Downloading release \"${FILENAME}\"..." 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=$? CODE=$?
if [ ${CODE} -ne 0 ]; then if [ ${CODE} -ne 0 ]; then
echo -e "\n !! Download failed with code ${CODE}, \"${ERROR}\"" echo -e "\n !! Download failed with code ${CODE}, \"${ERROR}\""
@ -220,9 +222,9 @@ echo "OK"
if [ "${AUTOINSTALL}" == "yes" ]; then if [ "${AUTOINSTALL}" == "yes" ]; then
if [ "${REDHAT}" == "yes" ]; then if [ "${REDHAT}" == "yes" ]; then
rpm -i "${FILENAME}" rpm -i "${DOWNLOADDIR}/${FILENAME}"
else else
dpkg -i "${FILENAME}" dpkg -i "${DOWNLOADDIR}/${FILENAME}"
fi fi
fi fi