From 5bad5cbe0fa91b38db8f650ace8e35f0906e187a Mon Sep 17 00:00:00 2001 From: Henric Andersson Date: Mon, 11 Apr 2016 07:47:00 -0700 Subject: [PATCH] Added control of package manager Also fixed long-standing issue with KEEP not working --- README.md | 4 ++++ plexupdate.sh | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d700fe4..0affaa4 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,10 @@ There are a few other options for the more enterprising user. Setting any of the Normally plexupdate.sh will avoid downloading a file it already has or if it's the same as the installed version, but this allows you to override. - PRINT_URL Authenticate, fetch the download URL, print it, and then exit. +- REDHAT_INSTALL + The commandline used to install .rpm packages, only change if you need special options +- DEBIAN_INSTALL + The commandline used to install .deb packages, only change if you need special options Most of these options can be specified on the command-line as well, this is just a more convenient way of doing it if you're scripting it. Which brings us to... diff --git a/plexupdate.sh b/plexupdate.sh index d5dfbe9..2ed27b0 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -57,6 +57,10 @@ AUTODELETE=no AUTOUPDATE=no AUTOSTART=no +# Default options for package managers, override if needed +REDHAT_INSTALL="yum -y install" +DEBIAN_INSTALL="dpkg -i" + # Sanity, make sure wget is in our path... wget >/dev/null 2>/dev/null if [ $? -eq 127 ]; then @@ -205,9 +209,11 @@ keypair() { # Setup an exit handler so we cleanup function cleanup { - rm /tmp/kaka 2>/dev/null >/dev/null rm /tmp/postdata 2>/dev/null >/dev/null rm /tmp/raw 2>/dev/null >/dev/null + if [ "${KEEP}" != "yes" ]; then + rm /tmp/kaka 2>/dev/null >/dev/null + fi } trap cleanup EXIT @@ -328,9 +334,9 @@ fi if [ "${AUTOINSTALL}" == "yes" ]; then if [ "${REDHAT}" == "yes" ]; then - sudo yum -y install "${DOWNLOADDIR}/${FILENAME}" + sudo ${REDHAT_INSTALL} "${DOWNLOADDIR}/${FILENAME}" else - sudo dpkg -i "${DOWNLOADDIR}/${FILENAME}" + sudo ${DEBIAN_INSTALL} "${DOWNLOADDIR}/${FILENAME}" fi fi