lfs-execline-scripts

Repository for execline scripts used in my linux-from-scratch builds
Log | Files | Refs

commit d8992029558de4231374cd6324970a786f23e1d2
parent 4266f9b32cac71ba120553c2e8f9f275cb5c9ea6
Author: mrgrouse <bdmfegys@duck.com>
Date:   Sun, 27 Jul 2025 18:43:00 -0400

fix if statements in svc/bare.sh

Diffstat:
Msvc/bare.sh | 29++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/svc/bare.sh b/svc/bare.sh @@ -1,18 +1,19 @@ #!/bin/execlineb -S1 # do execlineb -WS1 for testing (errors out on bad syntax) -if { eltest "$#" = 0 } foreground - { - define SERVICE "$0" - shift -n 1 - } - +foreground { + if { eltest "$#" = 0 } foreground + { + define SERVICE "$0" + shift -n 1 + } +} # we may need to change this bc said file may ned to run some code # we can put maybe EXTSCRIPTS=1 in said config if it needs to run an external script, which we can # then check for and tghen run said script -if { eltest -e "/bin/svc.d/default/${SERVICE}" } - { - envfile { "/bin/svc.d/default/${SERVICE}" } - } +foreground { + if { eltest -e "/bin/svc.d/default/${SERVICE}" } + { envfile { "/bin/svc.d/default/${SERVICE}" } } +} define BIN "" # loop thru std $PATH forx i { /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin } @@ -25,7 +26,10 @@ forx i { /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin } } } -if { eltest -v BIN } exit 1 +foreground { + if { eltest -v BIN } + { exit 1 } +} # set PID to pid of running process (may (not) exist) backtick PID { pidof -o %PPID $BIN } @@ -34,5 +38,4 @@ case -N -- $1 { "-s" { if { eltest -v PID } { exec $BIN $PARAMS } } # if $PID is empty, run $BIN $PARAMS "-k" { if { eltest ! -v PID } kill -9 $PID } # if $PID isn't empty, run kill -9 $PID &>/dev/null - "*" { foreground { printf "usage: %s -s|-k\n" $0 } exit 1 } # FIXME globs probably don't work in this case, fix for execline - } + } { foreground { printf "usage: %s -s|-k\n" $0 } exit 1 }