mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-20 13:23:21 -07:00
Fix indentation in cronwrapper
This commit is contained in:
parent
63bc4c4ee0
commit
9140e26f0a
2 changed files with 27 additions and 26 deletions
|
@ -20,51 +20,51 @@
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /etc/plexupdate.cron.conf ]; then
|
if [ ! -f /etc/plexupdate.cron.conf ]; then
|
||||||
echo "ERROR: You have not configured /etc/plexupdate.cron.conf" >&2
|
echo "ERROR: You have not configured /etc/plexupdate.cron.conf" >&2
|
||||||
exit 255
|
exit 255
|
||||||
else
|
else
|
||||||
source /etc/plexupdate.cron.conf
|
source /etc/plexupdate.cron.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${SCRIPT}" -o ! -f "${SCRIPT}" ]; then
|
if [ -z "${SCRIPT}" -o ! -f "${SCRIPT}" ]; then
|
||||||
echo "ERROR: Cannot find plexupdate.sh (tried ${SCRIPT})" >&2
|
echo "ERROR: Cannot find plexupdate.sh (tried ${SCRIPT})" >&2
|
||||||
exit 255
|
exit 255
|
||||||
elif [ ${EUID} -eq 0 ]; then
|
elif [ ${EUID} -eq 0 ]; then
|
||||||
UNSAFE_FILES=$(find -L "$(dirname "${SCRIPT}")" -perm /002 -or -not -uid 0 -or -not -gid 0)
|
UNSAFE_FILES=$(find -L "$(dirname "${SCRIPT}")" -perm /002 -or -not -uid 0 -or -not -gid 0)
|
||||||
if [ ! -z "${UNSAFE_FILES}" ]; then
|
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 "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 found:" >&2
|
||||||
echo "${UNSAFE_FILES}" >&2
|
echo "${UNSAFE_FILES}" >&2
|
||||||
exit 255
|
exit 255
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$CONF" ]; then
|
if [ ! -z "$CONF" ]; then
|
||||||
# We have a config file, prefix it with parameter
|
# We have a config file, prefix it with parameter
|
||||||
if [ ! -f "${CONF}" ]; then
|
if [ ! -f "${CONF}" ]; then
|
||||||
echo "ERROR: Cannot find config file (tried ${CONF})" >&2
|
echo "ERROR: Cannot find config file (tried ${CONF})" >&2
|
||||||
exit 255
|
exit 255
|
||||||
fi
|
fi
|
||||||
CONF="--config=${CONF}"
|
CONF="--config=${CONF}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LOGFILE=$(mktemp /tmp/plexupdate.cron.XXXX)
|
LOGFILE=$(mktemp /tmp/plexupdate.cron.XXXX)
|
||||||
|
|
||||||
RET=0
|
RET=0
|
||||||
if $LOGGING; then
|
if $LOGGING; then
|
||||||
"${SCRIPT}" "${CONF}" 2>&1 | tee ${LOGFILE} | logger -t plexupdate -p daemon.info
|
"${SCRIPT}" "${CONF}" 2>&1 | tee ${LOGFILE} | logger -t plexupdate -p daemon.info
|
||||||
RET="${PIPESTATUS[0]}"
|
RET="${PIPESTATUS[0]}"
|
||||||
else
|
else
|
||||||
"${SCRIPT}" "${CONF}" >${LOGFILE} 2>&1
|
"${SCRIPT}" "${CONF}" >${LOGFILE} 2>&1
|
||||||
RET=$?
|
RET=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $RET -ne 2 -a $RET -ne 5 ]; then
|
if [ $RET -ne 2 -a $RET -ne 5 ]; then
|
||||||
# Make sure user gets an email about this
|
# Make sure user gets an email about this
|
||||||
cat ${LOGFILE} >&2
|
cat ${LOGFILE} >&2
|
||||||
else
|
else
|
||||||
# Nah, not important
|
# Nah, not important
|
||||||
RET=0
|
RET=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm "${LOGFILE}" 2>/dev/null
|
rm "${LOGFILE}" 2>/dev/null
|
||||||
|
|
|
@ -334,6 +334,7 @@ if [ "${AUTOUPDATE}" = "yes" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if git fetch origin $BRANCHNAME --quiet && ! git diff --quiet FETCH_HEAD; then
|
||||||
info "Auto-updating..."
|
info "Auto-updating..."
|
||||||
if ! git merge --quiet FETCH_HEAD; then
|
if ! git merge --quiet FETCH_HEAD; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue