From 7b15d77870dca9f0fa81d7c9a1b8230e66a4b195 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Wed, 15 Nov 2023 07:06:37 +1100 Subject: [PATCH] Init script to "preserve" device nodes bmo keeping a file /.devnodes.tgz --- devnodes-init.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 devnodes-init.sh 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 +} -- 2.39.2