Read /etc/plexupdate.conf before other configs, if available

This commit is contained in:
Alex Malinovich 2016-11-20 13:29:19 -08:00
commit f3242f7ae3

View file

@ -268,7 +268,13 @@ if [ ! -z "${CONFIGFILE}" ]; then
fi fi
else else
# Load settings from config file if it exists # Load settings from config file if it exists
# Also, respect SUDO_USER and try that first if [ -f /etc/plexupdate.conf ]; then
info "Reading configuration in: /etc/plexupdate.conf"
CONFIGFILE=/etc/plexupdate.conf
source /etc/plexupdate.conf
fi
# Check for a SUDO_USER config
if [ ! -z "${SUDO_USER}" ]; then if [ ! -z "${SUDO_USER}" ]; then
# Make sure nothing bad comes from this (since we use eval) # Make sure nothing bad comes from this (since we use eval)
ERROR=0 ERROR=0
@ -292,18 +298,18 @@ else
fi fi
if [ ! -z "${CONFIGDIR}" -a -f "${CONFIGDIR}/.plexupdate" ]; then if [ ! -z "${CONFIGDIR}" -a -f "${CONFIGDIR}/.plexupdate" ]; then
info "Using \"${SUDO_USER}\" configuration: ${CONFIGDIR}/.plexupdate" #>/dev/null info "Reading \"${SUDO_USER}\" configuration in: ${CONFIGDIR}/.plexupdate"
CONFIGFILE="${CONFIGDIR}/.plexupdate" CONFIGFILE="${CONFIGDIR}/.plexupdate"
source "${CONFIGDIR}/.plexupdate" source "${CONFIGDIR}/.plexupdate"
elif [ -f ~/.plexupdate ]; then elif [ -f ~/.plexupdate ]; then
# Fallback for compatibility # Fallback for compatibility
info "Using \"${SUDO_USER}\" configuration: ${HOME}/.plexupdate" #>/dev/null info "Reading \"${SUDO_USER}\" configuration in: ${HOME}/.plexupdate"
CONFIGFILE="${HOME}/.plexupdate" # tilde expansion won't happen later. CONFIGFILE="${HOME}/.plexupdate" # tilde expansion won't happen later.
source ~/.plexupdate source ~/.plexupdate
fi fi
elif [ -f ~/.plexupdate ]; then elif [ -f ~/.plexupdate ]; then
# Fallback for compatibility # Fallback for compatibility
info "Using configuration: ${HOME}/.plexupdate" #>/dev/null info "Reading configuration in: ${HOME}/.plexupdate"
CONFIGFILE="${HOME}/.plexupdate" CONFIGFILE="${HOME}/.plexupdate"
source ~/.plexupdate source ~/.plexupdate
fi fi