commit 75748b912c8d7210a6fd854b14ae666e0bb9134b
parent 7c06ed3778aadcbc5e1ddaaeaf281a665dc2856a
Author: mrgrouse <bdmfegys@duck.com>
Date: Tue, 5 Aug 2025 02:42:39 -0400
fix various formatting and syntax issues, especially printf syntax issues
Diffstat:
8 files changed, 98 insertions(+), 90 deletions(-)
diff --git a/svc/services/default/dropbear.conf b/svc/services/default/dropbear.conf
@@ -3,4 +3,4 @@
# -F stops dropbear from fork()ing into the background
# -R automatically generates the server's keys. no more checking for keys every startup!
# ( i know the above is probably a bad idea maybe due to known_hosts but i'm gonna try it anyway :O )
-DB_OPTS="-FR"
+DB_OPTS=-FR
diff --git a/svc/services/dropbear b/svc/services/dropbear
@@ -5,21 +5,20 @@ importas -S PATH
envfile /etc/svc.d/default/dropbear.conf
case -N -- $1
- {
- "-s" {
- foreground { printf "Starting dropbear daemon...\n" }
- background { dropbear $DB_OPTS -P /run/dropbear.pid }
-
- }
- "-k" {
- # set PID to pid of running process (may (not) exist)
- #backtick PID { pidof -o %PPID dropbear }
- backtick PID { cat /run/dropbear.pid }
- foreground { printf "Stopping dropbear daemon...\n" }
-
- forx x { $PID }
- {
- foreground { kill -9 $x }
+{
+ "-s" { # start case
+ foreground { printf "Starting dropbear daemon...\n" }
+ background { dropbear $DB_OPTS -P /run/dropbear.pid }
}
+ "-k" { # kill case
+ # set PID to pid of running process (may (not) exist)
+ #backtick PID { pidof -o %PPID dropbear }
+ backtick PID { cat /run/dropbear.pid }
+ foreground { printf "Stopping dropbear daemon...\n" }
+ forx x { $PID }
+ {
+ foreground { kill -9 $x }
+ }
}
- } foreground { /usr/bin/printf "usage: %s -s|-k\n" $0 } exit 1
-\ No newline at end of file
+} # default case:
+foreground { /usr/bin/printf "usage: %s -s|-k\n" "$0" } exit 1
+\ No newline at end of file
diff --git a/svc/services/hwclock b/svc/services/hwclock
@@ -8,13 +8,14 @@ importas -S PATH
envfile /etc/svc.d/default/hwclock.conf
case -N -- $1
- {
- "-s" {
- foreground { printf "Setting system clock...\n" }
- foreground { hwclock $HWCLOCK_UP /dev/rtc0 }
- }
- "-k" {
- foreground { printf "Saving system clock...\n" }
- foreground { hwclock $HWCLOCK_DOWN /dev/rtc0 }
+{
+ "-s" { # start case
+ foreground { printf "Setting system clock...\n" }
+ foreground { hwclock $HWCLOCK_UP /dev/rtc0 }
}
- } foreground { /usr/bin/printf "usage: %s -s|-k\n" $0 } exit 1
-\ No newline at end of file
+ "-k" { # kill case
+ foreground { printf "Saving system clock...\n" }
+ foreground { hwclock $HWCLOCK_DOWN /dev/rtc0 }
+ }
+} # default case
+foreground { /usr/bin/printf "usage: %s -s|-k\n" "$0" } exit 1
+\ No newline at end of file
diff --git a/svc/services/minecraft b/svc/services/minecraft
@@ -1,27 +1,28 @@
#!/usr/bin/execlineb -S1
# Use execlineb -WS1 for debug/testing (errors out on bad syntax)
-# i did indeed write this script. however, i don't recommend using this for a server you're not just testing, as i personally recommend having a supervisor daemon, such as s6-supervise.
+# i did indeed write this script. however, i don't recommend using this for a server you're not just testing, as i personally recommend having a supervisor daemon, such as s6-supervise.
envfile /etc/svc.d/default/minecraft.conf
case -N -- $1
- {
- "-s" {
- foreground { printf "Starting minecraft server...\n" }
- cd ${serverdir}
- background { s6-setuidgid ${serveruser} java -jar ${serverdir}/${jarfile} ${javaflags} }
- # save pid(s) to pidfile
- redirfd -w 1 /run/minecraft.pid { pidof -o %PPID java }
- }
- "-k" {
- # set PID to pid of running process (may (not) exist)
- #backtick PID { pidof -o %PPID dropbear }
- backtick PID { cat /run/minecraft.pid }
- foreground { printf "Stopping dropbear daemon...\n" }
- forx x { $PID }
- {
- foreground { kill -9 $x }
+{
+ "-s" { # start case:
+ foreground { printf "Starting minecraft server...\n" }
+ cd ${serverdir}
+ background { s6-setuidgid ${serveruser} java -jar ${serverdir}/${jarfile} ${javaflags} }
+ # save pid(s) to pidfile
+ redirfd -w 1 /run/minecraft.pid { pidof -o %PPID java }
}
+ "-k" { # kill case:
+ # set PID to pid of running process (may (not) exist)
+ #backtick PID { pidof -o %PPID dropbear }
+ backtick PID { cat /run/minecraft.pid }
+ foreground { printf "Stopping dropbear daemon...\n" }
+ forx x { $PID }
+ {
+ foreground { kill -9 $x }
+ }
}
- } foreground { /usr/bin/printf "usage: %s -s|-k\n" $0 } exit 1
-\ No newline at end of file
+} # default case:
+foreground { /usr/bin/printf "usage: %s -s|-k\n" "$0" } exit 1
+\ No newline at end of file
diff --git a/svc/services/network b/svc/services/network
@@ -6,24 +6,25 @@
envfile /etc/svc.d/default/network.conf
case -N -- $1
- {
- "-s" {
- # iproute2/busybox (ewww!)
- ip addr add 127.0.0.1/8 dev lo broadcast + scope host
- ip link set lo up
+{
+ "-s" { # start case:
+ # iproute2/busybox (ewww!)
+ ip addr add 127.0.0.1/8 dev lo broadcast + scope host
+ ip link set lo up
- # ifconfig (net-tools) (yay!)
- #ifconfig lo up 127.0.0.1/8
- #ifconfig $DEV1 mtu $DEV1_MTU
- #route add default gw $GW_ADDY $DEV1
- }
- "-k" {
- # iproute2/busybox (ewww!)
- ip link set lo down
- ip link set $DEV1 down
+ # ifconfig (net-tools) (yay!)
+ #ifconfig lo up 127.0.0.1/8
+ #ifconfig $DEV1 mtu $DEV1_MTU
+ #route add default gw $GW_ADDY $DEV1
+ }
+ "-k" { # kill case:
+ # iproute2/busybox (ewww!)
+ ip link set lo down
+ ip link set $DEV1 down
- # ifconfig (net-tools) (yay!)
- #ifconfig lo down
- #ifconfig $DEV1 down
+ # ifconfig (net-tools) (yay!)
+ #ifconfig lo down
+ #ifconfig $DEV1 down
}
- } foreground { /bin/printf "usage: %s -s|-k\n" $0 } exit 1
-\ No newline at end of file
+} # default case:
+foreground { /bin/printf "usage: %s -s|-k\n" "$0" } exit 1
+\ No newline at end of file
diff --git a/svc/services/random-seed b/svc/services/random-seed
@@ -10,9 +10,10 @@ case -N -- $1
redirfd -w 1 /dev/urandom { cat /etc/random-seed }
}
exec dd if=/dev/urandom of=/etc/random-seed count=1 bs=512
+ }
"-k" {
foreground { printf "Storing random seed...\n" }
exec dd if=/dev/urandom of=/etc/random-seed count=1 bs=512
}
- } foreground { /usr/bin/printf "usage: %s -s|-k\n" $0 } exit 1
-\ No newline at end of file
+ } foreground { /usr/bin/printf "usage: %s -s|-k\n" "$0" } exit 1
+\ No newline at end of file
diff --git a/svc/services/sdhcp b/svc/services/sdhcp
@@ -4,13 +4,18 @@
envfile /etc/svc.d/default/network.conf
case -N -- $1
- {
- "-s" {
- background { printf "Getting DHCP Address on %s...\n" $DEV1 }
- foreground { sdhcp $SDHCP_ARGS -ef $DEV1 }
- }
- "-k" {
- # svc -k network
- exit 0
+{
+ # start service
+ "-s" {
+ importas -S DEV1
+ importas -S SDHCP_ARGS
+ background { printf "Getting DHCP Address on %s...\n" "$DEV1" }
+ foreground { sdhcp $SDHCP_ARGS -ef $DEV1 }
}
- } foreground { /bin/printf "usage: %s -s|-k\n" $0 } exit 1
-\ No newline at end of file
+ # kill service
+ "-k" {
+ # svc -k network
+ exit 0
+ }
+} # default case:
+foreground { /bin/printf "usage: %s -s|-k\n" "$0" } exit 1
+\ No newline at end of file
diff --git a/svc/services/smdev b/svc/services/smdev
@@ -2,15 +2,16 @@
# Use execlineb -WS1 for debug/testing (errors out on bad syntax)
case -N -- $1
- {
- "-s" {
- background { printf "Populating /dev with smdev...\n"
- foreground { smdev -s }
- background { printf "Registering smdev as kernel hotplug manager...\n" }
- redirfd -w 1 /proc/sys/kernel/hotplug { printf "/sbin/smdev" }
- }
- "-k" {
- background { printf "Removing kernel hotplug manager...\n" }
- redirfd -w 1 /proc/sys/kernel/hotplug { printf "\0" }
+{
+ "-s" { # start case:
+ background { printf "Populating /dev with smdev...\n"
+ foreground { smdev -s }
+ background { printf "Registering smdev as kernel hotplug manager...\n" }
+ redirfd -w 1 /proc/sys/kernel/hotplug { printf "/sbin/smdev" }
}
- } foreground { /bin/printf "usage: %s -s|-k\n" $0 } exit 1
-\ No newline at end of file
+ "-k" { # kill case:
+ background { printf "Removing kernel hotplug manager...\n" }
+ redirfd -w 1 /proc/sys/kernel/hotplug { printf "\0" }
+ }
+} # default case:
+foreground { /bin/printf "usage: %s -s|-k\n" "$0" } exit 1