pull/428/head
sfeakes 2025-05-17 14:15:16 -05:00
parent fa5ea8e85c
commit d182784ae2
2 changed files with 19 additions and 7 deletions

View File

@ -30,9 +30,10 @@ REMOUNT_RO=1
TRUE=0 TRUE=0
FALSE=1 FALSE=1
_logfile=""; _logfile=""
_frommake=$FALSE; _frommake=$FALSE
_ignorearch=$FALSE; _ignorearch=$FALSE
_nosystemd=$FALSE
log() log()
{ {
@ -59,7 +60,7 @@ printHelp()
} }
log "Called $0 with $*" #log "Called $0 with $*"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case "$1" in case "$1" in
@ -83,6 +84,9 @@ while [[ $# -gt 0 ]]; do
ignorearch) ignorearch)
_ignorearch=$TRUE _ignorearch=$TRUE
;; ;;
nosystemd)
_nosystemd=$TRUE
;;
help | -help | --help | -h) help | -help | --help | -h)
printHelp printHelp
exit $TRUE; exit $TRUE;
@ -170,9 +174,11 @@ fi
# Exit if we can't find systemctl # Exit if we can't find systemctl
command -v systemctl >/dev/null 2>&1 || { log "This script needs systemd's systemctl manager, Please check path or install manually" >&2; exit 1; } command -v systemctl >/dev/null 2>&1 || { log "This script needs systemd's systemctl manager, Please check path or install manually" >&2; exit 1; }
# stop service, hide any error, as the service may not be installed yet if [ "$_nosystemd" -eq $FALSE ]; then
systemctl stop $SERVICE > /dev/null 2>&1 # stop service, hide any error, as the service may not be installed yet
SERVICE_EXISTS=$(echo $?) systemctl stop $SERVICE > /dev/null 2>&1
SERVICE_EXISTS=$(echo $?)
fi
# Clean everything if requested. # Clean everything if requested.
if [ "$1" == "clean" ]; then if [ "$1" == "clean" ]; then
@ -287,6 +293,11 @@ fi
# remount root ro # remount root ro
if [[ $REMOUNT_RO -eq 0 ]]; then if [[ $REMOUNT_RO -eq 0 ]]; then
mount / -o remount,ro &>/dev/null mount / -o remount,ro &>/dev/null
log "Root filesystem remounted RO"
fi
if [ "$_nosystemd" -eq $TRUE ]; then
exit 0
fi fi
systemctl enable $SERVICE systemctl enable $SERVICE

View File

@ -45,6 +45,7 @@ log()
echo "$*" echo "$*"
if [ "$SYSTEMD_LOG" -eq $TRUE ]; then if [ "$SYSTEMD_LOG" -eq $TRUE ]; then
# For some unknown reason, only way below works from aqualinkd process is adding "&>> "$OUTPUT""
echo "Upgrade: $*" | systemd-cat -t aqualinkd -p info &>> "$OUTPUT" echo "Upgrade: $*" | systemd-cat -t aqualinkd -p info &>> "$OUTPUT"
else else
logger -p local0.notice -t aqualinkd "Upgrade: $*" logger -p local0.notice -t aqualinkd "Upgrade: $*"