Added control of package manager

Also fixed long-standing issue with KEEP not working
This commit is contained in:
Henric Andersson 2016-04-11 07:47:00 -07:00
commit 5bad5cbe0f
2 changed files with 13 additions and 3 deletions

View file

@ -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...

View file

@ -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