#!/bin/bash # # This is a script to run at startup of a bespoke sub-host date +"subhost startup at %Y%m%d-%H%M%S" mkdir -p /dev/pts /dev/shm /run [ -f /proc/mounts ] || mount -t proc proc /proc if ! grep "^none /run tmpfs" /proc/mounts ; then mount -t tmpfs -osize=80M none /run mount -t tmpfs -osize=20M none /dev/shm mount -t devpts none /dev/pts mount -t sysfs none /sys mkdir -p /run/lock /run/user fi if grep -q ' / ext4 rw,' /proc/mounts ; then ## ## Here's the "pretend init" ## zombie() { wait true # echo "zombie return $?" >&2 } trap "zombie" 17 # SIGCHILD /etc/init.d/rc S < /dev/null /etc/init.d/rc 2 < /dev/null SUBHOSTCTL=/run/initctl mkfifo $SUBHOSTCTL exec cat < $SUBHOSTCTL #exec /bin/bash -i else echo "** The root filesystem is read-only; EXITING" >&2 exit 1 fi