Skip to content

Commit

Permalink
shutdown: and stay down
Browse files Browse the repository at this point in the history
  • Loading branch information
anzz1 authored Jun 17, 2023
1 parent 0878b1b commit c55f403
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions skeleton/.system/bin/shutdown
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#!/bin/sh

flawless_victory() {
r=0
for p in $1; do
if [ -d "/proc/$p" ]; then
return 1
if [ -d "/proc/$p" ] && [ $p -ne $$ ]; then
kill $2 $p
r=1
fi
done
return 0
return $r
}

fatality() {
c=0
while [ $c -lt 5 ]; do
pids=$(fuser -m /mnt/SDCARD | sed -r "s/\b$$\b//g")
if flawless_victory "$pids"; then
pids=$(fuser -m /mnt/SDCARD)
if flawless_victory "$pids" $1; then
return
fi
kill $1 $pids
sleep 0.1
c=$((c+1))
done
Expand Down

0 comments on commit c55f403

Please sign in to comment.