diff options
| author | Robert Günzler <r@gnzler.io> | 2022-12-09 09:44:07 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-12-09 09:44:07 +0100 |
| commit | 31f47375516fa4dfe54650b7a0a8fcf7b580a98f (patch) | |
| tree | 4480d3ee4c8bf563f21774777693d8adc40adc79 /bin | |
| parent | 27135e5a5ce2f4655123f43a1649ec17de852477 (diff) | |
bin/rcmenu: support bundles
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/rcmenu | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/bin/rcmenu b/bin/rcmenu index 06e940c..976afe7 100755 --- a/bin/rcmenu +++ b/bin/rcmenu @@ -5,14 +5,27 @@ set -u export MENU_PROMPT=" rc" svdir=/run/s6-rc/servicedirs +rcdir=/etc/s6-rc/src ico=/usr/share/icons/mdi/scalable/run-fast.svg menu_exitcode=-1 __list() { - for sv in "$svdir"/*; do - printf "%s " "$(basename "$sv")" - doas -n s6-svstat "$sv" - done | column -t + ( + find "$svdir" -mindepth 1 -maxdepth 1 -type d -print | + while read -r sv; do + printf "%s " "$(basename "$sv")" + doas -n s6-svstat "$sv" + done + find "$rcdir" -mindepth 1 -maxdepth 1 -type d -print | + while read -r sv; do + if [ -f "$sv/type" ] && grep -q bundle "$sv/type"; then + printf "%s " "$(basename "$sv")" + printf "[bundle] " + printf "contents: " + find "$sv/contents.d/" -type f -exec basename {} \; | xargs | sed 's, ,/,g' + fi + done + ) | column -t } __handle() { @@ -32,12 +45,13 @@ __handle() { fi ;; - down) + down | \[bundle\]) action=start msg=$(doas -n s6-rc -v2 -u change "$sv") ;; *) + action=noop msg=$(printf "unknown service state: %s\n" "$state") false ;; |