From 2c98bbacc8db3b251e1679f9da84cf1f5ed5726a Mon Sep 17 00:00:00 2001 From: Sam Nystrom Date: Tue, 15 Oct 2024 13:29:10 -0400 Subject: update ~/bin --- bin/init | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 bin/init (limited to 'bin/init') diff --git a/bin/init b/bin/init new file mode 100755 index 0000000..436e55a --- /dev/null +++ b/bin/init @@ -0,0 +1,51 @@ +#!/bin/execlineb -P +importas -i XDG_RUNTIME_DIR XDG_RUNTIME_DIR +importas -i HOME HOME + +foreground { redirfd -w 2 /dev/null + foreground { find ${XDG_RUNTIME_DIR} -maxdepth 1 ! -path ${XDG_RUNTIME_DIR} -exec rm -rf "{}" + } + foreground { mkdir -p + ${HOME}/.local/state/s6/uncaught-logs + ${XDG_RUNTIME_DIR}/service/.s6-svscan + ${XDG_RUNTIME_DIR}/service/s6-svscan-log + } + ln -sf /bin/false ${XDG_RUNTIME_DIR}/service/.s6-svscan/crash +} +execline-cd ${XDG_RUNTIME_DIR}/service +if { + redirfd -w 1 .s6-svscan/finish + heredoc 0 "#!/bin/execlineb -P\ns6-svc -x -- \"${XDG_RUNTIME_DIR}/service/s6-svscan-log\"\n" + cat +} +if { chmod 0755 .s6-svscan/finish } +foreground { redirfd -w 2 /dev/null mkfifo -m 0600 s6-svscan-log/fifo } +if { redirfd -w 1 s6-svscan-log/notification-fd echo 3 } +if { + redirfd -w 1 s6-svscan-log/run + heredoc 0 "#!/bin/execlineb -P +redirfd -rnb 0 fifo +exec -c +s6-log -bpd3 -- t ${HOME}/.local/state/s6/uncaught-logs\n" + cat +} +if { chmod 0755 s6-svscan-log/run } + +redirfd -r 0 /dev/null +redirfd -wnb 1 s6-svscan-log/fifo +fdmove -c 2 1 + +fdreserve 2 +multisubstitute { importas -u fdr FD0 importas -u fdw FD1 } +piperw ${fdr} ${fdw} +background { + fdclose ${fdw} + foreground { fdmove 0 ${fdr} redirfd -w 1 /dev/null cat } + s6-svlisten -U { ./s6-svscan-log } + if { s6-rc-init -bl ${XDG_RUNTIME_DIR}/s6-rc + -c ${HOME}/.local/share/s6-rc/compiled + ${XDG_RUNTIME_DIR}/service } + s6-rc -l ${XDG_RUNTIME_DIR}/s6-rc -bu change default +} +fdclose ${fdr} +emptyenv -c +s6-svscan -d ${fdw} -- ${XDG_RUNTIME_DIR}/service -- cgit v1.2.3