summary refs log tree commit diff
path: root/contrib/rvnit/08Smisc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/rvnit/08Smisc')
-rwxr-xr-xcontrib/rvnit/08Smisc30
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/rvnit/08Smisc b/contrib/rvnit/08Smisc
new file mode 100755
index 0000000..ad11691
--- /dev/null
+++ b/contrib/rvnit/08Smisc
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+. /etc/rc.conf
+. /etc/runit/functions
+
+# vim: set ts=4 sw=4 et:
+
+install -m0664 -o root -g utmp /dev/null /run/utmp
+halt -B  # for wtmp
+
+if [ -z "$VIRTUALIZATION" ]; then
+    msg "Initializing random seed..."
+    cp /var/lib/random-seed /dev/urandom >/dev/null 2>&1 || true
+fi
+
+msg "Setting up loopback interface..."
+ip link set up dev lo
+
+[ -r /etc/hostname ] && read -r HOSTNAME < /etc/hostname
+if [ -n "$HOSTNAME" ]; then
+    msg "Setting up hostname to '${HOSTNAME}'..."
+    printf "%s" "$HOSTNAME" > /proc/sys/kernel/hostname
+else
+    msg_warn "Didn't setup a hostname!"
+fi
+
+if [ -n "$TIMEZONE" ]; then
+    msg "Setting up timezone to '${TIMEZONE}'..."
+    ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
+fi