add option -r to print the download url and exit

This commit is contained in:
joe miller 2016-03-19 17:14:02 -07:00
commit 581698a351
No known key found for this signature in database
GPG key ID: B0FBB6EC7A273832
2 changed files with 10 additions and 2 deletions

View file

@ -87,11 +87,11 @@ URL_DOWNLOAD_PUBLIC=https://plex.tv/downloads
# Parse commandline
ALLARGS="$@"
set -- $(getopt aufhko: -- "$@")
set -- $(getopt aufhkro: -- "$@")
while true;
do
case "$1" in
(-h) echo -e "Usage: $(basename $0) [-afhkopsuU]\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\nu = Auto update plexupdate.sh before running it (experimental)\nU = Do not autoupdate plexupdate.sh (experimental, default)\ns = Auto start (needed for some distros)\n"; exit 0;;
(-h) echo -e "Usage: $(basename $0) [-afhkopsuU]\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\nu = Auto update plexupdate.sh before running it (experimental)\nU = Do not autoupdate plexupdate.sh (experimental, default)\ns = Auto start (needed for some distros)\np = Print download URL and exit\n"; exit 0;;
(-a) AUTOINSTALL=yes;;
(-d) AUTODELETE=yes;;
(-f) FORCE=yes;;
@ -101,6 +101,7 @@ do
(-u) AUTOUPDATE=yes;;
(-U) AUTOUPDATE=no;;
(-s) AUTOSTART=yes;;
(-r) PRINT_URL=yes;;
(--) ;;
(-*) echo "Error: unrecognized option $1" 1>&2; exit 1;;
(*) break;;
@ -280,6 +281,11 @@ if [ $? -ne 0 ]; then
exit 3
fi
if [ "${PRINT_URL}" == "yes" ]; then
echo "${DOWNLOAD}"
exit 0
fi
# By default, try downloading
SKIP_DOWNLOAD="no"