Fix indentation in cronwrapper

This commit is contained in:
Alex Malinovich 2016-11-30 17:03:09 -08:00
commit 9140e26f0a
2 changed files with 27 additions and 26 deletions

View file

@ -20,51 +20,51 @@
if [ ! -f /etc/plexupdate.cron.conf ]; then
echo "ERROR: You have not configured /etc/plexupdate.cron.conf" >&2
exit 255
echo "ERROR: You have not configured /etc/plexupdate.cron.conf" >&2
exit 255
else
source /etc/plexupdate.cron.conf
source /etc/plexupdate.cron.conf
fi
if [ -z "${SCRIPT}" -o ! -f "${SCRIPT}" ]; then
echo "ERROR: Cannot find plexupdate.sh (tried ${SCRIPT})" >&2
exit 255
echo "ERROR: Cannot find plexupdate.sh (tried ${SCRIPT})" >&2
exit 255
elif [ ${EUID} -eq 0 ]; then
UNSAFE_FILES=$(find -L "$(dirname "${SCRIPT}")" -perm /002 -or -not -uid 0 -or -not -gid 0)
if [ ! -z "${UNSAFE_FILES}" ]; then
echo "ERROR: Permissions on some files are too lax for running as root. Files must be owned by root:root and not world-writeable." >&2
echo "Unsafe files found:" >&2
echo "${UNSAFE_FILES}" >&2
exit 255
fi
UNSAFE_FILES=$(find -L "$(dirname "${SCRIPT}")" -perm /002 -or -not -uid 0 -or -not -gid 0)
if [ ! -z "${UNSAFE_FILES}" ]; then
echo "ERROR: Permissions on some files are too lax for running as root. Files must be owned by root:root and not world-writeable." >&2
echo "Unsafe files found:" >&2
echo "${UNSAFE_FILES}" >&2
exit 255
fi
fi
if [ ! -z "$CONF" ]; then
# We have a config file, prefix it with parameter
if [ ! -f "${CONF}" ]; then
echo "ERROR: Cannot find config file (tried ${CONF})" >&2
exit 255
fi
CONF="--config=${CONF}"
# We have a config file, prefix it with parameter
if [ ! -f "${CONF}" ]; then
echo "ERROR: Cannot find config file (tried ${CONF})" >&2
exit 255
fi
CONF="--config=${CONF}"
fi
LOGFILE=$(mktemp /tmp/plexupdate.cron.XXXX)
RET=0
if $LOGGING; then
"${SCRIPT}" "${CONF}" 2>&1 | tee ${LOGFILE} | logger -t plexupdate -p daemon.info
RET="${PIPESTATUS[0]}"
"${SCRIPT}" "${CONF}" 2>&1 | tee ${LOGFILE} | logger -t plexupdate -p daemon.info
RET="${PIPESTATUS[0]}"
else
"${SCRIPT}" "${CONF}" >${LOGFILE} 2>&1
RET=$?
"${SCRIPT}" "${CONF}" >${LOGFILE} 2>&1
RET=$?
fi
if [ $RET -ne 2 -a $RET -ne 5 ]; then
# Make sure user gets an email about this
cat ${LOGFILE} >&2
# Make sure user gets an email about this
cat ${LOGFILE} >&2
else
# Nah, not important
RET=0
# Nah, not important
RET=0
fi
rm "${LOGFILE}" 2>/dev/null

View file

@ -334,6 +334,7 @@ if [ "${AUTOUPDATE}" = "yes" ]; then
exit 1
fi
# Force FETCH_HEAD to point to the correct branch (for older versions of git which don't default to current branch)
if git fetch origin $BRANCHNAME --quiet && ! git diff --quiet FETCH_HEAD; then
info "Auto-updating..."
if ! git merge --quiet FETCH_HEAD; then