diff options
276 files changed, 2402 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..40622ce --- /dev/null +++ b/README.md @@ -0,0 +1,167 @@ +# Musl-LFS-S6-Bootscripts +Bootscripts for Musl-LFS (MLFS) using S6 & S6-rc + +This is based on the works of [MLFS-S6-Bootscripts by dslm4515](https://github.com/dslm4515/MLFS-S6-Bootscripts) + +The aim of this project is to create the scripts and files to boot a MLFS/LFS system with S6 and S6-rc. This will replace the LFS bootscripts that LFS uses (to boot a LFS system with SysVinit). + +## Requirements + +The following can be found at Skarnet (https://skarnet.org/). + * skalibs 2.11.1.x (required by execline) + * execline 2.8.2.x (required by s6-rc) + * s6 2.1.0.x (required by s6-rc) + * s6-linux-utils + * s6-portable-utils (statically built) + * s6-rc 0.5.3.x (New service format) + * s6-linux-init (1.x.x.x) + * utmps + +## Directions + +Copy boot directories and scripts. Do not just copy entire git directory, as it will copy unneeded dot files: +``` +# Enter chroot for target system first, otherwise adjust paths accordingly +cp -ar s6 /etc/ +cp -av vconsole.conf /etc/ +install -v -m755 modules-load /usr/bin/ +install -v -m755 tmpfiles /bin/ +# Compile a basic database for boot +s6-rc-compile /etc/s6/db/basic /etc/s6/sv +ln -sv /etc/s6/db/basic /etc/s6/db/current +# Copy necessary scripts to boot, reboot, and poweroff system +install -v -m755 s6/base/bin/* /sbin/ +mv /etc/s6/base/scripts /etc/s6/scripts +# Re-initialize s6 init base +rm -rf /etc/s6/base +s6-linux-init-maker -1 -f /etc/s6/skel -p "/bin:/sbin:/usr/bin" \ + -D default -G "/sbin/agetty -L -8 tty1 115200" \ + -c /etc/s6/base -t 2 -L -u root -U utmp /etc/s6/base +rm -rf /etc/s6/base/scripts +cp -r /etc/s6/scripts /etc/s6/base/scripts + +# Copy scripts to bring NIC's up and down +install -v -m755 if* /sbin/ +mkdir -pv /lib/services +install -v -m755 net-services/* /lib/services/ +``` + +For logging services, create the log user as root: +``` +groupadd -g 983 s6log && +useradd -c "S6-Log User" -d / \ + -u 983 -g s6log -s /usr/bin/false s6log +``` +Make sure the directory for dmesg logging is owned by the log user +``` +mkdir -pv /var/log/dmesg +chown -v s6log:s6log /var/log/ +``` + +For utmps, create a utmp user: +``` +useradd -c "utmps user" -d /run/utmps \ + -u 984 -g utmp -s /bin/false utmp +``` + +Make sure the directory for wtmp is owned by utmp user: +``` +mkdir -pv /var/log/utmps +mv -v /var/log/wtmp /var/log/utmps/ +chown -vR utmp:utmp /var/log/utmps +ln -sv utmps/wtmp /var/log/wtmp +``` + +Bootscripts no longer require system boot with a initramfs image. But kernel parameters should boot with root filesystem as read-only for checking root filesystem at boot (i.e. linux root=/dev/sda2 ro) You may use scripts from BLFS or Musl-LFS to build one. Script requires cpio installed. +``` +# Copy the script to /sbin: +install -v -m755 mkinitrd/mkinitramfs /sbin/ +# Copy the configuration: +mkdir -p /usr/share/mkinitramfs +install -v -m644 mkinitrd/init.in /usr/share/mkinitramfs/ +# To use, use the kernel version: +mkinitramfs $(uname -r) + +``` + +## Layout + +Directories in s6: + * base - Base directory for s6-linux-init + * base/run-image - Directory copied to /run at beginning of boot + * base/scripts - Scripts to shutdown and start system via s6-linux-init + * base/env - Enviromental varibles to set at boot + * db - Compiled databases for boot + * db/current - Compiled database to use for boot + * skel - Default startup/shutdown scripts + * sv - Source definitions for databases and services + * scripts - Small scripts used by services compiled from sv + * doc/mock-boot-tree - Use command tree to see how the layout of sv + +## Scripts: + * rc.local - Additional shell commands to execute on bootup + * s6.conf - Global configuration of s6-rc services + +## mkinitrd: + * mkinitramfs - Script to make a basic initramfs + * init.in - Configuration for script. + +## Setting up Networking at Boot: +``` +# install net-services: +mkdir -v /lib/services +install -v -m644 net-services/* /lib/services/ +# install helper scripts to bring up and down interfaces: +install -v -m755 if* /sbin/ +``` +Each interface should have configuration files in /etc/sysconfig. For example: +``` +/etc/sysconfig/ifconfig.wlan0 # config for a wifi card +/etc/sysconfig/wpa_supplicant-wlan0.conf # config for wpa_supplicant for same wifi card +``` + +Examples are in net-configs + +## Usage + +To disable/enable services, modify the contents of `/etc/s6/sv/services/contents.d`. Then compile a new database to use for the next boot. + +For example, to enable dbus service: +``` +# Install dbus service scripts (dbus-srv, dbus-log) to /etc/s6/sv/ + +# Add dbus script to list of services to start at boot: +touch /etc/s6/sv/services/contents.d/dbus-srv + +# Compile a new database for boot +s6-rc-compile /etc/s6/db/${new_db} /etc/s6/sv + +# Link new database to boot +mv -v /etc/s6/db/current /etc/s6/db/previous +ln -sv /etc/s6/db/${new_db} /etc/s6/db/current +``` + +Services an be enabled or disabled after boot: +``` +# Enable a service that was not enabled at boot +sudo s6-rc -u change ${service_name} + +# Disable a service +sudo s6-rc -d change ${service_name} + +# To see the list of services to enable/disable: +ls /run/service/* + +``` + +## Changelog since 4.x.x + +<ul> +<li>Updated service format: Bundles now use contents.d & dependencies.d directories instead of contents & dependencies files</li> +<li>Improved service dependacies: Previous format had issues some services starting before required service(s) executed</li> +<li>/tmp directory now cleaned during boot and during shutdown </li> +<li>System clock now set from hardware clock </li> +<li>Most commands in service scripts use commands from s6-linux-utils or s6-portable-utils </li> +<li>Cleaned up boot messages that are logged in /run/uncaught-logs/current </li> + +</ul> diff --git a/docs/artix-boot-tree b/docs/artix-boot-tree new file mode 100644 index 0000000..f5f6b13 --- /dev/null +++ b/docs/artix-boot-tree @@ -0,0 +1,37 @@ +default +└── boot + ├── misc + │  ├── hostname + │  ├── hwclock + │  ├── kmod-static-nodes + │  ├── modules + │  ├── rc-local + │  └── tmpfiles-dev + ├── mount + │  ├── mount-cgroups + │  ├── mount-devfs + │  ├── mount-filesystems + │  ├── mount-net + │  ├── mount-procfs + │  ├── mount-sysfs + │  └── remount-root + ├── setup + │  ├── binfmt + │  ├── cleanup + │  ├── console-setup + │  ├── dmesg + │  ├── getty + │  ├── net-lo + │  ├── random-seed + │  ├── swap + │  ├── sysctl + │  ├── sysusers * uncomment contents if esysusers is installed * + │  └── tmpfiles-setup + └── udev + ├── udevadm + │  ├── udevadm-log + │  └── udevadm-srv + └── udevd + ├── udevd-log + └── udevd-srv + diff --git a/docs/create-s6-base b/docs/create-s6-base new file mode 100644 index 0000000..d786a75 --- /dev/null +++ b/docs/create-s6-base @@ -0,0 +1,24 @@ +#! /bin/bash + +## Create the base + +s6-linux-init-maker \ + -c /etc/s6/base \ + -u root \ + -G "/sbin/agetty -L -8 tty1 115200" \ + -L \ + -p "/bin:/sbin:/usr/bin" \ + -m 022 \ + -t 2 \ + -D default \ + -U utmp \ + /BUILD/etc/s6/base + +## Modify scripts in base + +# For rc.init: +### If your services are managed by s6-rc: +### (replace /run/service with your scandir) +#s6-rc-init -c /etc/s6/db/current /run/service + +# Check other scripts and only uncomment for s6 & s6-rc diff --git a/docs/log-display_template b/docs/log-display_template new file mode 100644 index 0000000..5a2855a --- /dev/null +++ b/docs/log-display_template @@ -0,0 +1,28 @@ +|--((( S6+S6-rc Bootscripts v 5.0.0 )))---| +[ Virtual-FS ] 1/6 : Mounting /proc +[ Virtual-FS ] 0/6 : Creating mount points +[ Read-Only Mode ] 3/9 : Setting hostname +[ Virtual-FS ] 2/6 : Mounting /sys +[ Virtual-FS ] 5/6 : Mounting securityfs +[ Virtual-FS ] 6/6 : Mounting EFI-vars-fs +[ Read-Only Mode ] 5/9 : Setting up Kernel Static Node(s) +[ Virtual-FS ] 3/6 : Mounting /dev/pts +[ Virtual-FS ] 4/6 : Mounting /dev/shm +[ Read-Only Mode ] 8/9 : Intializing udev daemon +[ Read-Only Mode ] 9/9 : Setting up devices & subsystems +[ Read-Only Mode ] 1/9 : Mounting cgroups +[ Services ] : Enabling tty3 +[ Services ] : Enabling tty2 +[ Read-Only Mode ] 0/9 : Setting kernel parameters +[ Read-Only Mode ] 7/9 : Turning on any swap/swap-files +[ Read-Only Mode ] 4/9 : Setting system clock from rtc0 +[ Read-Only Mode ] 6/9 : Loading any kernel modules +[ Read-Only Mode ] 2/9 : Setting up console +[ ReadWrite Mode ] 1/6 : Remounting root filesystem as rw +[ ReadWrite Mode ] 4/6 : Restoring random seed +[ ReadWrite Mode ] 2/6 : Logging kernel boot +[ ReadWrite Mode ] 0/6 : Cleaning /tmp +[ ReadWrite Mode ] 3/6 : Setting up network loopback device +[ ReadWrite Mode ] 5/6 : Cleaning tempfiles +[ ReadWrite Mode ] 6/6 : Setting up tmpfiles +[ Networking ] : Bringing up any network interfaces... diff --git a/docs/requirements b/docs/requirements new file mode 100644 index 0000000..90eddb4 --- /dev/null +++ b/docs/requirements @@ -0,0 +1,19 @@ +## Reguired file paths: + +/sbin/init ...................... required by kernel, executes s6-linux-init with arguments +/usr/bin/sysusers ............... if esysusers is installed +/usr/bin/module-load ............ Load kernel modules at boot +/etc/vconsole.conf .............. Set key map and console font +/sbin/mkinitramfs ............... create initramfs.img +/sbin/ifup ...................... Brings up network interfaces +/sbin/ifdown .................... Brings down network interfaces +/usr/share/mkinitramfs/init.in .. config for mkinitramfs +/bin/tmpfiles ................... for creating tempdirs +/etc/s6/scripts/clean_tmp.sh .... Required by cleantmp service +/etc/s6/scripts/mount-cgroups ... Required by the cgroups service +/etc/s6/scripts/console_set.sh .. Required by the console service + +## Required directories: + +/etc/sysconfig/ifconfig.* ....... To setup network interfaces during boot +/lib/services ................... Helper scripts for ifup/ifdown @@ -0,0 +1,100 @@ +#!/bin/bash +######################################################################## +# Begin /sbin/ifdown +# +# Description : Interface Down +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +# Notes : the IFCONFIG variable is passed to the scripts found +# in the /lib/services directory, to indicate what file the +# service should source to get interface specifications. +# +######################################################################## + +RELEASE="7.0" + +USAGE="Usage: $0 [ -hV ] [--help] [--version] interface" +VERSTR="LFS ifdown, version ${RELEASE}" + +while [ $# -gt 0 ]; do + case "$1" in + --help | -h) help="y"; break ;; + + --version | -V) echo "${VERSTR}"; exit 0 ;; + + -*) echo "ifup: ${1}: invalid option" >&2 + echo "${USAGE}" >& 2 + exit 2 ;; + + *) break ;; + esac +done + +if [ -n "$help" ]; then + echo "${VERSTR}" + echo "${USAGE}" + echo + cat << HERE_EOF +ifdown is used to bring down a network interface. The interface +parameter, e.g. eth0 or eth0:2, must match the trailing part of the +interface specifications file, e.g. /etc/sysconfig/ifconfig.eth0:2. + +HERE_EOF + exit 0 +fi + +file=/etc/sysconfig/ifconfig.${1} + +# Skip backup files +[ "${file}" = "${file%""~""}" ] || exit 0 + +#. /lib/lsb/init-functions + +if [ ! -r "${file}" ]; then + echo "${file} is missing or cannot be accessed." + exit 1 +fi + +. ${file} + +if [ "$IFACE" = "" ]; then + echo "${file} does not define an interface [IFACE]." + exit 1 +fi + +# We only need to first service to bring down the interface +S=`echo ${SERVICE} | cut -f1 -d" "` + +if ip link show ${IFACE} > /dev/null 2>&1; then + if [ -n "${S}" -a -x "/lib/services/${S}" ]; then + IFCONFIG=${file} /lib/services/${S} ${IFACE} down + else + MSG="Unable to process ${file}. Either " + MSG="${MSG}the SERVICE variable was not set " + MSG="${MSG}or the specified service cannot be executed." + echo "$MSG" + exit 1 + fi +else + echo "Interface ${1} doesn't exist." +fi + +# Leave the interface up if there are additional interfaces in the device +link_status=`ip link show ${IFACE} 2>/dev/null` + +if [ -n "${link_status}" ]; then + if [ "$(echo "${link_status}" | grep UP)" != "" ]; then + if [ "$(ip addr show ${IFACE} | grep 'inet ')" == "" ]; then + echo "Bringing down the ${IFACE} interface..." + ip link set ${IFACE} down + #evaluate_retval + fi + fi +fi + +# End /sbin/ifdown @@ -0,0 +1,136 @@ +#!/bin/sh +######################################################################## +# Begin /sbin/ifup +# +# Description : Interface Up +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.2 +# +# Notes : The IFCONFIG variable is passed to the SERVICE script +# in the /lib/services directory, to indicate what file the +# service should source to get interface specifications. +# +######################################################################## + +up() +{ + if ip link show $1 > /dev/null 2>&1; then + link_status=`ip link show $1` + + if [ -n "${link_status}" ]; then + if ! echo "${link_status}" | grep -q UP; then + ip link set $1 up + fi + fi + + else + echo "Interface ${IFACE} doesn't exist." + exit 1 + fi +} + +RELEASE="7.2" + +USAGE="Usage: $0 [ -hV ] [--help] [--version] interface" +VERSTR="LFS ifup, version ${RELEASE}" + +while [ $# -gt 0 ]; do + case "$1" in + --help | -h) help="y"; break ;; + + --version | -V) echo "${VERSTR}"; exit 0 ;; + + -*) echo "ifup: ${1}: invalid option" >&2 + echo "${USAGE}" >& 2 + exit 2 ;; + + *) break ;; + esac +done + +if [ -n "$help" ]; then + echo "${VERSTR}" + echo "${USAGE}" + echo + cat << HERE_EOF +ifup is used to bring up a network interface. The interface +parameter, e.g. eth0 or eth0:2, must match the trailing part of the +interface specifications file, e.g. /etc/sysconfig/ifconfig.eth0:2. + +HERE_EOF + exit 0 +fi + +file=/etc/sysconfig/ifconfig.${1} + +# Skip backup files +[ "${file}" = "${file%""~""}" ] || exit 0 + +#. /lib/lsb/init-functions + +echo "Bringing up the ${1} interface... " + +if [ ! -r "${file}" ]; then + echo "${file} is missing or cannot be accessed." + exit 1 +fi + +. $file + +if [ "$IFACE" = "" ]; then + echo "${file} does not define an interface [IFACE]." + exit 1 +fi + +# Do not process this service if started by boot, and ONBOOT +# is not set to yes +if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then + echo "skipped" + exit 0 +fi + +for S in ${SERVICE}; do + if [ ! -x "/lib/services/${S}" ]; then + echo "Unable to process ${file}. Either " + echo "${MSG}the SERVICE '${S} was not present " + echo "${MSG}or cannot be executed." + echo "$MSG" + exit 1 + fi +done + +# Create/configure the interface +for S in ${SERVICE}; do + IFCONFIG=${file} /lib/services/${S} ${IFACE} up +done + +# Bring up the interface and any components +for I in $IFACE $INTERFACE_COMPONENTS; do up $I; done + +# Set MTU if requested. Check if MTU has a "good" value. +if test -n "${MTU}"; then + if [[ ${MTU} =~ ^[0-9]+$ ]] && [[ $MTU -ge 68 ]] ; then + for I in $IFACE $INTERFACE_COMPONENTS; do + ip link set dev $I mtu $MTU; + done + else + echo "Invalid MTU $MTU" + fi +fi + +# Set the route default gateway if requested +if [ -n "${GATEWAY}" ]; then + if ip route | grep -q default; then + echo "Gateway already setup; skipping." + else + echo "Setting up default gateway..." + ip route add default via ${GATEWAY} dev ${IFACE} + #evaluate_retval + fi +fi + +# End /sbin/ifup diff --git a/init-s6-base.sh b/init-s6-base.sh new file mode 100755 index 0000000..080045c --- /dev/null +++ b/init-s6-base.sh @@ -0,0 +1,9 @@ +#! /bin/bash + +echo "Re-initializing init base..." +rm -rf /etc/s6/base && +s6-linux-init-maker -1 -f /etc/s6/skel -p "/bin:/sbin:/usr/bin" \ + -D default -G "/sbin/agetty -L -8 tty1 115200" \ + -c /etc/s6/base -t 2 -L -u root -U utmp /etc/s6/base +rm -rf /etc/s6/base/scripts +cp -r /etc/s6/scripts /etc/s6/base/scripts diff --git a/mkinitrd/init.in b/mkinitrd/init.in new file mode 100644 index 0000000..2466e0d --- /dev/null +++ b/mkinitrd/init.in @@ -0,0 +1,108 @@ +#!/bin/sh + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +export PATH + +problem() +{ + printf "Encountered a problem!\n\nDropping you to a shell.\n\n" + sh +} + +no_device() +{ + printf "The device %s, which is supposed to contain the\n" $1 + printf "root file system, does not exist.\n" + printf "Please fix this problem and exit this shell.\n\n" +} + +no_mount() +{ + printf "Could not mount device %s\n" $1 + printf "Sleeping forever. Please reboot and fix the kernel command line.\n\n" + printf "Maybe the device is formatted with an unsupported file system?\n\n" + printf "Or maybe filesystem type autodetection went wrong, in which case\n" + printf "you should add the rootfstype=... parameter to the kernel command line.\n\n" + printf "Available partitions:\n" +} + +do_mount_root() +{ + mkdir /.root + [ -n "$rootflags" ] && rootflags="$rootflags," + rootflags="$rootflags$ro" + + case "$root" in + /dev/* ) device=$root ;; + UUID=* ) eval $root; device="/dev/disk/by-uuid/$UUID" ;; + LABEL=*) eval $root; device="/dev/disk/by-label/$LABEL" ;; + "" ) echo "No root device specified." ; problem ;; + esac + + while [ ! -b "$device" ] ; do + no_device $device + problem + done + + if ! mount -n -t "$rootfstype" -o "$rootflags" "$device" /.root ; then + no_mount $device + cat /proc/partitions + while true ; do sleep 10000 ; done + else + echo "Successfully mounted device $root" + fi +} + +init=/sbin/init +root= +rootdelay= +rootfstype=auto +ro="ro" +rootflags= +device= + +mount -n -t devtmpfs devtmpfs /dev +mount -n -t proc proc /proc +mount -n -t sysfs sysfs /sys +mount -n -t tmpfs tmpfs /run + +read -r cmdline < /proc/cmdline + +for param in $cmdline ; do + case $param in + init=* ) init=${param#init=} ;; + root=* ) root=${param#root=} ;; + rootdelay=* ) rootdelay=${param#rootdelay=} ;; + rootfstype=*) rootfstype=${param#rootfstype=} ;; + rootflags=* ) rootflags=${param#rootflags=} ;; + ro ) ro="ro" ;; + rw ) ro="rw" ;; + esac +done + +# udevd location depends on version +if [ -x /sbin/udevd ]; then + UDEVD=/sbin/udevd +elif [ -x /lib/udev/udevd ]; then + UDEVD=/lib/udev/udevd +elif [ -x /lib/systemd/systemd-udevd ]; then + UDEVD=/lib/systemd/systemd-udevd +else + echo "Cannot find udevd nor systemd-udevd" + problem +fi + +${UDEVD} --daemon --resolve-names=never +udevadm trigger +udevadm settle + +if [ -f /etc/mdadm.conf ] ; then mdadm -As ; fi +if [ -x /sbin/vgchange ] ; then /sbin/vgchange -a y > /dev/null ; fi +if [ -n "$rootdelay" ] ; then sleep "$rootdelay" ; fi + +do_mount_root + +killall -w ${UDEVD##*/} + +exec switch_root /.root "$init" "$@" + diff --git a/mkinitrd/mkinitramfs b/mkinitrd/mkinitramfs new file mode 100755 index 0000000..2f8adda --- /dev/null +++ b/mkinitrd/mkinitramfs @@ -0,0 +1,190 @@ +#!/bin/bash +# This file based in part on the mkinitramfs script for the LFS LiveCD +# written by Alexander E. Patrakov and Jeremy Huntwork. + +copy() +{ + local file + + if [ "$2" == "lib" ]; then + file=$(PATH=/lib:/usr/lib type -p $1) + else + file=$(type -p $1) + fi + + if [ -n $file ] ; then + cp $file $WDIR/$2 + else + echo "Missing required file: $1 for directory $2" + rm -rf $WDIR + exit 1 + fi +} + +if [ -z $1 ] ; then + INITRAMFS_FILE=initrd.img-no-kmods +else + KERNEL_VERSION=$1 + INITRAMFS_FILE=initrd.img-$KERNEL_VERSION +fi + +if [ -n "$KERNEL_VERSION" ] && [ ! -d "/lib/modules/$1" ] ; then + echo "No modules directory named $1" + exit 1 +fi + +printf "Creating $INITRAMFS_FILE... " + +binfiles="sh cat cp dd killall ls mkdir mknod mount " +binfiles="$binfiles umount sed sleep ln rm uname" +binfiles="$binfiles readlink basename" + +# Systemd installs udevadm in /bin. Other udev implementations have it in /sbin +if [ -x /bin/udevadm ] ; then binfiles="$binfiles udevadm"; fi + +sbinfiles="modprobe blkid switch_root" + +#Optional files and locations +for f in mdadm mdmon udevd udevadm; do + if [ -x /sbin/$f ] ; then sbinfiles="$sbinfiles $f"; fi +done + +unsorted=$(mktemp /tmp/unsorted.XXXXXXXXXX) + +DATADIR=/usr/share/mkinitramfs +INITIN=init.in + +# Create a temporary working directory +WDIR=$(mktemp -d /tmp/initrd-work.XXXXXXXXXX) + +# Create base directory structure +mkdir -p $WDIR/{bin,dev,lib/firmware,run,sbin,sys,proc,usr} +mkdir -p $WDIR/etc/{modprobe.d,udev/rules.d} +touch $WDIR/etc/modprobe.d/modprobe.conf +ln -s lib $WDIR/lib64 +ln -s ../bin $WDIR/usr/bin + +# Create necessary device nodes +mknod -m 640 $WDIR/dev/console c 5 1 +mknod -m 664 $WDIR/dev/null c 1 3 + +# Install the udev configuration files +if [ -f /etc/udev/udev.conf ]; then + cp /etc/udev/udev.conf $WDIR/etc/udev/udev.conf +fi + +for file in $(find /etc/udev/rules.d/ -type f) ; do + cp $file $WDIR/etc/udev/rules.d +done + +# Install any firmware present +cp -a /lib/firmware $WDIR/lib + +# Copy the RAID configuration file if present +if [ -f /etc/mdadm.conf ] ; then + cp /etc/mdadm.conf $WDIR/etc +fi + +# Install the init file +install -m0755 $DATADIR/$INITIN $WDIR/init + +if [ -n "$KERNEL_VERSION" ] ; then + if [ -x /bin/kmod ] ; then + binfiles="$binfiles kmod" + else + binfiles="$binfiles lsmod" + sbinfiles="$sbinfiles insmod" + fi +fi + +# Install basic binaries +for f in $binfiles ; do + if [ -e /bin/$f ]; then d="/bin"; else d="/usr/bin"; fi + ldd $d/$f | sed "s/\t//" | cut -d " " -f1 >> $unsorted + copy $d/$f bin +done + +# Add lvm if present +if [ -x /sbin/lvm ] ; then sbinfiles="$sbinfiles lvm dmsetup"; fi + +for f in $sbinfiles ; do + ldd /sbin/$f | sed "s/\t//" | cut -d " " -f1 >> $unsorted + copy $f sbin +done + +# Add udevd libraries if not in /sbin +if [ -x /lib/udev/udevd ] ; then + ldd /lib/udev/udevd | sed "s/\t//" | cut -d " " -f1 >> $unsorted +elif [ -x /lib/systemd/systemd-udevd ] ; then + ldd /lib/systemd/systemd-udevd | sed "s/\t//" | cut -d " " -f1 >> $unsorted +fi + +# Add module symlinks if appropriate +if [ -n "$KERNEL_VERSION" ] && [ -x /bin/kmod ] ; then + ln -s kmod $WDIR/bin/lsmod + ln -s kmod $WDIR/bin/insmod +fi + +# Add lvm symlinks if appropriate +# Also copy the lvm.conf file +if [ -x /sbin/lvm ] ; then + ln -s lvm $WDIR/sbin/lvchange + ln -s lvm $WDIR/sbin/lvrename + ln -s lvm $WDIR/sbin/lvextend + ln -s lvm $WDIR/sbin/lvcreate + ln -s lvm $WDIR/sbin/lvdisplay + ln -s lvm $WDIR/sbin/lvscan + + ln -s lvm $WDIR/sbin/pvchange + ln -s lvm $WDIR/sbin/pvck + ln -s lvm $WDIR/sbin/pvcreate + ln -s lvm $WDIR/sbin/pvdisplay + ln -s lvm $WDIR/sbin/pvscan + + ln -s lvm $WDIR/sbin/vgchange + ln -s lvm $WDIR/sbin/vgcreate + ln -s lvm $WDIR/sbin/vgscan + ln -s lvm $WDIR/sbin/vgrename + ln -s lvm $WDIR/sbin/vgck + # Conf file(s) + cp -a /etc/lvm $WDIR/etc +fi + +# Install libraries +sort $unsorted | uniq | while read library ; do + if [ "$library" == "linux-vdso.so.1" ] || + [ "$library" == "linux-gate.so.1" ]; then + continue + fi + + copy $library lib +done + +if [ -d /lib/udev ]; then + cp -a /lib/udev $WDIR/lib +fi +if [ -d /lib/systemd ]; then + cp -a /lib/systemd $WDIR/lib +fi + +# Install the kernel modules if requested +if [ -n "$KERNEL_VERSION" ]; then + find \ + /lib/modules/$KERNEL_VERSION/kernel/{crypto,fs,lib} \ + /lib/modules/$KERNEL_VERSION/kernel/drivers/{block,ata,md,firewire} \ + /lib/modules/$KERNEL_VERSION/kernel/drivers/{scsi,message,pcmcia,virtio} \ + /lib/modules/$KERNEL_VERSION/kernel/drivers/usb/{host,storage} \ + -type f 2> /dev/null | cpio --make-directories -p --quiet $WDIR + + cp /lib/modules/$KERNEL_VERSION/modules.{builtin,order} \ + $WDIR/lib/modules/$KERNEL_VERSION + + depmod -b $WDIR $KERNEL_VERSION +fi + +( cd $WDIR ; find . | cpio -o -H newc --quiet | gzip -9 ) > $INITRAMFS_FILE + +# Remove the temporary directory and file +rm -rf $WDIR $unsorted +printf "done.\n" + diff --git a/modules-load b/modules-load new file mode 100755 index 0000000..35e73b8 --- /dev/null +++ b/modules-load @@ -0,0 +1,19 @@ +#!/bin/sh +# modules-load [-n] [-v] - modules-load.d(5) compatible kernel module loader + +export PATH=/bin:/sbin + +{ +# Parameters passed as modules-load= or rd.modules-load= in kernel command line. +sed -nr 's/,/\n/;s/(.* |^)(rd\.)?modules-load=([^ ]*).*/\3/p' /proc/cmdline + +# Find files /{etc,run,usr/lib}/modules-load.d/*.conf in that order. +find -L /etc/modules-load.d /run/modules-load.d /usr/lib/modules-load.d \ + -maxdepth 1 -name '*.conf' -printf '%p %P\n' 2>/dev/null | +# Load each basename only once. + sort -k2 -s | uniq -f1 | cut -d' ' -f1 | +# Read the files, output all non-empty, non-comment lines. + tr '\012' '\0' | xargs -0 -r grep -h -v -e '^[#;]' -e '^$' +} | +# Call modprobe on the list of modules +tr '\012' '\0' | xargs -0 -r modprobe -ab "$@" diff --git a/net-configs/ifconfig.eth0 b/net-configs/ifconfig.eth0 new file mode 100644 index 0000000..61e12e6 --- /dev/null +++ b/net-configs/ifconfig.eth0 @@ -0,0 +1,6 @@ +ONBOOT="no" +IFACE="eth0" +SERVICE="dhcpcd " + +DHCP_START="-b -q" +DHCP_STOP="-k" diff --git a/net-configs/ifconfig.wlan0 b/net-configs/ifconfig.wlan0 new file mode 100644 index 0000000..ce45099 --- /dev/null +++ b/net-configs/ifconfig.wlan0 @@ -0,0 +1,9 @@ +ONBOOT="yes" +IFACE="wlan0" +SERVICE="wpa" + +WPA_ARGS="" + +WPA_SERVICE="dhcpcd" +DHCP_START="-b -q" +DHCP_STOP="-k" diff --git a/net-configs/wpa_supplicant-wlan0.conf b/net-configs/wpa_supplicant-wlan0.conf new file mode 100644 index 0000000..acad28b --- /dev/null +++ b/net-configs/wpa_supplicant-wlan0.conf @@ -0,0 +1,13 @@ +ctrl_interface=/run/wpa_supplicant +ctrl_interface_group=wifi +update_config=1 + +network={ + ssid="WIFI-HOTSPOT_NAME" + psk="PASSWORD" + proto=RSN + key_mgmt=WPA-PSK + pairwise=CCMP + auth_alg=OPEN +} + diff --git a/net-services/dhcpcd b/net-services/dhcpcd new file mode 100755 index 0000000..050413c --- /dev/null +++ b/net-services/dhcpcd @@ -0,0 +1,70 @@ +#!/bin/bash +# Begin services/dhcpcd + +# Origianlly dased upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up} +# Rewritten by Nathan Coulson <nathan@linuxfromscratch.org> +# Adapted for dhcpcd by DJ Lucas <dj@linuxfromscratch.org> +# Update for LFS 7.0 by Bruce Dubbs <bdubbs@linuxfromscratch,org> + +# Call with: IFCONFIG=<filename> /lib/services/dhcpcd <IFACE> <up | down> + +#$LastChangedBy: bdubbs $ +#$Date: 2012-04-09 19:48:51 +0000 (Mon, 09 Apr 2012) $ + +#. /lib/lsb/init-functions +. $IFCONFIG + +pidfile="/var/run/dhcpcd-$1.pid" + +case "$2" in + up) + # Cosmetic output not needed for multiple services + #if ! $(echo ${SERVICE} | grep -q " "); then + # log_info_msg2 "\n" # Terminate the previous message + #fi + + echo "Starting dhcpcd on the $1 interface..." + + # Test to see if there is a stale pid file + if [ -f "$pidfile" ]; then + ps `cat "$pidfile"` | grep dhcpcd > /dev/null + + if [ $? != 0 ]; then + rm -f /var/run/dhcpcd-$1.pid > /dev/null + + else + echo "dhcpcd is already running!" + exit 2 + fi + fi + + /sbin/dhcpcd $1 $DHCP_START + #evaluate_retval + ;; + + down) + echo "Stopping dhcpcd on the $1 interface..." + + if [ -z "$DHCP_STOP" ]; then + kill -9 $(cat ${pidfile}) + rm -f ${pidfile} + + else + /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null + + if [ "$?" -eq 1 ]; then + echo "dhcpcd not running!" + exit 2 + fi + fi + + #evaluate_retval + ;; + + *) + echo "Usage: $0 [interface] {up|down}" + exit 1 + ;; +esac + +# End services/dhcpcd diff --git a/net-services/ipv4-static b/net-services/ipv4-static new file mode 100755 index 0000000..51cfa20 --- /dev/null +++ b/net-services/ipv4-static @@ -0,0 +1,83 @@ +#!/bin/sh +######################################################################## +# Begin /lib/services/ipv4-static +# +# Description : IPV4 Static Boot Script +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +#. /lib/lsb/init-functions +. ${IFCONFIG} + +if [ -z "${IP}" ]; then + echo "IP variable missing from ${IFCONFIG}, cannot continue." + exit 1 +fi + +if [ -z "${PREFIX}" -a -z "${PEER}" ]; then + echo "PREFIX variable missing from ${IFCONFIG}, assuming 24." + PREFIX=24 + args="${args} ${IP}/${PREFIX}" + +elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then + echo "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." + exit 1 + +elif [ -n "${PREFIX}" ]; then + args="${args} ${IP}/${PREFIX}" + +elif [ -n "${PEER}" ]; then + args="${args} ${IP} peer ${PEER}" +fi + +if [ -n "${BROADCAST}" ]; then + args="${args} broadcast ${BROADCAST}" +fi + +case "${2}" in + up) + if [ "$(ip addr show ${1} 2>/dev/null | grep ${IP}/)" = "" ]; then + + # Cosmetic output not needed for multiple services + #if ! $(echo ${SERVICE} | grep -q " "); then + # echo "" # Terminate the previous message + #fi + + echo "Adding IPv4 address ${IP} to the ${1} interface..." + ip addr add ${args} dev ${1} + #evaluate_retval + else + echo "Cannot add IPv4 address ${IP} to ${1}. Already present." + fi + ;; + + down) + if [ "$(ip addr show ${1} 2>/dev/null | grep ${IP}/)" != "" ]; then + echo "Removing IPv4 address ${IP} from the ${1} interface..." + ip addr del ${args} dev ${1} + #evaluate_retval + fi + + if [ -n "${GATEWAY}" ]; then + # Only remove the gateway if there are no remaining ipv4 addresses + if [ "$(ip addr show ${1} 2>/dev/null | grep 'inet ')" != "" ]; then + echo "Removing default gateway..." + ip route del default + #evaluate_retval + fi + fi + ;; + + *) + echo "Usage: ${0} [interface] {up|down}" + exit 1 + ;; +esac + +# End /lib/services/ipv4-static diff --git a/net-services/wpa b/net-services/wpa new file mode 100755 index 0000000..bf176e9 --- /dev/null +++ b/net-services/wpa @@ -0,0 +1,89 @@ +#!/bin/bash +# Begin services/wpa + +# Origianlly based upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up} +# Written by Armin K. <krejzi at email dot com> + +# Call with: IFCONFIG=<filename> /lib/services/wpa <IFACE> <up | down> + +#$LastChangedBy: krejzi $ +#$Date: 2013-03-24 15:39:14 +0000 (Sun, 24 Mar 2013) $ + +#. /lib/lsb/init-functions +. $IFCONFIG + +CFGFILE=/etc/sysconfig/wpa_supplicant-${IFCONFIG##*.}.conf +PIDFILE=/run/wpa_supplicant/$1.pid +CONTROL_IFACE=/run/wpa_supplicant/$1 + +case "$2" in + up) + + if [ -e ${PIDFILE} ]; then + ps $(cat ${PIDFILE}) | grep wpa_supplicant >/dev/null + if [ "$?" = "0" ]; then + echo "wpa_supplicant already running on $1." + exit 0 + else + rm ${PIDFILE} + fi + fi + + if [ ! -e ${CFGFILE} ]; then + echo "wpa_supplicant configuration file ${CFGFILE} not present." + echo "wpa_supplicant cannot be started." + exit 1 + fi + + echo "Starting wpa_supplicant on the $1 interface..." + + mkdir -p /run/wpa_supplicant + + /sbin/wpa_supplicant -q -B -Dnl80211,wext -P${PIDFILE} -C/run/wpa_supplicant -c${CFGFILE} -i$1 ${WPA_ARGS} + + if [ "$?" != "0" ]; then + echo "wpa_supplicant failed to start." + exit 1 + fi + + echo "wpa_supplicant successfully started." + + if [ -n "${WPA_SERVICE}" ]; then + if [ ! -e /lib/services/${WPA_SERVICE} -a ! -x /lib/services/${WPA_SERVICE} ]; then + echo "Cannot start ${WPA_SERVICE} on $1" + #log_failure_msg2 + exit 1 + fi + + IFCONFIG=${IFCONFIG} /lib/services/${WPA_SERVICE} $1 up + fi + ;; + + down) + if [ -n "${WPA_SERVICE}" ]; then + if [ ! -e /lib/services/${WPA_SERVICE} -a ! -x /lib/services/${WPA_SERVICE} ]; then + echo "Cannot stop ${WPA_SERVICE} on $1" + else + IFCONFIG=${IFCONFIG} /lib/services/${WPA_SERVICE} $1 down + fi + fi + + echo "Stopping wpa_supplicant on the $1 interface..." + + if [ -e ${PIDFILE} ]; then + kill -9 $(cat ${PIDFILE}) + rm -f ${PIDFILE} ${CONTROL_IFACE} + #evaluate_retval + else + echo "wpa_supplicant already stopped on $1" + exit 0 + fi + ;; + + *) + echo "Usage: $0 [interface] {up|down}" + exit 1 + ;; +esac + +# End services/wpa diff --git a/s6/base/bin/halt b/s6/base/bin/halt new file mode 100755 index 0000000..a2c7938 --- /dev/null +++ b/s6/base/bin/halt @@ -0,0 +1,3 @@ +#!/bin/execlineb -S0 + +s6-linux-init-hpr -h $@ diff --git a/s6/base/bin/init b/s6/base/bin/init new file mode 100755 index 0000000..278e493 --- /dev/null +++ b/s6/base/bin/init @@ -0,0 +1,3 @@ +#!/bin/execlineb -S0 + +s6-linux-init -c "/etc/s6/base" -m 0022 -p "/bin:/sbin:/usr/bin" -D "default" -- "$@" diff --git a/s6/base/bin/poweroff b/s6/base/bin/poweroff new file mode 100755 index 0000000..8177a96 --- /dev/null +++ b/s6/base/bin/poweroff @@ -0,0 +1,3 @@ +#!/bin/execlineb -S0 + +s6-linux-init-hpr -p $@ diff --git a/s6/base/bin/reboot b/s6/base/bin/reboot new file mode 100755 index 0000000..8e82d11 --- /dev/null +++ b/s6/base/bin/reboot @@ -0,0 +1,3 @@ +#!/bin/execlineb -S0 + +s6-linux-init-hpr -r $@ diff --git a/s6/base/bin/shutdown b/s6/base/bin/shutdown new file mode 100755 index 0000000..6c1b0c3 --- /dev/null +++ b/s6/base/bin/shutdown @@ -0,0 +1,3 @@ +#!/bin/execlineb -S0 + +s6-linux-init-shutdown $@ diff --git a/s6/base/bin/telinit b/s6/base/bin/telinit new file mode 100755 index 0000000..823def0 --- /dev/null +++ b/s6/base/bin/telinit @@ -0,0 +1,3 @@ +#!/bin/execlineb -S0 + +s6-linux-init-telinit $@ diff --git a/s6/base/run-image/service/.s6-svscan/SIGHUP b/s6/base/run-image/service/.s6-svscan/SIGHUP new file mode 100755 index 0000000..130ab12 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/SIGHUP @@ -0,0 +1,2 @@ +#!/bin/execlineb -P + diff --git a/s6/base/run-image/service/.s6-svscan/SIGINT b/s6/base/run-image/service/.s6-svscan/SIGINT new file mode 100755 index 0000000..9a7eeaf --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/SIGINT @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +s6-linux-init-shutdown -a -r -- now diff --git a/s6/base/run-image/service/.s6-svscan/SIGPWR b/s6/base/run-image/service/.s6-svscan/SIGPWR new file mode 100755 index 0000000..bc55899 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/SIGPWR @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +s6-linux-init-shutdown -a -p -- now diff --git a/s6/base/run-image/service/.s6-svscan/SIGQUIT b/s6/base/run-image/service/.s6-svscan/SIGQUIT new file mode 100755 index 0000000..130ab12 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/SIGQUIT @@ -0,0 +1,2 @@ +#!/bin/execlineb -P + diff --git a/s6/base/run-image/service/.s6-svscan/SIGTERM b/s6/base/run-image/service/.s6-svscan/SIGTERM new file mode 100755 index 0000000..130ab12 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/SIGTERM @@ -0,0 +1,2 @@ +#!/bin/execlineb -P + diff --git a/s6/base/run-image/service/.s6-svscan/SIGUSR1 b/s6/base/run-image/service/.s6-svscan/SIGUSR1 new file mode 100755 index 0000000..bc55899 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/SIGUSR1 @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +s6-linux-init-shutdown -a -p -- now diff --git a/s6/base/run-image/service/.s6-svscan/SIGUSR2 b/s6/base/run-image/service/.s6-svscan/SIGUSR2 new file mode 100755 index 0000000..5bbca00 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/SIGUSR2 @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +s6-linux-init-shutdown -a -h -- now diff --git a/s6/base/run-image/service/.s6-svscan/SIGWINCH b/s6/base/run-image/service/.s6-svscan/SIGWINCH new file mode 100755 index 0000000..130ab12 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/SIGWINCH @@ -0,0 +1,2 @@ +#!/bin/execlineb -P + diff --git a/s6/base/run-image/service/.s6-svscan/crash b/s6/base/run-image/service/.s6-svscan/crash new file mode 100755 index 0000000..e5a9440 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/crash @@ -0,0 +1,6 @@ +#!/bin/execlineb -P + +redirfd -w 2 /dev/console +fdmove -c 1 2 +foreground { s6-linux-init-echo -- "s6-svscan crashed. Rebooting." } +s6-linux-init-hpr -fr diff --git a/s6/base/run-image/service/.s6-svscan/finish b/s6/base/run-image/service/.s6-svscan/finish new file mode 100755 index 0000000..ad17596 --- /dev/null +++ b/s6/base/run-image/service/.s6-svscan/finish @@ -0,0 +1,6 @@ +#!/bin/execlineb -P + +redirfd -w 2 /dev/console +fdmove -c 1 2 +foreground { s6-linux-init-echo -- "s6-svscan exited. Rebooting." } +s6-linux-init-hpr -fr diff --git a/s6/base/run-image/service/s6-linux-init-early-getty/run b/s6/base/run-image/service/s6-linux-init-early-getty/run new file mode 100755 index 0000000..646423b --- /dev/null +++ b/s6/base/run-image/service/s6-linux-init-early-getty/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +/sbin/agetty -L -8 tty1 115200 diff --git a/s6/base/run-image/service/s6-linux-init-logouthookd/notification-fd b/s6/base/run-image/service/s6-linux-init-logouthookd/notification-fd new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/s6/base/run-image/service/s6-linux-init-logouthookd/notification-fd @@ -0,0 +1 @@ +1 diff --git a/s6/base/run-image/service/s6-linux-init-logouthookd/run b/s6/base/run-image/service/s6-linux-init-logouthookd/run new file mode 100755 index 0000000..9698c56 --- /dev/null +++ b/s6/base/run-image/service/s6-linux-init-logouthookd/run @@ -0,0 +1,4 @@ +#!/bin/execlineb -P + +s6-ipcserver -1 -a 0700 -c 1000 -C 1000 -- s +s6-linux-init-logouthookd diff --git a/s6/base/run-image/service/s6-linux-init-runleveld/notification-fd b/s6/base/run-image/service/s6-linux-init-runleveld/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/s6/base/run-image/service/s6-linux-init-runleveld/notification-fd @@ -0,0 +1 @@ +3 diff --git a/s6/base/run-image/service/s6-linux-init-runleveld/run b/s6/base/run-image/service/s6-linux-init-runleveld/run new file mode 100755 index 0000000..1196d8d --- /dev/null +++ b/s6/base/run-image/service/s6-linux-init-runleveld/run @@ -0,0 +1,7 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +fdmove 1 3 +s6-ipcserver -1 -a 0700 -c 1 -- s +s6-sudod -dt30000 -- +"/etc/s6/base"/scripts/runlevel diff --git a/s6/base/run-image/service/s6-linux-init-shutdownd/run b/s6/base/run-image/service/s6-linux-init-shutdownd/run new file mode 100755 index 0000000..8258d75 --- /dev/null +++ b/s6/base/run-image/service/s6-linux-init-shutdownd/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +s6-linux-init-shutdownd -c "/etc/s6/base" -g 3000 diff --git a/s6/base/run-image/service/s6-svscan-log/notification-fd b/s6/base/run-image/service/s6-svscan-log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/s6/base/run-image/service/s6-svscan-log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/s6/base/run-image/service/s6-svscan-log/run b/s6/base/run-image/service/s6-svscan-log/run new file mode 100755 index 0000000..7028d1b --- /dev/null +++ b/s6/base/run-image/service/s6-svscan-log/run @@ -0,0 +1,5 @@ +#!/bin/execlineb -P + +redirfd -w 1 /dev/null +redirfd -rnb 0 fifo +s6-log -bpd3 -- T /run/uncaught-logs diff --git a/s6/base/run-image/service/utmpd/notification-fd b/s6/base/run-image/service/utmpd/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/s6/base/run-image/service/utmpd/notification-fd @@ -0,0 +1 @@ +3 diff --git a/s6/base/run-image/service/utmpd/run b/s6/base/run-image/service/utmpd/run new file mode 100755 index 0000000..35c60c5 --- /dev/null +++ b/s6/base/run-image/service/utmpd/run @@ -0,0 +1,8 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +s6-setuidgid "utmp" +cd /run/utmps +fdmove 1 3 +s6-ipcserver -1 -c 1000 -- /run/utmps/.utmpd-socket +utmps-utmpd diff --git a/s6/base/run-image/service/wtmpd/notification-fd b/s6/base/run-image/service/wtmpd/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/s6/base/run-image/service/wtmpd/notification-fd @@ -0,0 +1 @@ +3 diff --git a/s6/base/run-image/service/wtmpd/run b/s6/base/run-image/service/wtmpd/run new file mode 100755 index 0000000..79815bb --- /dev/null +++ b/s6/base/run-image/service/wtmpd/run @@ -0,0 +1,8 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +s6-setuidgid "utmp" +cd /run/utmps +fdmove 1 3 +s6-ipcserver -1 -c 1000 -- /run/utmps/.wtmpd-socket +utmps-wtmpd diff --git a/s6/base/scripts/rc.init b/s6/base/scripts/rc.init new file mode 100755 index 0000000..56c3e7b --- /dev/null +++ b/s6/base/scripts/rc.init @@ -0,0 +1,49 @@ +#!/bin/sh -e + +rl="$1" +shift + +### argv now contains the arguments of the kernel command line that are +### not of the form key=value. (The key=value arguments were stored by +### s6-linux-init into an envdir, if instructed so via the -s option.) +### Normally this argv remains unused because programs that need the +### kernel command line usually read it later on from /proc/cmdline - +### but just in case, it's available here. + + +### 1. Early preparation +### This is done only once at boot time. +### Ideally, this phase should just initialize the service manager. + +### If your services are managed by sysv-rc: +# /etc/init.d/rcS + +### If your services are managed by OpenRC: +# /sbin/openrc sysinit +# /sbin/openrc boot + +### If your services are managed by s6-rc: +### (replace /run/service with your scandir) +s6-rc-init -c /etc/s6/db/current /run/service + + +### 2. Starting the wanted set of services +### This is also called every time you change runlevels with telinit. +### (edit the location to suit your installation) +### By default, $rl is the string "default", unless you changed it +### via the -D option to s6-linux-init-maker. +### Numeric arguments from 1 to 5 on the kernel command line will +### override the default. + +exec /etc/s6/base/scripts/runlevel "$rl" + + +### If this script is run in a container, then 1. and 2. above do not +### apply and you should just call your CMD, if any, or let your +### services run. +### Something like this: + +# if test -z "$*" ; then return 0 ; fi +# $@ +# echo $? > /run/s6-linux-init-container-results/exitcode +# halt diff --git a/s6/base/scripts/rc.shutdown b/s6/base/scripts/rc.shutdown new file mode 100755 index 0000000..f759ba7 --- /dev/null +++ b/s6/base/scripts/rc.shutdown @@ -0,0 +1,30 @@ +#!/bin/sh -e + +### Things to do before hardware halt/reboot/poweroff. +### Ideally, it should be a single call to the service manager, +### telling it to bring all the services down. + +### If your s6-linux-init-maker invocation was made with the -1 +### option, messages from rc.shutdown will appear on /dev/console +### as well as be logged by the catch-all logger. +### If your s6-linux-init-maker invocation did NOT include the -1 +### option, messages from rc.shutdown will only be logged by the +### catch-all logger and will NOT appear on /dev/console. In order +### to print them to /dev/console instead, you may want to +### uncomment the following line: +exec >/dev/console 2>&1 + +### If your services are managed by sysv-rc: +### also remove the K11reboot link from /etc/rc6.d to prevent +### sysv-rc from rebooting prematurely - because sysvinit does +### not properly separate state changes from system init/shutdown. +# exec /etc/init.d/rc 6 + +### If your services are managed by OpenRC: +### also remove the "killprocs" and "mount-ro" symlinks from +### /etc/runlevels/shutdown - because OpenRC does not properly +### separate the service manager from the shutdown manager either. +# exec /sbin/openrc shutdown + +### If your services are managed by s6-rc: +exec s6-rc -v2 -bda change diff --git a/s6/base/scripts/rc.shutdown.final b/s6/base/scripts/rc.shutdown.final new file mode 100755 index 0000000..3f46b87 --- /dev/null +++ b/s6/base/scripts/rc.shutdown.final @@ -0,0 +1,18 @@ +#!/bin/sh -e + +### Things to do *right before* the machine gets rebooted or +### powered off, at the very end of the shutdown sequence, +### when all the filesystems are unmounted. + +### This is a last resort hook; normally nothing should be +### done here (your rc.shutdown script should have taken care +### of everything) and you should leave this script empty. + +### Some distributions, however, may need to perform some +### actions after unmounting the filesystems: typically if +### an additional teardown action is required on a filesystem +### after unmounting it, or if the system needs to be +### pivot_rooted before it can be shut down, etc. + +### Those are all exceptional cases. If you don't know for +### certain that you need to do something here, you don't. diff --git a/s6/base/scripts/runlevel b/s6/base/scripts/runlevel new file mode 100755 index 0000000..d266171 --- /dev/null +++ b/s6/base/scripts/runlevel @@ -0,0 +1,18 @@ +#!/bin/sh -e + +### This script is called once at boot time by rc.init, and is +### also called by the runleveld service every time the user +### requests a machine state change via telinit. +### Ideally, it should just be a call to the service manager. + +test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; } + + +### If your services are managed by sysv-rc: +# exec /etc/init.d/rc "$1" + +### If your services are managed by OpenRC: +# exec /sbin/openrc "$1" + +### If your services are managed by s6-rc: +exec s6-rc -v2 -up change "$1" diff --git a/s6/db/basic/db b/s6/db/basic/db Binary files differnew file mode 100644 index 0000000..e85e344 --- /dev/null +++ b/s6/db/basic/db diff --git a/s6/db/basic/lock b/s6/db/basic/lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/db/basic/lock diff --git a/s6/db/basic/n b/s6/db/basic/n Binary files differnew file mode 100644 index 0000000..806eabf --- /dev/null +++ b/s6/db/basic/n diff --git a/s6/db/basic/resolve.cdb b/s6/db/basic/resolve.cdb Binary files differnew file mode 100644 index 0000000..62fe7a8 --- /dev/null +++ b/s6/db/basic/resolve.cdb diff --git a/s6/db/basic/servicedirs/agetty2/run b/s6/db/basic/servicedirs/agetty2/run new file mode 100755 index 0000000..6562e22 --- /dev/null +++ b/s6/db/basic/servicedirs/agetty2/run @@ -0,0 +1,2 @@ +#!/bin/execlineb -P +exec /sbin/agetty -L -8 tty2 115200 diff --git a/s6/db/basic/servicedirs/agetty3/run b/s6/db/basic/servicedirs/agetty3/run new file mode 100755 index 0000000..a6117c5 --- /dev/null +++ b/s6/db/basic/servicedirs/agetty3/run @@ -0,0 +1,2 @@ +#!/bin/execlineb -P +exec /sbin/agetty -L -8 tty3 115200 diff --git a/s6/db/basic/servicedirs/agetty4/run b/s6/db/basic/servicedirs/agetty4/run new file mode 100755 index 0000000..1176c91 --- /dev/null +++ b/s6/db/basic/servicedirs/agetty4/run @@ -0,0 +1,2 @@ +#!/bin/execlineb -P +exec /sbin/agetty -L -8 tty4 115200 diff --git a/s6/db/basic/servicedirs/agetty5/run b/s6/db/basic/servicedirs/agetty5/run new file mode 100755 index 0000000..c720902 --- /dev/null +++ b/s6/db/basic/servicedirs/agetty5/run @@ -0,0 +1,2 @@ +#!/bin/execlineb -P +exec /sbin/agetty -L -8 tty5 115200 diff --git a/s6/db/basic/servicedirs/agetty6/run b/s6/db/basic/servicedirs/agetty6/run new file mode 100755 index 0000000..9d0fc1a --- /dev/null +++ b/s6/db/basic/servicedirs/agetty6/run @@ -0,0 +1,2 @@ +#!/bin/execlineb -P +exec /sbin/agetty -L -8 tty6 115200 diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/autofilled b/s6/db/basic/servicedirs/s6rc-fdholder/data/autofilled new file mode 100644 index 0000000..5a7694f --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/autofilled @@ -0,0 +1 @@ +udevd-log diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/gid/0/allow b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/gid/0/allow new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/gid/0/allow diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/gid/0/env b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/gid/0/env new file mode 120000 index 0000000..dbe1277 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/gid/0/env @@ -0,0 +1 @@ +../../uid/0/env
\ No newline at end of file diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/allow b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/allow new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/allow diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_GETDUMP b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_GETDUMP new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_GETDUMP @@ -0,0 +1 @@ + diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_LIST b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_LIST new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_LIST @@ -0,0 +1 @@ + diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_RETRIEVE_REGEX b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_RETRIEVE_REGEX new file mode 120000 index 0000000..8534683 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_RETRIEVE_REGEX @@ -0,0 +1 @@ +S6_FDHOLDER_STORE_REGEX
\ No newline at end of file diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_SETDUMP b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_SETDUMP new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_SETDUMP @@ -0,0 +1 @@ + diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_STORE_REGEX b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_STORE_REGEX new file mode 100644 index 0000000..d1e45dc --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/0/env/S6_FDHOLDER_STORE_REGEX @@ -0,0 +1 @@ +^pipe:s6rc- diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/self b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/self new file mode 120000 index 0000000..c227083 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/data/rules/uid/self @@ -0,0 +1 @@ +0
\ No newline at end of file diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/notification-fd b/s6/db/basic/servicedirs/s6rc-fdholder/notification-fd new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/notification-fd @@ -0,0 +1 @@ +1 diff --git a/s6/db/basic/servicedirs/s6rc-fdholder/run b/s6/db/basic/servicedirs/s6rc-fdholder/run new file mode 100755 index 0000000..0a400c7 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-fdholder/run @@ -0,0 +1,17 @@ +#!/bin/execlineb -P +pipeline -dw -- +{ + if -n -- + { + forstdin -x 1 -- i + exit 1 + } + if -nt -- + { + redirfd -r 0 ./data/autofilled + s6-ipcclient -l0 -- s + /lib/s6-rc/s6-rc-fdholder-filler -1 -- + } + s6-svc -t . +} +s6-fdholder-daemon -1 -i data/rules -- s diff --git a/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/gid/0/allow b/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/gid/0/allow new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/gid/0/allow diff --git a/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/uid/0/allow b/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/uid/0/allow new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/uid/0/allow diff --git a/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/uid/self b/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/uid/self new file mode 120000 index 0000000..c227083 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-oneshot-runner/data/rules/uid/self @@ -0,0 +1 @@ +0
\ No newline at end of file diff --git a/s6/db/basic/servicedirs/s6rc-oneshot-runner/notification-fd b/s6/db/basic/servicedirs/s6rc-oneshot-runner/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-oneshot-runner/notification-fd @@ -0,0 +1 @@ +3 diff --git a/s6/db/basic/servicedirs/s6rc-oneshot-runner/run b/s6/db/basic/servicedirs/s6rc-oneshot-runner/run new file mode 100755 index 0000000..d819a25 --- /dev/null +++ b/s6/db/basic/servicedirs/s6rc-oneshot-runner/run @@ -0,0 +1,8 @@ +#!/bin/execlineb -P +fdmove -c 2 1 +fdmove 1 3 +s6-ipcserver-socketbinder -- s +s6-ipcserverd -1 -- +s6-ipcserver-access -v0 -E -l0 -i data/rules -- +s6-sudod -t 30000 -- +/lib/s6-rc/s6-rc-oneshot-run -l ../.. -- diff --git a/s6/db/basic/servicedirs/udevd-log/notification-fd b/s6/db/basic/servicedirs/udevd-log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/s6/db/basic/servicedirs/udevd-log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/s6/db/basic/servicedirs/udevd-log/run b/s6/db/basic/servicedirs/udevd-log/run new file mode 100755 index 0000000..a8ac83f --- /dev/null +++ b/s6/db/basic/servicedirs/udevd-log/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +s6-fdholder-retrieve ../s6rc-fdholder/s "pipe:s6rc-r-udevd-log" +./run.user diff --git a/s6/db/basic/servicedirs/udevd-log/run.user b/s6/db/basic/servicedirs/udevd-log/run.user new file mode 100755 index 0000000..0bf9ad7 --- /dev/null +++ b/s6/db/basic/servicedirs/udevd-log/run.user @@ -0,0 +1,5 @@ +#!/bin/execlineb -P +foreground { if -n -t { test -d /var/log/udevd } install -d -m 0755 -o s6log -g s6log /var/log/udevd } +envfile /etc/s6/sv/udevd-log/conf +importas -sCiu DIRECTIVES DIRECTIVES +s6-setuidgid s6log exec -c s6-log -d3 -b -- ${DIRECTIVES} /var/log/udevd diff --git a/s6/db/basic/servicedirs/udevd-srv/run b/s6/db/basic/servicedirs/udevd-srv/run new file mode 100755 index 0000000..f5f8202 --- /dev/null +++ b/s6/db/basic/servicedirs/udevd-srv/run @@ -0,0 +1,5 @@ +#!/bin/execlineb -P +fdmove 1 0 +s6-fdholder-retrieve ../s6rc-fdholder/s "pipe:s6rc-w-udevd-log" +fdswap 0 1 +./run.user diff --git a/s6/db/basic/servicedirs/udevd-srv/run.user b/s6/db/basic/servicedirs/udevd-srv/run.user new file mode 100755 index 0000000..fea1782 --- /dev/null +++ b/s6/db/basic/servicedirs/udevd-srv/run.user @@ -0,0 +1,6 @@ +#!/bin/execlineb -P +# Initiate udev +fdmove -c 2 1 +if { s6-echo -- "[ udev-daemon ] 1/1 : Starting udev..." } +exec -c +udevd diff --git a/s6/db/current b/s6/db/current new file mode 120000 index 0000000..5dc1ed1 --- /dev/null +++ b/s6/db/current @@ -0,0 +1 @@ +/etc/s6/db/basic
\ No newline at end of file diff --git a/s6/rc.local b/s6/rc.local new file mode 100644 index 0000000..c266bff --- /dev/null +++ b/s6/rc.local @@ -0,0 +1,6 @@ +#!/bin/sh +# +# Enter custom commands here. By default, they will be executed on startup with the +# "boot" bundle before running services. If you need these commands to wait on certain +# services being up, you can edit the /etc/s6/sv/rc-local/dependencies file and then +# recompile the database. diff --git a/s6/s6.conf b/s6/s6.conf new file mode 100644 index 0000000..6f8ed19 --- /dev/null +++ b/s6/s6.conf @@ -0,0 +1,37 @@ +# /etc/s6/s6.conf - system configuration + +# Set HARDWARECLOCK to UTC if your Hardware Clock is set to UTC (also known as +# Greenwich Mean Time). If that clock is set to the local time, then +# set HARDWARECLOCK to localtime. Note that if you dual boot with Windows, then +# you should set it to localtime. + +HARDWARECLOCK=localtime + +# cgroups mode +# legacy mounts cgroups version 1 on /sys/fs/cgroup +# unified mounts cgroups version 2 on /sys/fs/cgroup +# hybrid mounts cgroups version 2 on /sys/fs/cgroup/unified and +# cgroups version 1 on /sys/fs/cgroup + +CGROUP_MODE=hybrid + +# This is a list of controllers which should be enabled for cgroups version 2. +# If hybrid mode is being used, controllers listed here will not be +# available for cgroups version 1. none means no controllers will be used +# For none, put "" + +CGROUP_CONTROLLERS="" + +# This switch controls whether or not cgroups version 1 controllers are +# individually mounted under +# /sys/fs/cgroup in hybrid or legacy mode + +HAVE_CONTROLLER1_GROUPS=true + +# Which gettys to enable by default. Only tty2 - tty6 are valid (tty1 is provided +# by s6-linux-init). Note that every value must be separated by a space. +#GETTYS="tty2 tty3 tty4 tty5 tty6" +# **Option is broken** + +# Force the root filesystem to be checked at (every) boot +FORCECHECK=no diff --git a/s6/scripts/clean_tmp.sh b/s6/scripts/clean_tmp.sh new file mode 100755 index 0000000..44cbd48 --- /dev/null +++ b/s6/scripts/clean_tmp.sh @@ -0,0 +1,2 @@ +#! /bin/sh +cd /tmp && find . -xdev -mindepth 1 ! -name lost+found -delete diff --git a/s6/scripts/console_set.sh b/s6/scripts/console_set.sh new file mode 100755 index 0000000..9c0e9f3 --- /dev/null +++ b/s6/scripts/console_set.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +[ -r /etc/vconsole.conf ] && . /etc/vconsole.conf +TTYS=${TTYS:-6} +_index=0 +while [ ${_index} -le $TTYS ]; do + if [ -n "$FONT" ]; then + setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} \ + $FONT -C "/dev/tty${_index}" + fi + printf "\033%s" "%G" >/dev/tty${_index} + _index=$((_index + 1)) +done +if [ -n "$KEYMAP" ]; then + loadkeys -q -u ${KEYMAP} +fi diff --git a/s6/scripts/mount-cgroups b/s6/scripts/mount-cgroups new file mode 100755 index 0000000..fd711a0 --- /dev/null +++ b/s6/scripts/mount-cgroups @@ -0,0 +1,120 @@ +#!/bin/sh + +CGROUP_OPTS=nodev,noexec,nosuid +CGROUP_MODE=$1 +CGROUP_CONTROLLERS=$2 +HAVE_CONTROLLER1_GROUPS=$3 + +#if [ $CGROUP_CONTROLLERS = "none" ]; then +# CGROUP_CONTROLLERS="" +#fi + +cgroup2_find_path() { + if grep -qw cgroup2 /proc/filesystems; then + case "${CGROUP_MODE}" in + hybrid) printf "/sys/fs/cgroup/unified" ;; + unified) printf "/sys/fs/cgroup" ;; + esac + fi + return 0 +} + +cgroup1_base() { + grep -qw cgroup /proc/filesystems || return 0 + if ! mountpoint -q /sys/fs/cgroup; then + local opts="${CGROUP_OPTS},mode=755,size=${rc_cgroupsize:-10m}" + mount -n -t tmpfs -o "${opts}" cgroup_root /sys/fs/cgroup + fi + + if ! mountpoint -q /sys/fs/cgroup/openrc; then + local agent="/etc/s6/sv/mount-cgroups/cgroup-release-agent.sh" + mkdir /sys/fs/cgroup/openrc + mount -n -t cgroup -o none,${CGROUP_OPTS},name=openrc,release_agent="$agent" openrc /sys/fs/cgroup/openrc + printf 1 > /sys/fs/cgroup/openrc/notify_on_release + fi + return 0 +} + +cgroup1_controllers() { + ${HAVE_CONTROLLER1_GROUPS} && [ -e /proc/cgroups ] && grep -qw cgroup /proc/filesystems || return 0 + while read -r name _ _ enabled _; do + case "${enabled}" in + 1) if mountpoint -q "/sys/fs/cgroup/${name}";then continue;fi + local x + for x in $CGROUP_CONTROLLERS; do + [ "${name}" = "blkio" ] && [ "${x}" = "io" ] && + continue 2 + [ "${name}" = "${x}" ] && + continue 2 + done + mkdir "/sys/fs/cgroup/${name}" + mount -n -t cgroup -o "${CGROUP_OPTS},${name}" "${name}" "/sys/fs/cgroup/${name}" + ;; + esac + done < /proc/cgroups + return 0 +} + +cgroup2_base() { + grep -qw cgroup2 /proc/filesystems || return 0 + local base + base="$(cgroup2_find_path)" + mkdir -p "${base}" + mount -t cgroup2 none -o "${CGROUP_OPTS},nsdelegate" "${base}" 2> /dev/null || + mount -t cgroup2 none -o "${CGROUP_OPTS}" "${base}" + return 0 +} + +cgroup2_controllers() { + grep -qw cgroup2 /proc/filesystems || return 0 + local active cgroup_path x y + cgroup_path="$(cgroup2_find_path)" + [ -z "${cgroup_path}" ] && return 0 + [ -e "${cgroup_path}/cgroup.controllers" ] && read -r active < "${cgroup_path}/cgroup.controllers" + for x in ${CGROUP_CONTROLLERS}; do + for y in ${active}; do + [ "$x" = "$y" ] && [ -e "${cgroup_path}/cgroup.subtree_control" ] && + echo "+${x}" > "${cgroup_path}/cgroup.subtree_control" + done + done + return 0 +} + +cgroups_hybrid() { + cgroup1_base + cgroup2_base + cgroup2_controllers + cgroup1_controllers + return 0 +} + +cgroups_legacy() { + cgroup1_base + cgroup1_controllers + return 0 +} + +cgroups_unified() { + cgroup2_base + cgroup2_controllers + return 0 +} + +mount_cgroups() { + case "${CGROUP_MODE}" in + hybrid) cgroups_hybrid ;; + legacy) cgroups_legacy ;; + unified) cgroups_unified ;; + esac + return 0 +} + +mount_cgs() { + if [ -d /sys/fs/cgroup ];then + mount_cgroups + return 0 + fi + return 1 +} + +mount_cgs diff --git a/s6/skel/rc.init b/s6/skel/rc.init new file mode 100644 index 0000000..b467448 --- /dev/null +++ b/s6/skel/rc.init @@ -0,0 +1,9 @@ +#!/bin/sh -e + +rl="$1" +shift + +s6-rc-init -c /etc/s6/db/current /run/service + +exec /etc/s6/base/scripts/runlevel "$rl" + diff --git a/s6/skel/rc.shutdown b/s6/skel/rc.shutdown new file mode 100644 index 0000000..bc5771d --- /dev/null +++ b/s6/skel/rc.shutdown @@ -0,0 +1,3 @@ +#!/bin/sh -e + +exec s6-rc -bda change diff --git a/s6/skel/rc.shutdown.final b/s6/skel/rc.shutdown.final new file mode 100644 index 0000000..3f46b87 --- /dev/null +++ b/s6/skel/rc.shutdown.final @@ -0,0 +1,18 @@ +#!/bin/sh -e + +### Things to do *right before* the machine gets rebooted or +### powered off, at the very end of the shutdown sequence, +### when all the filesystems are unmounted. + +### This is a last resort hook; normally nothing should be +### done here (your rc.shutdown script should have taken care +### of everything) and you should leave this script empty. + +### Some distributions, however, may need to perform some +### actions after unmounting the filesystems: typically if +### an additional teardown action is required on a filesystem +### after unmounting it, or if the system needs to be +### pivot_rooted before it can be shut down, etc. + +### Those are all exceptional cases. If you don't know for +### certain that you need to do something here, you don't. diff --git a/s6/skel/runlevel b/s6/skel/runlevel new file mode 100644 index 0000000..f9db6e4 --- /dev/null +++ b/s6/skel/runlevel @@ -0,0 +1,5 @@ +#!/bin/sh -e + +test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; } + +exec s6-rc -up change "$1" diff --git a/s6/sv/agetty2/dependencies.d/hostname b/s6/sv/agetty2/dependencies.d/hostname new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/agetty2/dependencies.d/hostname diff --git a/s6/sv/agetty2/run b/s6/sv/agetty2/run new file mode 100644 index 0000000..1bb017f --- /dev/null +++ b/s6/sv/agetty2/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Services ] : Enabling tty2" } +exec /sbin/agetty -L -8 tty2 115200 diff --git a/s6/sv/agetty2/type b/s6/sv/agetty2/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/s6/sv/agetty2/type @@ -0,0 +1 @@ +longrun diff --git a/s6/sv/agetty3/dependencies.d/hostname b/s6/sv/agetty3/dependencies.d/hostname new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/agetty3/dependencies.d/hostname diff --git a/s6/sv/agetty3/run b/s6/sv/agetty3/run new file mode 100644 index 0000000..5a5cf19 --- /dev/null +++ b/s6/sv/agetty3/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Services ] : Enabling tty3" } +exec /sbin/agetty -L -8 tty3 115200 diff --git a/s6/sv/agetty3/type b/s6/sv/agetty3/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/s6/sv/agetty3/type @@ -0,0 +1 @@ +longrun diff --git a/s6/sv/agetty4/dependencies.d/hostname b/s6/sv/agetty4/dependencies.d/hostname new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/agetty4/dependencies.d/hostname diff --git a/s6/sv/agetty4/run b/s6/sv/agetty4/run new file mode 100644 index 0000000..3f6a88e --- /dev/null +++ b/s6/sv/agetty4/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Services ] : Enabling tty4" } +exec /sbin/agetty -L -8 tty4 115200 diff --git a/s6/sv/agetty4/type b/s6/sv/agetty4/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/s6/sv/agetty4/type @@ -0,0 +1 @@ +longrun diff --git a/s6/sv/agetty5/dependencies.d/hostname b/s6/sv/agetty5/dependencies.d/hostname new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/agetty5/dependencies.d/hostname diff --git a/s6/sv/agetty5/run b/s6/sv/agetty5/run new file mode 100644 index 0000000..2f2e326 --- /dev/null +++ b/s6/sv/agetty5/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Services ] : Enabling tty5" } +exec /sbin/agetty -L -8 tty5 115200 diff --git a/s6/sv/agetty5/type b/s6/sv/agetty5/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/s6/sv/agetty5/type @@ -0,0 +1 @@ +longrun diff --git a/s6/sv/agetty6/dependencies.d/hostname b/s6/sv/agetty6/dependencies.d/hostname new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/agetty6/dependencies.d/hostname diff --git a/s6/sv/agetty6/run b/s6/sv/agetty6/run new file mode 100644 index 0000000..49f8a3a --- /dev/null +++ b/s6/sv/agetty6/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Services ] : Enabling tty6" } +exec /sbin/agetty -L -8 tty6 115200 diff --git a/s6/sv/agetty6/type b/s6/sv/agetty6/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/s6/sv/agetty6/type @@ -0,0 +1 @@ +longrun diff --git a/s6/sv/cgroups/dependencies.d/mount-procfs b/s6/sv/cgroups/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/cgroups/dependencies.d/mount-procfs diff --git a/s6/sv/cgroups/dependencies.d/mount-sysfs b/s6/sv/cgroups/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/cgroups/dependencies.d/mount-sysfs diff --git a/s6/sv/cgroups/dependencies.d/vkfs b/s6/sv/cgroups/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/cgroups/dependencies.d/vkfs diff --git a/s6/sv/cgroups/type b/s6/sv/cgroups/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/cgroups/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/cgroups/up b/s6/sv/cgroups/up new file mode 100644 index 0000000..51e4246 --- /dev/null +++ b/s6/sv/cgroups/up @@ -0,0 +1,7 @@ +#!/bin/execlineb -P +if { s6-echo "[ Read-Only Mode ] 1/9 : Mounting cgroups" } +envfile /etc/s6/s6.conf +importas -iu CGROUP_MODE CGROUP_MODE +importas -iu CGROUP_CONTROLLERS CGROUP_CONTROLLERS +importas -iu HAVE_CONTROLLER1_GROUPS HAVE_CONTROLLER1_GROUPS +exec sh /etc/s6/scripts/mount-cgroups $CGROUP_MODE $CGROUP_CONTROLLERS $HAVE_CONTROLLER1_GROUPS diff --git a/s6/sv/checkfs/dependencies.d/udev b/s6/sv/checkfs/dependencies.d/udev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/checkfs/dependencies.d/udev diff --git a/s6/sv/checkfs/type b/s6/sv/checkfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/checkfs/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/checkfs/up b/s6/sv/checkfs/up new file mode 100644 index 0000000..9dd2952 --- /dev/null +++ b/s6/sv/checkfs/up @@ -0,0 +1,12 @@ +envfile /etc/s6/s6.conf +importas -iu FORCECHECK FORCECHECK +ifelse -X { s6-test $FORCECHCK = yes } + { + redirfd -w 1 /dev/console + if { s6-echo -- "[ Checkrootfs ] >>>>> Check of filesystem was asked, please wait" } + foreground { fsck -A -T -a -f noopts=_netdev } + s6-echo -- "[ Checkrootfs ] >>>>> Check of filesystem was asked, please wait" +} +if -t { + fsck -A -T -a noopts=_netdev +} diff --git a/s6/sv/cleantmp/dependencies.d/remount-root b/s6/sv/cleantmp/dependencies.d/remount-root new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/cleantmp/dependencies.d/remount-root diff --git a/s6/sv/cleantmp/down b/s6/sv/cleantmp/down new file mode 100644 index 0000000..c5f65cc --- /dev/null +++ b/s6/sv/cleantmp/down @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Shutdown ] : Cleaning /tmp" } +/bin/sh -c "/etc/s6/scripts/clean_tmp.sh" diff --git a/s6/sv/cleantmp/type b/s6/sv/cleantmp/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/cleantmp/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/cleantmp/up b/s6/sv/cleantmp/up new file mode 100644 index 0000000..9c24500 --- /dev/null +++ b/s6/sv/cleantmp/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ ReadWrite Mode ] 0/6 : Cleaning /tmp" } +/bin/sh -c "/etc/s6/scripts/clean_tmp.sh" diff --git a/s6/sv/console/dependencies.d/udev b/s6/sv/console/dependencies.d/udev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/console/dependencies.d/udev diff --git a/s6/sv/console/type b/s6/sv/console/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/console/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/console/up b/s6/sv/console/up new file mode 100644 index 0000000..416edb9 --- /dev/null +++ b/s6/sv/console/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Read-Only Mode ] 2/9 : Setting up console" } +sh -c "/etc/s6/scripts/console_set.sh" diff --git a/s6/sv/default/contents.d/machine b/s6/sv/default/contents.d/machine new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/default/contents.d/machine diff --git a/s6/sv/default/contents.d/services b/s6/sv/default/contents.d/services new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/default/contents.d/services diff --git a/s6/sv/default/contents.d/vkfs b/s6/sv/default/contents.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/default/contents.d/vkfs diff --git a/s6/sv/default/type b/s6/sv/default/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/default/type @@ -0,0 +1 @@ +bundle diff --git a/s6/sv/dmesg/dependencies.d/remount-root b/s6/sv/dmesg/dependencies.d/remount-root new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/dmesg/dependencies.d/remount-root diff --git a/s6/sv/dmesg/dependencies.d/vkfs b/s6/sv/dmesg/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/dmesg/dependencies.d/vkfs diff --git a/s6/sv/dmesg/type b/s6/sv/dmesg/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/dmesg/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/dmesg/up b/s6/sv/dmesg/up new file mode 100644 index 0000000..872a8d7 --- /dev/null +++ b/s6/sv/dmesg/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ ReadWrite Mode ] 2/6 : Logging kernel boot" } +pipeline { dmesg } s6-setuidgid s6log exec -c s6-log -b -- n3 s2000000 T /var/log/dmesg diff --git a/s6/sv/getty/contents.d/agetty2 b/s6/sv/getty/contents.d/agetty2 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/getty/contents.d/agetty2 diff --git a/s6/sv/getty/contents.d/agetty3 b/s6/sv/getty/contents.d/agetty3 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/getty/contents.d/agetty3 diff --git a/s6/sv/getty/contents.d/agetty4 b/s6/sv/getty/contents.d/agetty4 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/getty/contents.d/agetty4 diff --git a/s6/sv/getty/contents.d/agetty5 b/s6/sv/getty/contents.d/agetty5 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/getty/contents.d/agetty5 diff --git a/s6/sv/getty/contents.d/agetty6 b/s6/sv/getty/contents.d/agetty6 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/getty/contents.d/agetty6 diff --git a/s6/sv/getty/type b/s6/sv/getty/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/getty/type @@ -0,0 +1 @@ +bundle diff --git a/s6/sv/hostname/dependencies.d/mount-procfs b/s6/sv/hostname/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/hostname/dependencies.d/mount-procfs diff --git a/s6/sv/hostname/type b/s6/sv/hostname/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/hostname/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/hostname/up b/s6/sv/hostname/up new file mode 100644 index 0000000..72f519e --- /dev/null +++ b/s6/sv/hostname/up @@ -0,0 +1,5 @@ +#!/bin/execlineb -P +if { s6-echo "[ Read-Only Mode ] 3/9 : Setting hostname" } +if -t { s6-test -s /etc/hostname } backtick -n HOSTNAME { head -1 /etc/hostname } +importas -iu HOSTNAME HOSTNAME +if -t { s6-test -n $HOSTNAME } redirfd -w 1 /proc/sys/kernel/hostname echo $HOSTNAME diff --git a/s6/sv/hwclock/dependencies.d/udev b/s6/sv/hwclock/dependencies.d/udev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/hwclock/dependencies.d/udev diff --git a/s6/sv/hwclock/down b/s6/sv/hwclock/down new file mode 100644 index 0000000..5349d21 --- /dev/null +++ b/s6/sv/hwclock/down @@ -0,0 +1,6 @@ +#!/bin/execlineb -P +if { s6-echo "[ Shutdown ] : Saving sytem clock to rtc0" } +envfile /etc/s6/s6.conf +importas -iu HARDWARECLOCK HARDWARECLOCK +foreground { if { s6-test $HARDWARECLOCK = UTC } hwclock --systohc --utc --noadjfile } +foreground { if { s6-test $HARDWARECLOCK = localtime } hwclock --systohc --localtime --noadjfile } diff --git a/s6/sv/hwclock/type b/s6/sv/hwclock/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/hwclock/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/hwclock/up b/s6/sv/hwclock/up new file mode 100644 index 0000000..ee88cbf --- /dev/null +++ b/s6/sv/hwclock/up @@ -0,0 +1,6 @@ +#!/bin/execlineb -P +if { s6-echo "[ Read-Only Mode ] 4/9 : Setting system clock from rtc0" } +envfile /etc/s6/s6.conf +importas -iu HARDWARECLOCK HARDWARECLOCK +foreground { if { s6-test $HARDWARECLOCK = UTC } hwclock --systz --utc --noadjfile } +foreground { if { s6-test $HARDWARECLOCK = localtime } hwclock --systz --localtime --noadjfile } diff --git a/s6/sv/kermod/dependencies.d/mount-procfs b/s6/sv/kermod/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/kermod/dependencies.d/mount-procfs diff --git a/s6/sv/kermod/dependencies.d/mount-sysfs b/s6/sv/kermod/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/kermod/dependencies.d/mount-sysfs diff --git a/s6/sv/kermod/type b/s6/sv/kermod/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/kermod/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/kermod/up b/s6/sv/kermod/up new file mode 100644 index 0000000..f8d4d90 --- /dev/null +++ b/s6/sv/kermod/up @@ -0,0 +1,4 @@ +#!/bin/execlineb -P +if { s6-echo "[ Read-Only Mode ] 5/9 : Setting up Kernel Static Node(s)" } +foreground { if -n { test -d /run/tmpfiles.d } mkdir /run/tmpfiles.d } +foreground { kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf } diff --git a/s6/sv/machine/contents.d/rofs b/s6/sv/machine/contents.d/rofs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/machine/contents.d/rofs diff --git a/s6/sv/machine/contents.d/rwfs b/s6/sv/machine/contents.d/rwfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/machine/contents.d/rwfs diff --git a/s6/sv/machine/dependencies.d/vkfs b/s6/sv/machine/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/machine/dependencies.d/vkfs diff --git a/s6/sv/machine/type b/s6/sv/machine/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/machine/type @@ -0,0 +1 @@ +bundle diff --git a/s6/sv/mnt-devpts/dependencies.d/mount-procfs b/s6/sv/mnt-devpts/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mnt-devpts/dependencies.d/mount-procfs diff --git a/s6/sv/mnt-devpts/dependencies.d/prep-dev b/s6/sv/mnt-devpts/dependencies.d/prep-dev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mnt-devpts/dependencies.d/prep-dev diff --git a/s6/sv/mnt-devpts/type b/s6/sv/mnt-devpts/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/mnt-devpts/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/mnt-devpts/up b/s6/sv/mnt-devpts/up new file mode 100644 index 0000000..32609fa --- /dev/null +++ b/s6/sv/mnt-devpts/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Virtual-FS ] 3/6 : Mounting /dev/pts" } +s6-mount -t devpts -o mode=0620,gid=5,nosuid,noexec devpts /dev/pts diff --git a/s6/sv/mnt-shm/dependencies.d/mount-procfs b/s6/sv/mnt-shm/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mnt-shm/dependencies.d/mount-procfs diff --git a/s6/sv/mnt-shm/dependencies.d/prep-dev b/s6/sv/mnt-shm/dependencies.d/prep-dev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mnt-shm/dependencies.d/prep-dev diff --git a/s6/sv/mnt-shm/type b/s6/sv/mnt-shm/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/mnt-shm/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/mnt-shm/up b/s6/sv/mnt-shm/up new file mode 100644 index 0000000..a461bfc --- /dev/null +++ b/s6/sv/mnt-shm/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Virtual-FS ] 4/6 : Mounting /dev/shm" } +s6-mount -t tmpfs -o mode=1777,nosuid,nodev shm /dev/shm diff --git a/s6/sv/modules/dependencies.d/mount-procfs b/s6/sv/modules/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/modules/dependencies.d/mount-procfs diff --git a/s6/sv/modules/dependencies.d/udev b/s6/sv/modules/dependencies.d/udev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/modules/dependencies.d/udev diff --git a/s6/sv/modules/type b/s6/sv/modules/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/modules/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/modules/up b/s6/sv/modules/up new file mode 100644 index 0000000..a475dc9 --- /dev/null +++ b/s6/sv/modules/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Read-Only Mode ] 6/9 : Loading any kernel modules" } +sh -c "modules-load" diff --git a/s6/sv/mount-devfs/contents.d/mnt-devpts b/s6/sv/mount-devfs/contents.d/mnt-devpts new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mount-devfs/contents.d/mnt-devpts diff --git a/s6/sv/mount-devfs/contents.d/mnt-shm b/s6/sv/mount-devfs/contents.d/mnt-shm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mount-devfs/contents.d/mnt-shm diff --git a/s6/sv/mount-devfs/contents.d/prep-dev b/s6/sv/mount-devfs/contents.d/prep-dev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mount-devfs/contents.d/prep-dev diff --git a/s6/sv/mount-devfs/dependencies.d/mount-procfs b/s6/sv/mount-devfs/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mount-devfs/dependencies.d/mount-procfs diff --git a/s6/sv/mount-devfs/type b/s6/sv/mount-devfs/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/mount-devfs/type @@ -0,0 +1 @@ +bundle diff --git a/s6/sv/mount-efivars/dependencies.d/mount-sysfs b/s6/sv/mount-efivars/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mount-efivars/dependencies.d/mount-sysfs diff --git a/s6/sv/mount-efivars/type b/s6/sv/mount-efivars/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/mount-efivars/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/mount-efivars/up b/s6/sv/mount-efivars/up new file mode 100644 index 0000000..3c2fe6e --- /dev/null +++ b/s6/sv/mount-efivars/up @@ -0,0 +1,7 @@ +#!/bin/execlineb -P +if { s6-echo "[ Virtual-FS ] 6/6 : Mounting EFI-vars-fs" } +foreground { + if { test -d /sys/firmware/efi } + if -n { mountpoint -q /sys/firmware/efi/efivars } + mount -n -t efivarfs -o ro efivarfs /sys/firmware/efi/efivars +} diff --git a/s6/sv/mount-ksecurity/dependencies.d/mount-sysfs b/s6/sv/mount-ksecurity/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mount-ksecurity/dependencies.d/mount-sysfs diff --git a/s6/sv/mount-ksecurity/type b/s6/sv/mount-ksecurity/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/mount-ksecurity/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/mount-ksecurity/up b/s6/sv/mount-ksecurity/up new file mode 100644 index 0000000..b7c4240 --- /dev/null +++ b/s6/sv/mount-ksecurity/up @@ -0,0 +1,8 @@ +#!/bin/execlineb -P +if { s6-echo "[ Virtual-FS ] 5/6 : Mounting securityfs" } +foreground { + if { test -d /sys/kernel } + if -n { mountpoint -q /sys/kernel/security } + mount -n -t securityfs securityfs /sys/kernel/security + +} diff --git a/s6/sv/mount-procfs/type b/s6/sv/mount-procfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/mount-procfs/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/mount-procfs/up b/s6/sv/mount-procfs/up new file mode 100644 index 0000000..130a2a9 --- /dev/null +++ b/s6/sv/mount-procfs/up @@ -0,0 +1,4 @@ +#!/bin/execlineb -P +if { s6-echo "|--((( S6+S6-rc Bootscripts v 5.0.0 )))---| " } +if { s6-echo "[ Virtual-FS ] 1/6 : Mounting /proc" } +s6-mount -t proc -o nosuid,noexec,nodev proc /proc diff --git a/s6/sv/mount-sysfs/dependencies.d/mount-procfs b/s6/sv/mount-sysfs/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/mount-sysfs/dependencies.d/mount-procfs diff --git a/s6/sv/mount-sysfs/type b/s6/sv/mount-sysfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/mount-sysfs/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/mount-sysfs/up b/s6/sv/mount-sysfs/up new file mode 100644 index 0000000..c655ddc --- /dev/null +++ b/s6/sv/mount-sysfs/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Virtual-FS ] 2/6 : Mounting /sys" } +s6-mount -t sysfs -o nosuid,noexec,nodev sys /sys diff --git a/s6/sv/net-lo/dependencies.d/remount-root b/s6/sv/net-lo/dependencies.d/remount-root new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/net-lo/dependencies.d/remount-root diff --git a/s6/sv/net-lo/dependencies.d/vkfs b/s6/sv/net-lo/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/net-lo/dependencies.d/vkfs diff --git a/s6/sv/net-lo/type b/s6/sv/net-lo/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/net-lo/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/net-lo/up b/s6/sv/net-lo/up new file mode 100644 index 0000000..a1b6f9e --- /dev/null +++ b/s6/sv/net-lo/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ ReadWrite Mode ] 3/6 : Setting up network loopback device" } +ip link set up dev lo diff --git a/s6/sv/networking/dependencies.d/machine b/s6/sv/networking/dependencies.d/machine new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/networking/dependencies.d/machine diff --git a/s6/sv/networking/dependencies.d/vkfs b/s6/sv/networking/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/networking/dependencies.d/vkfs diff --git a/s6/sv/networking/down b/s6/sv/networking/down new file mode 100644 index 0000000..f749735 --- /dev/null +++ b/s6/sv/networking/down @@ -0,0 +1,13 @@ +#!/bin/execlineb -P +fdmove -c 2 1 +if { s6-echo -- [ Shutdown ] : Shutting down WiFi & Ethernet... } +export IN_BOOT 1 +foreground { echo "[ Shutdown ] : Stopping networking interfaces..." } +elglob -0 FILES /etc/sysconfig/ifconfig.* +forx INTERFACE { ${FILES} } + importas -u INTERFACE INTERFACE + backtick IFACE { pipeline { echo ${INTERFACE} } cut -d . -f 2 } + importas -nu IFACE IFACE + /sbin/ifdown ${IFACE} + +s6-echo -- [ Shutdown ] : Networking Disabled. diff --git a/s6/sv/networking/type b/s6/sv/networking/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/networking/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/networking/up b/s6/sv/networking/up new file mode 100644 index 0000000..b7213b6 --- /dev/null +++ b/s6/sv/networking/up @@ -0,0 +1,12 @@ +#!/bin/execlineb -P +fdmove -c 2 1 +if { s6-echo -- "[ Networking ] : Bringing up any network interfaces..." } +export IN_BOOT 1 +elglob -0 FILES /etc/sysconfig/ifconfig.* +forx INTERFACE { ${FILES} } + importas -u INTERFACE INTERFACE + backtick IFACE { pipeline { echo ${INTERFACE} } cut -d . -f 2 } + importas -nu IFACE IFACE + /sbin/ifup ${IFACE} + +if { s6-echo -- "[ Networking ] : Setup done" } diff --git a/s6/sv/prep-dev/dependencies.d/mount-procfs b/s6/sv/prep-dev/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/prep-dev/dependencies.d/mount-procfs diff --git a/s6/sv/prep-dev/type b/s6/sv/prep-dev/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/prep-dev/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/prep-dev/up b/s6/sv/prep-dev/up new file mode 100644 index 0000000..abb0bd4 --- /dev/null +++ b/s6/sv/prep-dev/up @@ -0,0 +1,4 @@ +#!/bin/execlineb -P +if { s6-echo "[ Virtual-FS ] 0/6 : Creating mount points" } +s6-mkdir /dev/shm +s6-mkdir /dev/pts diff --git a/s6/sv/random-seed/dependencies.d/mount-devfs b/s6/sv/random-seed/dependencies.d/mount-devfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/random-seed/dependencies.d/mount-devfs diff --git a/s6/sv/random-seed/dependencies.d/mount-procfs b/s6/sv/random-seed/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/random-seed/dependencies.d/mount-procfs diff --git a/s6/sv/random-seed/dependencies.d/mount-sysfs b/s6/sv/random-seed/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/random-seed/dependencies.d/mount-sysfs diff --git a/s6/sv/random-seed/dependencies.d/remount-root b/s6/sv/random-seed/dependencies.d/remount-root new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/random-seed/dependencies.d/remount-root diff --git a/s6/sv/random-seed/dependencies.d/udevadm b/s6/sv/random-seed/dependencies.d/udevadm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/random-seed/dependencies.d/udevadm diff --git a/s6/sv/random-seed/type b/s6/sv/random-seed/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/random-seed/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/random-seed/up b/s6/sv/random-seed/up new file mode 100644 index 0000000..9591e6c --- /dev/null +++ b/s6/sv/random-seed/up @@ -0,0 +1,8 @@ +#!/bin/execlineb -P +if { s6-echo "[ ReadWrite Mode ] 4/6 : Restoring random seed" } +#foreground { umask 077; cp /var/lib/random-seed /dev/urandom } +foreground { cp /var/lib/random-seed /dev/urandom } +backtick -n bytes { cat /proc/sys/kernel/random/poolsize } +importas -iu bytes bytes +foreground { if { s6-test -z $bytes } define bytes 512 } +foreground { redirfd -w 2 /dev/null dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes } diff --git a/s6/sv/remount-root/dependencies.d/checkfs b/s6/sv/remount-root/dependencies.d/checkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/remount-root/dependencies.d/checkfs diff --git a/s6/sv/remount-root/type b/s6/sv/remount-root/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/remount-root/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/remount-root/up b/s6/sv/remount-root/up new file mode 100644 index 0000000..da6bf4c --- /dev/null +++ b/s6/sv/remount-root/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ ReadWrite Mode ] 1/6 : Remounting root filesystem as rw" } +s6-mount -o remount,rw / / diff --git a/s6/sv/rofs/contents.d/cgroups b/s6/sv/rofs/contents.d/cgroups new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/cgroups diff --git a/s6/sv/rofs/contents.d/checkfs b/s6/sv/rofs/contents.d/checkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/checkfs diff --git a/s6/sv/rofs/contents.d/console b/s6/sv/rofs/contents.d/console new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/console diff --git a/s6/sv/rofs/contents.d/hostname b/s6/sv/rofs/contents.d/hostname new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/hostname diff --git a/s6/sv/rofs/contents.d/hwclock b/s6/sv/rofs/contents.d/hwclock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/hwclock diff --git a/s6/sv/rofs/contents.d/kermod b/s6/sv/rofs/contents.d/kermod new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/kermod diff --git a/s6/sv/rofs/contents.d/modules b/s6/sv/rofs/contents.d/modules new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/modules diff --git a/s6/sv/rofs/contents.d/swap b/s6/sv/rofs/contents.d/swap new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/swap diff --git a/s6/sv/rofs/contents.d/sysctl b/s6/sv/rofs/contents.d/sysctl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/sysctl diff --git a/s6/sv/rofs/contents.d/udev b/s6/sv/rofs/contents.d/udev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/contents.d/udev diff --git a/s6/sv/rofs/dependencies.d/vkfs b/s6/sv/rofs/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rofs/dependencies.d/vkfs diff --git a/s6/sv/rofs/type b/s6/sv/rofs/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/rofs/type @@ -0,0 +1 @@ +bundle diff --git a/s6/sv/rwfs-end/dependencies.d/dmesg b/s6/sv/rwfs-end/dependencies.d/dmesg new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs-end/dependencies.d/dmesg diff --git a/s6/sv/rwfs-end/dependencies.d/net-lo b/s6/sv/rwfs-end/dependencies.d/net-lo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs-end/dependencies.d/net-lo diff --git a/s6/sv/rwfs-end/dependencies.d/random-seed b/s6/sv/rwfs-end/dependencies.d/random-seed new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs-end/dependencies.d/random-seed diff --git a/s6/sv/rwfs-end/dependencies.d/remount-root b/s6/sv/rwfs-end/dependencies.d/remount-root new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs-end/dependencies.d/remount-root diff --git a/s6/sv/rwfs-end/dependencies.d/tmpfiles-dev b/s6/sv/rwfs-end/dependencies.d/tmpfiles-dev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs-end/dependencies.d/tmpfiles-dev diff --git a/s6/sv/rwfs-end/dependencies.d/tmpfiles-setup b/s6/sv/rwfs-end/dependencies.d/tmpfiles-setup new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs-end/dependencies.d/tmpfiles-setup diff --git a/s6/sv/rwfs-end/type b/s6/sv/rwfs-end/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/rwfs-end/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/rwfs-end/up b/s6/sv/rwfs-end/up new file mode 100644 index 0000000..6946d37 --- /dev/null +++ b/s6/sv/rwfs-end/up @@ -0,0 +1 @@ +s6-true diff --git a/s6/sv/rwfs/contents.d/cleantmp b/s6/sv/rwfs/contents.d/cleantmp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/contents.d/cleantmp diff --git a/s6/sv/rwfs/contents.d/dmesg b/s6/sv/rwfs/contents.d/dmesg new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/contents.d/dmesg diff --git a/s6/sv/rwfs/contents.d/net-lo b/s6/sv/rwfs/contents.d/net-lo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/contents.d/net-lo diff --git a/s6/sv/rwfs/contents.d/random-seed b/s6/sv/rwfs/contents.d/random-seed new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/contents.d/random-seed diff --git a/s6/sv/rwfs/contents.d/remount-root b/s6/sv/rwfs/contents.d/remount-root new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/contents.d/remount-root diff --git a/s6/sv/rwfs/contents.d/rwfs-end b/s6/sv/rwfs/contents.d/rwfs-end new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/contents.d/rwfs-end diff --git a/s6/sv/rwfs/contents.d/tmpfiles-dev b/s6/sv/rwfs/contents.d/tmpfiles-dev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/contents.d/tmpfiles-dev diff --git a/s6/sv/rwfs/contents.d/tmpfiles-setup b/s6/sv/rwfs/contents.d/tmpfiles-setup new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/contents.d/tmpfiles-setup diff --git a/s6/sv/rwfs/dependencies.d/rofs b/s6/sv/rwfs/dependencies.d/rofs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/dependencies.d/rofs diff --git a/s6/sv/rwfs/dependencies.d/vkfs b/s6/sv/rwfs/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/rwfs/dependencies.d/vkfs diff --git a/s6/sv/rwfs/type b/s6/sv/rwfs/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/rwfs/type @@ -0,0 +1 @@ +bundle diff --git a/s6/sv/services/contents.d/getty b/s6/sv/services/contents.d/getty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/services/contents.d/getty diff --git a/s6/sv/services/contents.d/networking b/s6/sv/services/contents.d/networking new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/services/contents.d/networking diff --git a/s6/sv/services/type b/s6/sv/services/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/services/type @@ -0,0 +1 @@ +bundle diff --git a/s6/sv/swap/dependencies.d/mount-sysfs b/s6/sv/swap/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/swap/dependencies.d/mount-sysfs diff --git a/s6/sv/swap/dependencies.d/udev b/s6/sv/swap/dependencies.d/udev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/swap/dependencies.d/udev diff --git a/s6/sv/swap/down b/s6/sv/swap/down new file mode 100644 index 0000000..09fda29 --- /dev/null +++ b/s6/sv/swap/down @@ -0,0 +1 @@ +swapoff -a diff --git a/s6/sv/swap/type b/s6/sv/swap/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/swap/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/swap/up b/s6/sv/swap/up new file mode 100644 index 0000000..29bf079 --- /dev/null +++ b/s6/sv/swap/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Read-Only Mode ] 7/9 : Turning on any swap/swap-files" } +swapon -a diff --git a/s6/sv/sysctl/dependencies.d/mount-procfs b/s6/sv/sysctl/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/sysctl/dependencies.d/mount-procfs diff --git a/s6/sv/sysctl/dependencies.d/mount-sysfs b/s6/sv/sysctl/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/sysctl/dependencies.d/mount-sysfs diff --git a/s6/sv/sysctl/dependencies.d/udev b/s6/sv/sysctl/dependencies.d/udev new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/sysctl/dependencies.d/udev diff --git a/s6/sv/sysctl/type b/s6/sv/sysctl/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/sysctl/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/sysctl/up b/s6/sv/sysctl/up new file mode 100644 index 0000000..670f8e3 --- /dev/null +++ b/s6/sv/sysctl/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ Read-Only Mode ] 0/9 : Setting kernel parameters" } +redirfd -w 1 /dev/null sysctl --system diff --git a/s6/sv/tmpfiles-dev/dependencies.d/cleantmp b/s6/sv/tmpfiles-dev/dependencies.d/cleantmp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/tmpfiles-dev/dependencies.d/cleantmp diff --git a/s6/sv/tmpfiles-dev/dependencies.d/remount-root b/s6/sv/tmpfiles-dev/dependencies.d/remount-root new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/tmpfiles-dev/dependencies.d/remount-root diff --git a/s6/sv/tmpfiles-dev/dependencies.d/vkfs b/s6/sv/tmpfiles-dev/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/tmpfiles-dev/dependencies.d/vkfs diff --git a/s6/sv/tmpfiles-dev/type b/s6/sv/tmpfiles-dev/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/tmpfiles-dev/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/tmpfiles-dev/up b/s6/sv/tmpfiles-dev/up new file mode 100644 index 0000000..84cea2a --- /dev/null +++ b/s6/sv/tmpfiles-dev/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ ReadWrite Mode ] 6/6 : Setting up tmpfiles" } +tmpfiles --prefix=/dev --create --boot diff --git a/s6/sv/tmpfiles-setup/dependencies.d/cleantmp b/s6/sv/tmpfiles-setup/dependencies.d/cleantmp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/tmpfiles-setup/dependencies.d/cleantmp diff --git a/s6/sv/tmpfiles-setup/dependencies.d/remount-root b/s6/sv/tmpfiles-setup/dependencies.d/remount-root new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/tmpfiles-setup/dependencies.d/remount-root diff --git a/s6/sv/tmpfiles-setup/dependencies.d/rofs b/s6/sv/tmpfiles-setup/dependencies.d/rofs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/tmpfiles-setup/dependencies.d/rofs diff --git a/s6/sv/tmpfiles-setup/type b/s6/sv/tmpfiles-setup/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/tmpfiles-setup/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/tmpfiles-setup/up b/s6/sv/tmpfiles-setup/up new file mode 100644 index 0000000..e694ec8 --- /dev/null +++ b/s6/sv/tmpfiles-setup/up @@ -0,0 +1,3 @@ +#!/bin/execlineb -P +if { s6-echo "[ ReadWrite Mode ] 5/6 : Cleaning tempfiles" } +tmpfiles --exclude-prefix=/dev --create --remove --boot diff --git a/s6/sv/udev/contents.d/udevadm b/s6/sv/udev/contents.d/udevadm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udev/contents.d/udevadm diff --git a/s6/sv/udev/contents.d/udevd b/s6/sv/udev/contents.d/udevd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udev/contents.d/udevd diff --git a/s6/sv/udev/dependencies.d/vkfs b/s6/sv/udev/dependencies.d/vkfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udev/dependencies.d/vkfs diff --git a/s6/sv/udev/type b/s6/sv/udev/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/udev/type @@ -0,0 +1 @@ +bundle diff --git a/s6/sv/udevadm/dependencies.d/mount-devfs b/s6/sv/udevadm/dependencies.d/mount-devfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udevadm/dependencies.d/mount-devfs diff --git a/s6/sv/udevadm/dependencies.d/mount-procfs b/s6/sv/udevadm/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udevadm/dependencies.d/mount-procfs diff --git a/s6/sv/udevadm/dependencies.d/mount-sysfs b/s6/sv/udevadm/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udevadm/dependencies.d/mount-sysfs diff --git a/s6/sv/udevadm/dependencies.d/udevd b/s6/sv/udevadm/dependencies.d/udevd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udevadm/dependencies.d/udevd diff --git a/s6/sv/udevadm/type b/s6/sv/udevadm/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/s6/sv/udevadm/type @@ -0,0 +1 @@ +oneshot diff --git a/s6/sv/udevadm/up b/s6/sv/udevadm/up new file mode 100644 index 0000000..8e77db2 --- /dev/null +++ b/s6/sv/udevadm/up @@ -0,0 +1,9 @@ +#!/bin/execlineb -P +# Initiate udev devices & subsystems +fdmove -c 2 1 +if { s6-echo "[ Read-Only Mode ] 9/9 : Setting up devices & subsystems" } +if { + foreground { udevadm trigger --action=add --type=subsystems } + foreground { udevadm trigger --action=add --type=devices } + udevadm settle +} diff --git a/s6/sv/udevd/dependencies.d/mount-devfs b/s6/sv/udevd/dependencies.d/mount-devfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udevd/dependencies.d/mount-devfs diff --git a/s6/sv/udevd/dependencies.d/mount-procfs b/s6/sv/udevd/dependencies.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udevd/dependencies.d/mount-procfs diff --git a/s6/sv/udevd/dependencies.d/mount-sysfs b/s6/sv/udevd/dependencies.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/udevd/dependencies.d/mount-sysfs diff --git a/s6/sv/udevd/run b/s6/sv/udevd/run new file mode 100644 index 0000000..552ab1d --- /dev/null +++ b/s6/sv/udevd/run @@ -0,0 +1,6 @@ +#!/bin/execlineb -P +# Initiate udev +fdmove -c 2 1 +if { s6-echo "[ Read-Only Mode ] 8/9 : Intializing udev daemon" } +exec -c +udevd diff --git a/s6/sv/udevd/type b/s6/sv/udevd/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/s6/sv/udevd/type @@ -0,0 +1 @@ +longrun diff --git a/s6/sv/vkfs/contents.d/mount-devfs b/s6/sv/vkfs/contents.d/mount-devfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/vkfs/contents.d/mount-devfs diff --git a/s6/sv/vkfs/contents.d/mount-efivars b/s6/sv/vkfs/contents.d/mount-efivars new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/vkfs/contents.d/mount-efivars diff --git a/s6/sv/vkfs/contents.d/mount-ksecurity b/s6/sv/vkfs/contents.d/mount-ksecurity new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/vkfs/contents.d/mount-ksecurity diff --git a/s6/sv/vkfs/contents.d/mount-procfs b/s6/sv/vkfs/contents.d/mount-procfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/vkfs/contents.d/mount-procfs diff --git a/s6/sv/vkfs/contents.d/mount-sysfs b/s6/sv/vkfs/contents.d/mount-sysfs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/s6/sv/vkfs/contents.d/mount-sysfs diff --git a/s6/sv/vkfs/type b/s6/sv/vkfs/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/s6/sv/vkfs/type @@ -0,0 +1 @@ +bundle diff --git a/tmpfiles b/tmpfiles new file mode 100755 index 0000000..5e4ee0a --- /dev/null +++ b/tmpfiles @@ -0,0 +1,592 @@ +#!/bin/sh +# This is a reimplementation of the systemd tmpfiles.d code +# Control creation, deletion, and cleaning of volatile and temporary files +# +# Copyright (c) 2012 Gentoo Foundation +# Released under the 2-clause BSD license. +# +# This instance is a pure-POSIX sh version, written by Robin H Johnson +# <robbat2@gentoo.org>, based on the Arch Linux version as of 2012/01/01: +# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles +# +# See the tmpfiles.d manpage as well: +# https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html +# This script should match the old manpage +# http://0pointer.de/public/systemd-man/tmpfiles.d.html +# as of 2012/03/12 and also implements some more recent features +# + +DRYRUN=0 + +checkprefix() { + n=$1 + shift + for x in "$@"; do + case ${n} in + ${x}*) return 0 ;; + esac + done + return 1 +} + +warninvalid() { + printf "tmpfiles: ignoring invalid entry on line %d of \`%s'\n" "${LINENUM}" "${FILE}" + error=$(( error+1 )) +} >&2 + +invalid_option() { + printf "tmpfiles: invalid option '%s'\n" "$1" >&2 + exit 1 +} + +dryrun_or_real() { + local dryrun= + if [ ${DRYRUN} -eq 1 ]; then + dryrun="echo" + fi + ${dryrun} "$@" +} + +_chattr() { + local attr="$2" + case ${attr} in + [+-=]*) : ;; + '') return ;; + *) attr="+${attr}" ;; + esac + local IFS= + dryrun_or_real chattr "$1" "${attr}" -- "$3" +} + +_setfacl() { + dryrun_or_real setfacl -P "$1" "$2" "$3" -- "$4" +} + +relabel() { + local path + local paths=$1 mode=$2 uid=$3 gid=$4 + local status + + status=0 + for path in ${paths}; do + if [ -e "${path}" ]; then + if [ -x /sbin/restorecon ]; then + dryrun_or_real restorecon ${CHOPTS} "${path}" || status="$?" + fi + if [ "${uid}" != '-' ]; then + dryrun_or_real chown ${CHOPTS} "${uid}" "${path}" || status="$?" + fi + if [ "${gid}" != '-' ]; then + dryrun_or_real chgrp ${CHOPTS} "${gid}" "${path}" || status="$?" + fi + if [ "${mode}" != '-' ]; then + dryrun_or_real chmod ${CHOPTS} "${mode}" "${path}" || status="$?" + fi + fi + done + return ${status} +} + +splitpath() { + local path=$1 + while [ -n "${path}" ]; do + printf '%s\n' "${path}" + path=${path%/*} + done +} + +_restorecon() { + local path=$1 + if [ -x /sbin/restorecon ]; then + dryrun_or_real restorecon -F "$(splitpath "${path}")" + fi +} + +createdirectory() { + local mode="$1" uid="$2" gid="$3" path="$4" + [ -d "${path}" ] || dryrun_or_real mkdir -p "${path}" + if [ "${uid}" = - ]; then + uid=root + fi + if [ "${gid}" = - ]; then + gid=root + fi + if [ "${mode}" = - ]; then + mode=0755 + fi + dryrun_or_real chown ${uid} "${path}" + dryrun_or_real chgrp ${gid} "${path}" + dryrun_or_real chmod ${mode} "${path}" +} + +createfile() { + local mode="$1" uid="$2" gid="$3" path="$4" + dryrun_or_real touch "${path}" + if [ "${uid}" = - ]; then + uid=root + fi + if [ "${gid}" = - ]; then + gid=root + fi + if [ "${mode}" = - ]; then + mode=0644 + fi + dryrun_or_real chown ${uid} "${path}" + dryrun_or_real chgrp ${gid} "${path}" + dryrun_or_real chmod ${mode} "${path}" +} + +createpipe() { + local mode="$1" uid="$2" gid="$3" path="$4" + dryrun_or_real mkfifo "${path}" + if [ "${uid}" = - ]; then + uid=root + fi + if [ "${gid}" = - ]; then + gid=root + fi + if [ "${mode}" = - ]; then + mode=0644 + fi + dryrun_or_real chown ${uid} "${path}" + dryrun_or_real chgrp ${gid} "${path}" + dryrun_or_real chmod ${mode} "${path}" +} + +_b() { + # Create a block device node if it doesn't exist yet + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 + if [ "${uid}" = - ]; then + uid=root + fi + if [ "${gid}" = - ]; then + gid=root + fi + if [ "${mode}" = - ]; then + mode=0644 + fi + if [ ! -e "${path}" ]; then + dryrun_or_real mknod -m ${mode} "${path}" b "${arg%:*}" "${arg#*:}" + _restorecon "${path}" + dryrun_or_real chown ${uid} "${path}" + dryrun_or_real chgrp ${gid} "${path}" + fi +} + +_c() { + # Create a character device node if it doesn't exist yet + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 + if [ "${uid}" = - ]; then + uid=root + fi + if [ "${gid}" = - ]; then + gid=root + fi + if [ "${mode}" = - ]; then + mode=0644 + fi + if [ ! -e "${path}" ]; then + dryrun_or_real mknod -m ${mode} "${path}" c "${arg%:*}" "${arg#*:}" + _restorecon "${path}" + dryrun_or_real chown ${uid} "${path}" + dryrun_or_real chgrp ${gid} "${path}" + fi +} + +_C() { + # recursively copy a file or directory + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 + if [ ! -e "${path}" ]; then + dryrun_or_real cp -r "${arg}" "${path}" + _restorecon "${path}" + if [ "${uid}" != '-' ]; then + dryrun_or_real chown "${uid}" "${path}" + fi + if [ "${gid}" != '-' ]; then + dryrun_or_real chgrp "${gid}" "${path}" + fi + if [ "${mode}" != '-' ]; then + dryrun_or_real chmod "${mode}" "${path}" + fi + fi +} + +_f() { + # Create a file if it doesn't exist yet + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 + + [ "${CREATE}" -gt 0 ] || return 0 + + if [ ! -e "${path}" ]; then + createfile "${mode}" "${uid}" "${gid}" "${path}" + if [ -n "${arg}" ]; then + _w "$@" + fi + fi +} + +_F() { + # Create or truncate a file + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 + + [ "${CREATE}" -gt 0 ] || return 0 + + dryrun_or_real rm -f "${path}" + createfile "${mode}" "${uid}" "${gid}" "${path}" + if [ -n "${arg}" ]; then + _w "$@" + fi +} + +_d() { + # Create a directory if it doesn't exist yet + local path=$1 mode=$2 uid=$3 gid=$4 + + if [ "${CREATE}" -gt 0 ]; then + createdirectory "${mode}" "${uid}" "${gid}" "${path}" + _restorecon "${path}" + fi +} + +_D() { + # Create or empty a directory + local path=$1 mode=$2 uid=$3 gid=$4 + + if [ -d "${path}" ] && [ "${REMOVE}" -gt 0 ]; then + dryrun_or_real find "${path}" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} + + _restorecon "${path}" + fi + + if [ "${CREATE}" -gt 0 ]; then + createdirectory "${mode}" "${uid}" "${gid}" "${path}" + _restorecon "${path}" + fi +} + +_v() { + # Create a subvolume if the path does not exist yet and the file system + # supports this (btrfs). Otherwise create a normal directory. + # TODO: Implement btrfs subvol creation. + _d "$@" +} + +_q() { + # Similar to _v. However, make sure that the subvolume will be assigned + # to the same higher-level quota groups as the subvolume it has + # been created in. + # TODO: Implement btrfs subvol creation. + _d "$@" +} + +_Q() { + # Similar to q. However, instead of copying the higher-level quota + # group assignments from the parent as-is, the lowest quota group + # of the parent subvolume is determined that is not the + # leaf quota group. + # TODO: Implement btrfs subvol creation. + _d "$@" +} + +_a() { + # Set/add file/directory ACL. Lines of this type accept + # shell-style globs in place of normal path names. + # The format of the argument field matches setfacl + local ACTION='--remove-all --set' + [ "${FORCE}" -gt 0 ] && ACTION='--modify' + _setfacl '' "${ACTION}" "$6" "$1" +} + +_A() { + # Recursively set/add file/directory ACL. Lines of this type accept + # shell-syle globs in place of normal path names. + # Does not follow symlinks + local ACTION='--remove-all --set' + [ "${FORCE}" -gt 0 ] && ACTION='--modify' + _setfacl -R "${ACTION}" "$6" "$1" +} + +_h() { + # Set file/directory attributes. Lines of this type accept + # shell-style globs in place of normal path names. + # The format of the argument field matches chattr + _chattr '' "$6" "$1" +} + +_H() { + # Recursively set file/directory attributes. Lines of this type accept + # shell-syle globs in place of normal path names. + # Does not follow symlinks + _chattr -R "$6" "$1" +} + +_L() { + # Create a symlink if it doesn't exist yet + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 + if [ ! -e "${path}" ]; then + dryrun_or_real ln -s "${arg}" "${path}" + fi + _restorecon "${path}" +} + +_p() { + # Create a named pipe (FIFO) if it doesn't exist yet + local path=$1 mode=$2 uid=$3 gid=$4 + + [ "${CREATE}" -gt 0 ] || return 0 + + if [ ! -p "${path}" ]; then + createpipe "${mode}" "${uid}" "${gid}" "${path}" + fi +} + +_x() { + # Ignore a path during cleaning. Use this type to exclude paths from clean-up as + # controlled with the Age parameter. Note that lines of this type do not + # influence the effect of r or R lines. Lines of this type accept shell-style + # globs in place of of normal path names. + : + # XXX: we don't implement this +} + +_X() { + # Ignore a path during cleanup. Use this type to prevent path + # removal as controled with the age parameter. Note that if path is + # a directory, the content of the directory is not excluded from + # clean-up, only the directory itself. + # Lines of this type accept shell-style globs in place of normal path names. + : + # XXX: we don't implement this +} + +_r() { + # Remove a file or directory if it exists. This may not be used to remove + # non-empty directories, use R for that. Lines of this type accept shell-style + # globs in place of normal path names. + local path + local paths=$1 + local status + + [ "${REMOVE}" -gt 0 ] || return 0 + + status=0 + for path in ${paths}; do + if [ -f "${path}" ]; then + dryrun_or_real rm -f "${path}" || status="$?" + elif [ -d "${path}" ]; then + dryrun_or_real rmdir "${path}" || status="$?" + fi + done + return ${status} +} + +_R() { + # Recursively remove a path and all its subdirectories (if it is a directory). + # Lines of this type accept shell-style globs in place of normal path names. + local path + local paths=$1 + local status + + [ "${REMOVE}" -gt 0 ] || return 0 + + status=0 + for path in ${paths}; do + if [ -d "${path}" ]; then + dryrun_or_real rm -rf --one-file-system "${path}" || status="$?" + fi + done + return ${status} +} + +_w() { + # Write the argument parameter to a file, if it exists. + local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 + if [ -f "${path}" ]; then + if [ ${DRYRUN} -eq 1 ]; then + echo "echo \"${arg}\" >>\"${path}\"" + else + echo "${arg}" >>"${path}" + fi + fi +} + +_z() { + # Set ownership, access mode and relabel security context of a file or + # directory if it exists. Lines of this type accept shell-style globs in + # place of normal path names. + [ "${CREATE}" -gt 0 ] || return 0 + + relabel "$@" +} + +_Z() { + # Recursively set ownership, access mode and relabel security context of a + # path and all its subdirectories (if it is a directory). Lines of this type + # accept shell-style globs in place of normal path names. + [ "${CREATE}" -gt 0 ] || return 0 + + CHOPTS=-R relabel "$@" +} + +usage() { + printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}" + exit "${1:-0}" +} + +version() { + # We don't record the version info anywhere currently. + echo "opentmpfiles" + exit 0 +} + +BOOT=0 CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0 +EXCLUDE= +PREFIX= +FILES= + +while [ $# -gt 0 ]; do + case $1 in + --boot) BOOT=1 ;; + --create) CREATE=1 ;; + --remove) REMOVE=1 ;; + --clean) CLEAN=1 ;; # TODO: Not implemented + --verbose) VERBOSE=1 ;; + --dryrun|--dry-run) DRYRUN=1 ;; + --exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;; + --prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;; + -h|--help) usage ;; + --version) version ;; + -*) invalid_option "$1" ;; + *) FILES="${FILES} $1" + esac + shift +done + +if [ $(( CLEAN )) -eq 1 ] ; then + printf '%s clean mode is not implemented\n' "${0##*/}" + exit 1 +fi + +if [ "${CREATE}${REMOVE}" = '00' ]; then + usage 1 >&2 +fi + +# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream +tmpfiles_dirs='/usr/lib/tmpfiles.d /run/tmpfiles.d /etc/tmpfiles.d' +tmpfiles_basenames='' + +if [ -z "${FILES}" ]; then + # Build a list of sorted unique basenames + # directories declared later in the tmpfiles_d array will override earlier + # directories, on a per file basename basis. + # `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'. + # `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf' + for d in ${tmpfiles_dirs} ; do + [ -d "${d}" ] && for f in "${d}"/*.conf ; do + case "${f##*/}" in + systemd.conf|systemd-*.conf) continue;; + esac + [ -f "${f}" ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}" + done # for f in ${d} + done # for d in ${tmpfiles_dirs} + # shellcheck disable=SC2059 + FILES="$(printf "${tmpfiles_basenames}" | sort -u )" +fi + +tmpfiles_d='' + +for b in ${FILES} ; do + if [ "${b##*/}" != "${b}" ]; then + # The user specified a path on the command line + # Just pass it through unaltered + tmpfiles_d="${tmpfiles_d} ${b}" + else + real_f='' + for d in ${tmpfiles_dirs} ; do + f=${d}/${b} + [ -f "${f}" ] && real_f=${f} + done + [ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}" + fi +done + +error=0 + +# loop through the gathered fragments, sorted globally by filename. +# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf' +FILE= +for FILE in ${tmpfiles_d} ; do + LINENUM=0 + + ### FILE FORMAT ### + # XXX: We ignore the 'Age' parameter + # 1 2 3 4 5 6 7 + # Cmd Path Mode UID GID Age Argument + # d /run/user 0755 root root 10d - + # Mode, UID, GID, Age, Argument may be omitted! + # If Cmd ends with !, the line is only processed if --boot is passed + + # XXX: Upstream says whitespace is NOT permitted in the Path argument. + # But IS allowed when globs are expanded for the x/r/R/z/Z types. + while read -r cmd path mode uid gid age arg rest; do + LINENUM=$(( LINENUM+1 )) + FORCE=0 + + # Unless we have both command and path, skip this line. + if [ -z "${cmd}" ] || [ -z "${path}" ]; then + continue + fi + + case ${cmd} in + \#*) continue ;; + esac + + while [ ${#cmd} -gt 1 ]; do + case ${cmd} in + *!) cmd=${cmd%!}; [ "${BOOT}" -eq "1" ] || continue 2 ;; + *+) cmd=${cmd%+}; FORCE=1; ;; + *) warninvalid ; continue 2 ;; + esac + done + + # whine about invalid entries + case ${cmd} in + f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z|q|Q|h|H|a|A) ;; + *) warninvalid ; continue ;; + esac + + # fall back on defaults when parameters are passed as '-' + if [ "${mode}" = '-' ] || [ "${mode}" = '' ]; then + case "${cmd}" in + p|f|F) mode=0644 ;; + d|D|v) mode=0755 ;; + C|z|Z|x|r|R|L) ;; + esac + fi + + [ "${uid}" = '-' ] || [ "${uid}" = '' ] && uid=0 + [ "${gid}" = '-' ] || [ "${gid}" = '' ] && gid=0 + [ "${age}" = '-' ] || [ "${age}" = '' ] && age=0 + [ "${arg}" = '-' ] || [ "${arg}" = '' ] && arg='' + set -- "${path}" "${mode}" "${uid}" "${gid}" "${age}" "${arg}" + + [ -n "${EXCLUDE}" ] && checkprefix "${path}" "${EXCLUDE}" && continue + [ -n "${PREFIX}" ] && ! checkprefix "${path}" "${PREFIX}" && continue + + if [ "${FORCE}" -gt 0 ]; then + case ${cmd} in + p|L|c|b) [ -f "${path}" ] && dryrun_or_real rm -f "${path}" + esac + fi + + [ "${VERBOSE}" -eq "1" ] && echo "_${cmd}" "$@" + "_${cmd}" "$@" + rc=$? + if [ "${DRYRUN}" -eq "0" ]; then + [ ${rc} -ne 0 ] && error=$((error + 1)) + fi + done <"${FILE}" +done + +exit ${error} + +# vim: set ts=2 sw=2 sts=2 noet ft=sh: diff --git a/vconsole.conf b/vconsole.conf new file mode 100644 index 0000000..27f787d --- /dev/null +++ b/vconsole.conf @@ -0,0 +1 @@ +FONT=ter-i12n |