Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # vim: set ts=4 sw=4 et:
- PATH=/usr/bin:/usr/sbin
- msg() {
- # bold
- printf "\033[1m=> $@\033[m\n"
- }
- emergency_shell() {
- echo
- echo "Cannot continue due to errors above, starting emergency shell."
- echo "When ready type exit to continue booting."
- /bin/sh -l
- }
- msg "Welcome to Void!"
- msg "Mounting pseudo-filesystems..."
- mountpoint -q /proc || mount -o nosuid,noexec,nodev -t proc proc /proc
- mountpoint -q /sys || mount -o nosuid,noexec,nodev -t sysfs sys /sys
- mountpoint -q /run || mount -o mode=0755,nosuid,nodev,size=10% -t tmpfs run /run
- mountpoint -q /dev || mount -o mode=0755,nosuid -t devtmpfs dev
- mkdir -p -m0755 /run/runit /run/lvm /run/user /dev/pts /dev/shm
- mountpoint -q /dev/pts || mount -o mode=0620,gid=5,nosuid,noexec -n -t devpts devpts /dev/pts
- mountpoint -q /dev/shm || mount -o mode=1777,nosuid,nodev -n -t tmpfs shm /dev/shm
- msg "Starting udev and waiting for devices to settle..."
- udevd --daemon
- udevadm trigger --action=add --type=subsystems
- udevadm trigger --action=add --type=devices
- udevadm settle
- msg "Setting up keymap..."
- loadkeys -q -u /etc/mykeymap.map
- msg "Remounting rootfs read-only..."
- mount -o remount,ro / || emergency_shell
- msg "Checking filesystems:"
- fsck -A -T -a -t noopts=_netdev
- msg "Mounting rootfs read-write..."
- mount -o remount,rw / || emergency_shell
- msg "Mounting all non-network filesystems..."
- mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev || emergency_shell
- msg "Initializing swap..."
- swapon -a || emergency_shell
- msg "Initializing random seed..."
- cp /var/lib/random-seed /dev/urandom >/dev/null 2>&1 || true
- ( umask 077; bytes=$(cat /proc/sys/kernel/random/poolsize) || bytes=512; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes >/dev/null 2>&1 )
- msg "Setting up loopback interface..."
- ip link set up dev lo
- msg "Setting up hostname..."
- cat /etc/hostname > /proc/sys/kernel/hostname
- msg "Setting up timezone to America/New_York..."
- ln -sf "/usr/share/zoneinfo/America/New_York" /etc/localtime
- install -m0664 -o root -g utmp /dev/null /run/utmp
- install -m0664 -o root -g utmp /dev/null /var/log/wtmp
- install -m0600 -o root -g utmp /dev/null /var/log/btmp
- install -dm1777 /tmp/.X11-unix /tmp/.ICE-unix
- dmesg >/var/log/dmesg.log
- chmod 0644 /var/log/dmesg.log
- mkdir -p /run/runit
- install -m100 /dev/null /run/runit/stopit
- msg "Initialization complete, running stage 2..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement