From 366c535d93aa3a8ad44f56ca1e024bb9e26bf11c Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 7 Jan 2022 16:47:27 +0100 Subject: contrib: update --- contrib/rvnit-init | 7 ++-- contrib/rvnit/00Kpoweroff | 11 ++++++ contrib/rvnit/00Shello | 2 + contrib/rvnit/01Spseudofs | 49 +++++++++++++++++++++++ contrib/rvnit/02Sstatic-devnodes | 8 ++++ contrib/rvnit/03Skmods | 12 ++++++ contrib/rvnit/04Sudev | 23 +++++++++++ contrib/rvnit/05Sconsole-setup | 30 ++++++++++++++ contrib/rvnit/06Sfilesystems | 79 +++++++++++++++++++++++++++++++++++++ contrib/rvnit/07Sswap | 9 +++++ contrib/rvnit/08Smisc | 30 ++++++++++++++ contrib/rvnit/09Ssysctl | 24 +++++++++++ contrib/rvnit/20Scleanup | 11 ++++++ contrib/rvnit/30Dacpid | 2 + contrib/rvnit/30Dudevd | 3 ++ contrib/rvnit/40Ddhcpcd | 2 + contrib/rvnit/45Snetup | 14 +++++++ contrib/rvnit/50Dopensshd | 3 ++ contrib/rvnit/90Dagetty-tty3 | 3 ++ contrib/rvnit/90Dagetty-tty4 | 3 ++ contrib/rvnit/90Dagetty-tty5 | 3 ++ contrib/rvnit/90Dagetty-tty6 | 3 ++ contrib/rvnit/99Dsulogin | 3 ++ contrib/rvnit/sv/00Kpoweroff | 11 ------ contrib/rvnit/sv/00Shello | 2 - contrib/rvnit/sv/01Spseudofs | 49 ----------------------- contrib/rvnit/sv/02Sstatic-devnodes | 8 ---- contrib/rvnit/sv/03Skmods | 12 ------ contrib/rvnit/sv/04Sudev | 23 ----------- contrib/rvnit/sv/05Sconsole-setup | 30 -------------- contrib/rvnit/sv/06Sfilesystems | 79 ------------------------------------- contrib/rvnit/sv/07Sswap | 9 ----- contrib/rvnit/sv/08Smisc | 30 -------------- contrib/rvnit/sv/09Ssysctl | 24 ----------- contrib/rvnit/sv/20Scleanup | 11 ------ contrib/rvnit/sv/30Dacpid | 2 - contrib/rvnit/sv/30Dudevd | 3 -- contrib/rvnit/sv/40Ddhcpcd | 2 - contrib/rvnit/sv/45Snetup | 14 ------- contrib/rvnit/sv/50Dopensshd | 3 -- contrib/rvnit/sv/90Dagetty-tty3 | 3 -- contrib/rvnit/sv/90Dagetty-tty4 | 3 -- contrib/rvnit/sv/90Dagetty-tty5 | 3 -- contrib/rvnit/sv/90Dagetty-tty6 | 3 -- contrib/rvnit/sv/99Dsulogin | 3 -- 45 files changed, 331 insertions(+), 330 deletions(-) create mode 100755 contrib/rvnit/00Kpoweroff create mode 100755 contrib/rvnit/00Shello create mode 100755 contrib/rvnit/01Spseudofs create mode 100755 contrib/rvnit/02Sstatic-devnodes create mode 100755 contrib/rvnit/03Skmods create mode 100755 contrib/rvnit/04Sudev create mode 100755 contrib/rvnit/05Sconsole-setup create mode 100755 contrib/rvnit/06Sfilesystems create mode 100755 contrib/rvnit/07Sswap create mode 100755 contrib/rvnit/08Smisc create mode 100755 contrib/rvnit/09Ssysctl create mode 100755 contrib/rvnit/20Scleanup create mode 100755 contrib/rvnit/30Dacpid create mode 100755 contrib/rvnit/30Dudevd create mode 100755 contrib/rvnit/40Ddhcpcd create mode 100755 contrib/rvnit/45Snetup create mode 100755 contrib/rvnit/50Dopensshd create mode 100755 contrib/rvnit/90Dagetty-tty3 create mode 100755 contrib/rvnit/90Dagetty-tty4 create mode 100755 contrib/rvnit/90Dagetty-tty5 create mode 100755 contrib/rvnit/90Dagetty-tty6 create mode 100755 contrib/rvnit/99Dsulogin delete mode 100755 contrib/rvnit/sv/00Kpoweroff delete mode 100755 contrib/rvnit/sv/00Shello delete mode 100755 contrib/rvnit/sv/01Spseudofs delete mode 100755 contrib/rvnit/sv/02Sstatic-devnodes delete mode 100755 contrib/rvnit/sv/03Skmods delete mode 100755 contrib/rvnit/sv/04Sudev delete mode 100755 contrib/rvnit/sv/05Sconsole-setup delete mode 100755 contrib/rvnit/sv/06Sfilesystems delete mode 100755 contrib/rvnit/sv/07Sswap delete mode 100755 contrib/rvnit/sv/08Smisc delete mode 100755 contrib/rvnit/sv/09Ssysctl delete mode 100755 contrib/rvnit/sv/20Scleanup delete mode 100755 contrib/rvnit/sv/30Dacpid delete mode 100755 contrib/rvnit/sv/30Dudevd delete mode 100755 contrib/rvnit/sv/40Ddhcpcd delete mode 100755 contrib/rvnit/sv/45Snetup delete mode 100755 contrib/rvnit/sv/50Dopensshd delete mode 100755 contrib/rvnit/sv/90Dagetty-tty3 delete mode 100755 contrib/rvnit/sv/90Dagetty-tty4 delete mode 100755 contrib/rvnit/sv/90Dagetty-tty5 delete mode 100755 contrib/rvnit/sv/90Dagetty-tty6 delete mode 100755 contrib/rvnit/sv/99Dsulogin diff --git a/contrib/rvnit-init b/contrib/rvnit-init index 34b54b6..96786ea 100755 --- a/contrib/rvnit-init +++ b/contrib/rvnit-init @@ -5,7 +5,8 @@ export PATH # control tty exec /dev/tty1 2>&1 -mountpoint -q /tmp || mount /tmp +mountpoint -q /proc || mount -o nosuid,noexec,nodev -t proc proc /proc +mountpoint -q /run || mount -o mode=0755,nosuid,nodev -t tmpfs run /run -cd /etc/rvnit -exec /bin/rvnit +ctrlaltdel soft +exec /bin/rvnit /etc/rvnit diff --git a/contrib/rvnit/00Kpoweroff b/contrib/rvnit/00Kpoweroff new file mode 100755 index 0000000..2fae082 --- /dev/null +++ b/contrib/rvnit/00Kpoweroff @@ -0,0 +1,11 @@ +#!/bin/sh +echo system halted. +sync + +sleep 10 + +if [ -n "$RVNIT_WANT_REBOOT" ]; then + reboot -f +else + halt -f +fi diff --git a/contrib/rvnit/00Shello b/contrib/rvnit/00Shello new file mode 100755 index 0000000..a57760b --- /dev/null +++ b/contrib/rvnit/00Shello @@ -0,0 +1,2 @@ +#!/bin/sh +echo Hello from rvnit diff --git a/contrib/rvnit/01Spseudofs b/contrib/rvnit/01Spseudofs new file mode 100755 index 0000000..94c9e85 --- /dev/null +++ b/contrib/rvnit/01Spseudofs @@ -0,0 +1,49 @@ +#!/bin/sh +# vim: set ts=4 sw=4 et: + +. /etc/runit/functions + +msg "Mounting pseudo-filesystems..." +mountpoint -q /proc || mount -o nosuid,noexec,nodev -t proc proc /proc +mountpoint -q /sys || mount -o nosuid,noexec,nodev -t sysfs sys /sys +mountpoint -q /run || mount -o mode=0755,nosuid,nodev -t tmpfs run /run +mountpoint -q /dev || mount -o mode=0755,nosuid -t devtmpfs dev /dev +mkdir -p -m0755 /run/runit /run/lvm /run/user /run/lock /run/log /dev/pts /dev/shm +mountpoint -q /dev/pts || mount -o mode=0620,gid=5,nosuid,noexec -n -t devpts devpts /dev/pts +mountpoint -q /dev/shm || mount -o mode=1777,nosuid,nodev -n -t tmpfs shm /dev/shm +mountpoint -q /sys/kernel/security || mount -n -t securityfs securityfs /sys/kernel/security + +if [ -z "$VIRTUALIZATION" ]; then + _cgroupv1="" + _cgroupv2="" + + case "${CGROUP_MODE:-hybrid}" in + legacy) + _cgroupv1="/sys/fs/cgroup" + ;; + hybrid) + _cgroupv1="/sys/fs/cgroup" + _cgroupv2="${_cgroupv1}/unified" + ;; + unified) + _cgroupv2="/sys/fs/cgroup" + ;; + esac + + # cgroup v1 + if [ -n "$_cgroupv1" ]; then + mountpoint -q "$_cgroupv1" || mount -o mode=0755 -t tmpfs cgroup "$_cgroupv1" + while read -r _subsys_name _hierarchy _num_cgroups _enabled; do + [ "$_enabled" = "1" ] || continue + _controller="${_cgroupv1}/${_subsys_name}" + mkdir -p "$_controller" + mountpoint -q "$_controller" || mount -t cgroup -o "$_subsys_name" cgroup "$_controller" + done < /proc/cgroups + fi + + # cgroup v2 + if [ -n "$_cgroupv2" ]; then + mkdir -p "$_cgroupv2" + mountpoint -q "$_cgroupv2" || mount -t cgroup2 -o nsdelegate cgroup2 "$_cgroupv2" + fi +fi diff --git a/contrib/rvnit/02Sstatic-devnodes b/contrib/rvnit/02Sstatic-devnodes new file mode 100755 index 0000000..ef747a4 --- /dev/null +++ b/contrib/rvnit/02Sstatic-devnodes @@ -0,0 +1,8 @@ +#!/bin/sh + +# Some kernel modules must be loaded before starting udev(7). +# Load them by looking at the output of `kmod static-nodes`. + +for f in $(kmod static-nodes 2>/dev/null|awk '/Module/ {print $2}'); do + modprobe -bq $f 2>/dev/null +done diff --git a/contrib/rvnit/03Skmods b/contrib/rvnit/03Skmods new file mode 100755 index 0000000..f25fb10 --- /dev/null +++ b/contrib/rvnit/03Skmods @@ -0,0 +1,12 @@ +#!/bin/sh +# vim: set ts=4 sw=4 et: + +. /etc/runit/functions + +[ -n "$VIRTUALIZATION" ] && return 0 +# Do not try to load modules if kernel does not support them. +[ ! -e /proc/modules ] && return 0 + +msg "Loading kernel modules..." +modules-load -v | tr '\n' ' ' | sed 's:insmod [^ ]*/::g; s:\.ko\(\.gz\)\? ::g' +echo diff --git a/contrib/rvnit/04Sudev b/contrib/rvnit/04Sudev new file mode 100755 index 0000000..d1b0697 --- /dev/null +++ b/contrib/rvnit/04Sudev @@ -0,0 +1,23 @@ +#!/bin/sh + +. /etc/runit/functions + +# vim: set ts=4 sw=4 et: + +[ -n "$VIRTUALIZATION" ] && return 0 + +if [ -x /usr/lib/systemd/systemd-udevd ]; then + _udevd=/usr/lib/systemd/systemd-udevd +elif [ -x /sbin/udevd -o -x /bin/udevd ]; then + _udevd=udevd +else + msg_warn "cannot find udevd!" +fi + +if [ -n "${_udevd}" ]; then + msg "Starting udev and waiting for devices to settle..." + ${_udevd} --daemon + udevadm trigger --action=add --type=subsystems + udevadm trigger --action=add --type=devices + udevadm settle +fi diff --git a/contrib/rvnit/05Sconsole-setup b/contrib/rvnit/05Sconsole-setup new file mode 100755 index 0000000..966121b --- /dev/null +++ b/contrib/rvnit/05Sconsole-setup @@ -0,0 +1,30 @@ +#!/bin/sh + +. /etc/runit/functions + +# vim: set ts=4 sw=4 et: + +[ -n "$VIRTUALIZATION" ] && return 0 + +TTYS=${TTYS:-12} +if [ -n "$FONT" ]; then + msg "Setting up TTYs font to '${FONT}'..." + + _index=0 + while [ ${_index} -le $TTYS ]; do + setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} \ + $FONT -C "/dev/tty${_index}" + _index=$((_index + 1)) + done +fi + +if [ -n "$KEYMAP" ]; then + msg "Setting up keymap to '${KEYMAP}'..." + loadkeys -q -u ${KEYMAP} +fi + +if [ -n "$HARDWARECLOCK" ]; then + msg "Setting up RTC to '${HARDWARECLOCK}'..." + TZ=$TIMEZONE hwclock --systz \ + ${HARDWARECLOCK:+--$(echo $HARDWARECLOCK |tr A-Z a-z) --noadjfile} || emergency_shell +fi diff --git a/contrib/rvnit/06Sfilesystems b/contrib/rvnit/06Sfilesystems new file mode 100755 index 0000000..bc72eca --- /dev/null +++ b/contrib/rvnit/06Sfilesystems @@ -0,0 +1,79 @@ +#!/bin/sh + +. /etc/runit/functions + +# vim: set ts=4 sw=4 et: + +[ -n "$VIRTUALIZATION" ] && return 0 + +msg "Remounting rootfs read-only..." +mount -o remount,ro / || emergency_shell + +if [ -x /sbin/dmraid -o -x /bin/dmraid ]; then + msg "Activating dmraid devices..." + dmraid -i -ay +fi + +if [ -x /bin/btrfs ]; then + msg "Activating btrfs devices..." + btrfs device scan || emergency_shell +fi + +if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then + msg "Activating LVM devices..." + vgchange --sysinit -a ay || emergency_shell +fi + +if [ -e /etc/crypttab ]; then + msg "Activating encrypted devices..." + awk -f /etc/runit/crypt.awk /etc/crypttab + + if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then + msg "Activating LVM devices for dm-crypt..." + vgchange --sysinit -a ay || emergency_shell + fi +fi + +if [ -x /usr/bin/zpool -a -x /usr/bin/zfs ]; then + if [ -e /etc/zfs/zpool.cache ]; then + msg "Importing cached ZFS pools..." + zpool import -N -a -c /etc/zfs/zpool.cache + else + msg "Scanning for and importing ZFS pools..." + zpool import -N -a -o cachefile=none + fi + + msg "Mounting ZFS file systems..." + zfs mount -a -l + + msg "Sharing ZFS file systems..." + zfs share -a + + # NOTE(dh): ZFS has ZVOLs, block devices on top of storage pools. + # In theory, it would be possible to use these as devices in + # dmraid, btrfs, LVM and so on. In practice it's unlikely that + # anybody is doing that, so we aren't supporting it for now. +fi + +[ -f /fastboot ] && FASTBOOT=1 +[ -f /forcefsck ] && FORCEFSCK="-f" +for arg in $(cat /proc/cmdline); do + case $arg in + fastboot) FASTBOOT=1;; + forcefsck) FORCEFSCK="-f";; + esac +done + +if [ -z "$FASTBOOT" ]; then + msg "Checking filesystems:" + fsck -A -T -a -t noopts=_netdev $FORCEFSCK + if [ $? -gt 1 ]; then + emergency_shell + fi +fi + +msg "Mounting rootfs read-write..." +mount -o remount,rw / || emergency_shell + +msg "Mounting all non-network filesystems..." +mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev || emergency_shell diff --git a/contrib/rvnit/07Sswap b/contrib/rvnit/07Sswap new file mode 100755 index 0000000..4327a1e --- /dev/null +++ b/contrib/rvnit/07Sswap @@ -0,0 +1,9 @@ +#!/bin/sh +. /etc/runit/functions + +# vim: set ts=4 sw=4 et: + +[ -n "$VIRTUALIZATION" ] && return 0 + +msg "Initializing swap..." +swapon -a || emergency_shell 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 diff --git a/contrib/rvnit/09Ssysctl b/contrib/rvnit/09Ssysctl new file mode 100755 index 0000000..1763223 --- /dev/null +++ b/contrib/rvnit/09Ssysctl @@ -0,0 +1,24 @@ +#!/bin/sh + +. /etc/runit/functions + +# vim: set ts=4 sw=4 et: + +if [ -x /sbin/sysctl -o -x /bin/sysctl ]; then + msg "Loading sysctl(8) settings..." + mkdir -p /run/vsysctl.d + for i in /run/sysctl.d/*.conf \ + /etc/sysctl.d/*.conf \ + /usr/local/lib/sysctl.d/*.conf \ + /usr/lib/sysctl.d/*.conf; do + + if [ -e "$i" ] && [ ! -e "/run/vsysctl.d/${i##*/}" ]; then + ln -s "$i" "/run/vsysctl.d/${i##*/}" + fi + done + for i in /run/vsysctl.d/*.conf; do + sysctl -p "$i" + done + rm -rf -- /run/vsysctl.d + sysctl -p /etc/sysctl.conf +fi diff --git a/contrib/rvnit/20Scleanup b/contrib/rvnit/20Scleanup new file mode 100755 index 0000000..6310892 --- /dev/null +++ b/contrib/rvnit/20Scleanup @@ -0,0 +1,11 @@ +#!/bin/sh +# vim: set ts=4 sw=4 et: + +if [ ! -e /var/log/wtmp ]; then + install -m0664 -o root -g utmp /dev/null /var/log/wtmp +fi +if [ ! -e /var/log/btmp ]; then + install -m0600 -o root -g utmp /dev/null /var/log/btmp +fi +install -dm1777 /tmp/.X11-unix /tmp/.ICE-unix +rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot diff --git a/contrib/rvnit/30Dacpid b/contrib/rvnit/30Dacpid new file mode 100755 index 0000000..69a45d1 --- /dev/null +++ b/contrib/rvnit/30Dacpid @@ -0,0 +1,2 @@ +#!/bin/sh +exec acpid -f -l diff --git a/contrib/rvnit/30Dudevd b/contrib/rvnit/30Dudevd new file mode 100755 index 0000000..a3a396b --- /dev/null +++ b/contrib/rvnit/30Dudevd @@ -0,0 +1,3 @@ +#!/bin/sh +udevadm control --exit +exec udevd 2>&1 diff --git a/contrib/rvnit/40Ddhcpcd b/contrib/rvnit/40Ddhcpcd new file mode 100755 index 0000000..71fdfe3 --- /dev/null +++ b/contrib/rvnit/40Ddhcpcd @@ -0,0 +1,2 @@ +#!/bin/sh +exec dhcpcd -B -M 2>&1 diff --git a/contrib/rvnit/45Snetup b/contrib/rvnit/45Snetup new file mode 100755 index 0000000..02082f4 --- /dev/null +++ b/contrib/rvnit/45Snetup @@ -0,0 +1,14 @@ +#!/bin/sh + +exec 2>&1 + +count=10 +while ! ping -c1 8.8.8.8; do + sleep 1 + count=$((count-1)) + if [ $count -eq 0 ]; then + exit 1 + fi +done + +exit 0 diff --git a/contrib/rvnit/50Dopensshd b/contrib/rvnit/50Dopensshd new file mode 100755 index 0000000..2cfbce4 --- /dev/null +++ b/contrib/rvnit/50Dopensshd @@ -0,0 +1,3 @@ +#!/bin/sh +ssh-keygen -A >/dev/null 2>&1 +exec /usr/bin/sshd -D diff --git a/contrib/rvnit/90Dagetty-tty3 b/contrib/rvnit/90Dagetty-tty3 new file mode 100755 index 0000000..419ea49 --- /dev/null +++ b/contrib/rvnit/90Dagetty-tty3 @@ -0,0 +1,3 @@ +#!/bin/sh +tty=${0##*-} +exec agetty "${tty}" 38400 linux diff --git a/contrib/rvnit/90Dagetty-tty4 b/contrib/rvnit/90Dagetty-tty4 new file mode 100755 index 0000000..419ea49 --- /dev/null +++ b/contrib/rvnit/90Dagetty-tty4 @@ -0,0 +1,3 @@ +#!/bin/sh +tty=${0##*-} +exec agetty "${tty}" 38400 linux diff --git a/contrib/rvnit/90Dagetty-tty5 b/contrib/rvnit/90Dagetty-tty5 new file mode 100755 index 0000000..419ea49 --- /dev/null +++ b/contrib/rvnit/90Dagetty-tty5 @@ -0,0 +1,3 @@ +#!/bin/sh +tty=${0##*-} +exec agetty "${tty}" 38400 linux diff --git a/contrib/rvnit/90Dagetty-tty6 b/contrib/rvnit/90Dagetty-tty6 new file mode 100755 index 0000000..419ea49 --- /dev/null +++ b/contrib/rvnit/90Dagetty-tty6 @@ -0,0 +1,3 @@ +#!/bin/sh +tty=${0##*-} +exec agetty "${tty}" 38400 linux diff --git a/contrib/rvnit/99Dsulogin b/contrib/rvnit/99Dsulogin new file mode 100755 index 0000000..3c708e0 --- /dev/null +++ b/contrib/rvnit/99Dsulogin @@ -0,0 +1,3 @@ +#!/bin/sh +tty=/dev/tty2 +exec sulogin <$tty >$tty diff --git a/contrib/rvnit/sv/00Kpoweroff b/contrib/rvnit/sv/00Kpoweroff deleted file mode 100755 index 2fae082..0000000 --- a/contrib/rvnit/sv/00Kpoweroff +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -echo system halted. -sync - -sleep 10 - -if [ -n "$RVNIT_WANT_REBOOT" ]; then - reboot -f -else - halt -f -fi diff --git a/contrib/rvnit/sv/00Shello b/contrib/rvnit/sv/00Shello deleted file mode 100755 index a57760b..0000000 --- a/contrib/rvnit/sv/00Shello +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo Hello from rvnit diff --git a/contrib/rvnit/sv/01Spseudofs b/contrib/rvnit/sv/01Spseudofs deleted file mode 100755 index 94c9e85..0000000 --- a/contrib/rvnit/sv/01Spseudofs +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# vim: set ts=4 sw=4 et: - -. /etc/runit/functions - -msg "Mounting pseudo-filesystems..." -mountpoint -q /proc || mount -o nosuid,noexec,nodev -t proc proc /proc -mountpoint -q /sys || mount -o nosuid,noexec,nodev -t sysfs sys /sys -mountpoint -q /run || mount -o mode=0755,nosuid,nodev -t tmpfs run /run -mountpoint -q /dev || mount -o mode=0755,nosuid -t devtmpfs dev /dev -mkdir -p -m0755 /run/runit /run/lvm /run/user /run/lock /run/log /dev/pts /dev/shm -mountpoint -q /dev/pts || mount -o mode=0620,gid=5,nosuid,noexec -n -t devpts devpts /dev/pts -mountpoint -q /dev/shm || mount -o mode=1777,nosuid,nodev -n -t tmpfs shm /dev/shm -mountpoint -q /sys/kernel/security || mount -n -t securityfs securityfs /sys/kernel/security - -if [ -z "$VIRTUALIZATION" ]; then - _cgroupv1="" - _cgroupv2="" - - case "${CGROUP_MODE:-hybrid}" in - legacy) - _cgroupv1="/sys/fs/cgroup" - ;; - hybrid) - _cgroupv1="/sys/fs/cgroup" - _cgroupv2="${_cgroupv1}/unified" - ;; - unified) - _cgroupv2="/sys/fs/cgroup" - ;; - esac - - # cgroup v1 - if [ -n "$_cgroupv1" ]; then - mountpoint -q "$_cgroupv1" || mount -o mode=0755 -t tmpfs cgroup "$_cgroupv1" - while read -r _subsys_name _hierarchy _num_cgroups _enabled; do - [ "$_enabled" = "1" ] || continue - _controller="${_cgroupv1}/${_subsys_name}" - mkdir -p "$_controller" - mountpoint -q "$_controller" || mount -t cgroup -o "$_subsys_name" cgroup "$_controller" - done < /proc/cgroups - fi - - # cgroup v2 - if [ -n "$_cgroupv2" ]; then - mkdir -p "$_cgroupv2" - mountpoint -q "$_cgroupv2" || mount -t cgroup2 -o nsdelegate cgroup2 "$_cgroupv2" - fi -fi diff --git a/contrib/rvnit/sv/02Sstatic-devnodes b/contrib/rvnit/sv/02Sstatic-devnodes deleted file mode 100755 index ef747a4..0000000 --- a/contrib/rvnit/sv/02Sstatic-devnodes +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# Some kernel modules must be loaded before starting udev(7). -# Load them by looking at the output of `kmod static-nodes`. - -for f in $(kmod static-nodes 2>/dev/null|awk '/Module/ {print $2}'); do - modprobe -bq $f 2>/dev/null -done diff --git a/contrib/rvnit/sv/03Skmods b/contrib/rvnit/sv/03Skmods deleted file mode 100755 index f25fb10..0000000 --- a/contrib/rvnit/sv/03Skmods +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# vim: set ts=4 sw=4 et: - -. /etc/runit/functions - -[ -n "$VIRTUALIZATION" ] && return 0 -# Do not try to load modules if kernel does not support them. -[ ! -e /proc/modules ] && return 0 - -msg "Loading kernel modules..." -modules-load -v | tr '\n' ' ' | sed 's:insmod [^ ]*/::g; s:\.ko\(\.gz\)\? ::g' -echo diff --git a/contrib/rvnit/sv/04Sudev b/contrib/rvnit/sv/04Sudev deleted file mode 100755 index d1b0697..0000000 --- a/contrib/rvnit/sv/04Sudev +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -. /etc/runit/functions - -# vim: set ts=4 sw=4 et: - -[ -n "$VIRTUALIZATION" ] && return 0 - -if [ -x /usr/lib/systemd/systemd-udevd ]; then - _udevd=/usr/lib/systemd/systemd-udevd -elif [ -x /sbin/udevd -o -x /bin/udevd ]; then - _udevd=udevd -else - msg_warn "cannot find udevd!" -fi - -if [ -n "${_udevd}" ]; then - msg "Starting udev and waiting for devices to settle..." - ${_udevd} --daemon - udevadm trigger --action=add --type=subsystems - udevadm trigger --action=add --type=devices - udevadm settle -fi diff --git a/contrib/rvnit/sv/05Sconsole-setup b/contrib/rvnit/sv/05Sconsole-setup deleted file mode 100755 index 966121b..0000000 --- a/contrib/rvnit/sv/05Sconsole-setup +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -. /etc/runit/functions - -# vim: set ts=4 sw=4 et: - -[ -n "$VIRTUALIZATION" ] && return 0 - -TTYS=${TTYS:-12} -if [ -n "$FONT" ]; then - msg "Setting up TTYs font to '${FONT}'..." - - _index=0 - while [ ${_index} -le $TTYS ]; do - setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} \ - $FONT -C "/dev/tty${_index}" - _index=$((_index + 1)) - done -fi - -if [ -n "$KEYMAP" ]; then - msg "Setting up keymap to '${KEYMAP}'..." - loadkeys -q -u ${KEYMAP} -fi - -if [ -n "$HARDWARECLOCK" ]; then - msg "Setting up RTC to '${HARDWARECLOCK}'..." - TZ=$TIMEZONE hwclock --systz \ - ${HARDWARECLOCK:+--$(echo $HARDWARECLOCK |tr A-Z a-z) --noadjfile} || emergency_shell -fi diff --git a/contrib/rvnit/sv/06Sfilesystems b/contrib/rvnit/sv/06Sfilesystems deleted file mode 100755 index bc72eca..0000000 --- a/contrib/rvnit/sv/06Sfilesystems +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -. /etc/runit/functions - -# vim: set ts=4 sw=4 et: - -[ -n "$VIRTUALIZATION" ] && return 0 - -msg "Remounting rootfs read-only..." -mount -o remount,ro / || emergency_shell - -if [ -x /sbin/dmraid -o -x /bin/dmraid ]; then - msg "Activating dmraid devices..." - dmraid -i -ay -fi - -if [ -x /bin/btrfs ]; then - msg "Activating btrfs devices..." - btrfs device scan || emergency_shell -fi - -if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then - msg "Activating LVM devices..." - vgchange --sysinit -a ay || emergency_shell -fi - -if [ -e /etc/crypttab ]; then - msg "Activating encrypted devices..." - awk -f /etc/runit/crypt.awk /etc/crypttab - - if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then - msg "Activating LVM devices for dm-crypt..." - vgchange --sysinit -a ay || emergency_shell - fi -fi - -if [ -x /usr/bin/zpool -a -x /usr/bin/zfs ]; then - if [ -e /etc/zfs/zpool.cache ]; then - msg "Importing cached ZFS pools..." - zpool import -N -a -c /etc/zfs/zpool.cache - else - msg "Scanning for and importing ZFS pools..." - zpool import -N -a -o cachefile=none - fi - - msg "Mounting ZFS file systems..." - zfs mount -a -l - - msg "Sharing ZFS file systems..." - zfs share -a - - # NOTE(dh): ZFS has ZVOLs, block devices on top of storage pools. - # In theory, it would be possible to use these as devices in - # dmraid, btrfs, LVM and so on. In practice it's unlikely that - # anybody is doing that, so we aren't supporting it for now. -fi - -[ -f /fastboot ] && FASTBOOT=1 -[ -f /forcefsck ] && FORCEFSCK="-f" -for arg in $(cat /proc/cmdline); do - case $arg in - fastboot) FASTBOOT=1;; - forcefsck) FORCEFSCK="-f";; - esac -done - -if [ -z "$FASTBOOT" ]; then - msg "Checking filesystems:" - fsck -A -T -a -t noopts=_netdev $FORCEFSCK - if [ $? -gt 1 ]; then - emergency_shell - fi -fi - -msg "Mounting rootfs read-write..." -mount -o remount,rw / || emergency_shell - -msg "Mounting all non-network filesystems..." -mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev || emergency_shell diff --git a/contrib/rvnit/sv/07Sswap b/contrib/rvnit/sv/07Sswap deleted file mode 100755 index 4327a1e..0000000 --- a/contrib/rvnit/sv/07Sswap +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -. /etc/runit/functions - -# vim: set ts=4 sw=4 et: - -[ -n "$VIRTUALIZATION" ] && return 0 - -msg "Initializing swap..." -swapon -a || emergency_shell diff --git a/contrib/rvnit/sv/08Smisc b/contrib/rvnit/sv/08Smisc deleted file mode 100755 index ad11691..0000000 --- a/contrib/rvnit/sv/08Smisc +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 diff --git a/contrib/rvnit/sv/09Ssysctl b/contrib/rvnit/sv/09Ssysctl deleted file mode 100755 index 1763223..0000000 --- a/contrib/rvnit/sv/09Ssysctl +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -. /etc/runit/functions - -# vim: set ts=4 sw=4 et: - -if [ -x /sbin/sysctl -o -x /bin/sysctl ]; then - msg "Loading sysctl(8) settings..." - mkdir -p /run/vsysctl.d - for i in /run/sysctl.d/*.conf \ - /etc/sysctl.d/*.conf \ - /usr/local/lib/sysctl.d/*.conf \ - /usr/lib/sysctl.d/*.conf; do - - if [ -e "$i" ] && [ ! -e "/run/vsysctl.d/${i##*/}" ]; then - ln -s "$i" "/run/vsysctl.d/${i##*/}" - fi - done - for i in /run/vsysctl.d/*.conf; do - sysctl -p "$i" - done - rm -rf -- /run/vsysctl.d - sysctl -p /etc/sysctl.conf -fi diff --git a/contrib/rvnit/sv/20Scleanup b/contrib/rvnit/sv/20Scleanup deleted file mode 100755 index 6310892..0000000 --- a/contrib/rvnit/sv/20Scleanup +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# vim: set ts=4 sw=4 et: - -if [ ! -e /var/log/wtmp ]; then - install -m0664 -o root -g utmp /dev/null /var/log/wtmp -fi -if [ ! -e /var/log/btmp ]; then - install -m0600 -o root -g utmp /dev/null /var/log/btmp -fi -install -dm1777 /tmp/.X11-unix /tmp/.ICE-unix -rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot diff --git a/contrib/rvnit/sv/30Dacpid b/contrib/rvnit/sv/30Dacpid deleted file mode 100755 index 69a45d1..0000000 --- a/contrib/rvnit/sv/30Dacpid +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec acpid -f -l diff --git a/contrib/rvnit/sv/30Dudevd b/contrib/rvnit/sv/30Dudevd deleted file mode 100755 index a3a396b..0000000 --- a/contrib/rvnit/sv/30Dudevd +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -udevadm control --exit -exec udevd 2>&1 diff --git a/contrib/rvnit/sv/40Ddhcpcd b/contrib/rvnit/sv/40Ddhcpcd deleted file mode 100755 index 71fdfe3..0000000 --- a/contrib/rvnit/sv/40Ddhcpcd +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec dhcpcd -B -M 2>&1 diff --git a/contrib/rvnit/sv/45Snetup b/contrib/rvnit/sv/45Snetup deleted file mode 100755 index 02082f4..0000000 --- a/contrib/rvnit/sv/45Snetup +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -exec 2>&1 - -count=10 -while ! ping -c1 8.8.8.8; do - sleep 1 - count=$((count-1)) - if [ $count -eq 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/contrib/rvnit/sv/50Dopensshd b/contrib/rvnit/sv/50Dopensshd deleted file mode 100755 index 2cfbce4..0000000 --- a/contrib/rvnit/sv/50Dopensshd +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -ssh-keygen -A >/dev/null 2>&1 -exec /usr/bin/sshd -D diff --git a/contrib/rvnit/sv/90Dagetty-tty3 b/contrib/rvnit/sv/90Dagetty-tty3 deleted file mode 100755 index 419ea49..0000000 --- a/contrib/rvnit/sv/90Dagetty-tty3 +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -tty=${0##*-} -exec agetty "${tty}" 38400 linux diff --git a/contrib/rvnit/sv/90Dagetty-tty4 b/contrib/rvnit/sv/90Dagetty-tty4 deleted file mode 100755 index 419ea49..0000000 --- a/contrib/rvnit/sv/90Dagetty-tty4 +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -tty=${0##*-} -exec agetty "${tty}" 38400 linux diff --git a/contrib/rvnit/sv/90Dagetty-tty5 b/contrib/rvnit/sv/90Dagetty-tty5 deleted file mode 100755 index 419ea49..0000000 --- a/contrib/rvnit/sv/90Dagetty-tty5 +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -tty=${0##*-} -exec agetty "${tty}" 38400 linux diff --git a/contrib/rvnit/sv/90Dagetty-tty6 b/contrib/rvnit/sv/90Dagetty-tty6 deleted file mode 100755 index 419ea49..0000000 --- a/contrib/rvnit/sv/90Dagetty-tty6 +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -tty=${0##*-} -exec agetty "${tty}" 38400 linux diff --git a/contrib/rvnit/sv/99Dsulogin b/contrib/rvnit/sv/99Dsulogin deleted file mode 100755 index 3c708e0..0000000 --- a/contrib/rvnit/sv/99Dsulogin +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -tty=/dev/tty2 -exec sulogin <$tty >$tty -- cgit 1.4.1