From: Ralph Ronnquist Date: Tue, 14 Nov 2023 20:06:37 +0000 (+1100) Subject: Init script to "preserve" device nodes bmo keeping a file /.devnodes.tgz X-Git-Tag: 1.1~2 X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=7b15d77870dca9f0fa81d7c9a1b8230e66a4b195;p=rrq%2Foverlay-boot.git Init script to "preserve" device nodes bmo keeping a file /.devnodes.tgz --- diff --git a/devnodes-init.sh b/devnodes-init.sh new file mode 100755 index 0000000..5e5402c --- /dev/null +++ b/devnodes-init.sh @@ -0,0 +1,27 @@ +#!/bin/sh /lib/init/init-d-script +### BEGIN INIT INFO +# Provides: devices +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: 0 1 6 +# Short-Description: set up devnodes +# Description: Initialize /dev from /.devnodes.tgz +### END INIT INFO + +DAEMON=none +DESC="devnodes: restore and capture /dev on startup and shutdown." +TGZ=/.devnodes.tgz + +do_start_override() { + [ -e $TGZ ] && tar -xzf $TGZ --skip-old-files -C /dev +} + +do_stop_override() { + cd /dev && tar czf $TGZ * +} + +do_status_override() { + find /dev -type d -exec ls -ld '{}' ';' + stat -c %Y $TGZ +}