commit 3b0c7264bb1cd2f48dafa555cf11423ea4f9e1c8 parent c3ac5ec06169db3983a0ee73891fa53d708e0dd1 Author: mrgrouse <bdmfegys@duck.com> Date: Sun, 27 Jul 2025 19:17:19 -0400 fix default cases and if statements in sinit/rc.shutdown Diffstat:
| M | sinit/rc.shutdown | | | 31 | ++++++++++++++++--------------- |
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/sinit/rc.shutdown b/sinit/rc.shutdown @@ -8,15 +8,14 @@ posix-umask 022 # getting env vars envfile /etc/rc.conf +# there's probably a more elegant way to do this but this is all i got :shrug: case -N -- $1 { "reboot" {} - "poweroff" {} - -# may not work as execline treats globs as characters typically - "*" {foreground { printf "Invalid option '%s' for %s" $1 $0 } exit 1 } -} +} +# default case +{ foreground { printf "Invalid option '%s' for %s" $1 $0 } exit 1 } # set linefeed mode to avoid staircase effect foreground { echo } @@ -31,18 +30,20 @@ case -N -- $HARDWARECLOCK "" {} "UTC" { HW } #FIXME "localtime" { define hwclock_params "-l ${hwclock_params}" } - "*" { define hwclock_params "" } -} -if { eltest -n $hwclock_params } -{ - background { printf "Saving System Clock\n" } - foreground { - if { eltest -n $TIMEZONE } - { export TZ $TIMEZONE } +} { define hwclock_params "" } # default case + +foreground { + if { eltest -n $hwclock_params } + { + background { printf "Saving System Clock\n" } + foreground { + if { eltest -n $TIMEZONE } + { export TZ $TIMEZONE } + } + if { /bin/hwclock ${hwclock_params} /dev/rtc0 } + { unexport TZ } } - if { /bin/hwclock ${hwclock_params} /dev/rtc0 } - { unexport TZ } } background { /bin/printf "Storing random seed...\n" }