#!/bin/sh klogd -c1 # TODO: This should be even earlier. Can it go on the kernel command line? . common.sh debug_log samizdat.init my_configure_networking() { configure_networking > /dev/tty1 if [ -e /run/net-"$DEVICE".conf ] then . /run/net-"$DEVICE".conf printf 'Note: configure_networking: ROOTSERVER=%s\n', "$ROOTSERVER" >&2 else false fi } read_nbd_variables() { NBDCLIENT=: . /scripts/local-top/nbd unset NBDCLIENT } run_nbd_client() { (debug_log samizdat.nbd read_nbd_variables for DEVNAME in /dev/nbd0 /dev/nbd1 do case "$DEVNAME" in /dev/nbd0) nbdpath=samizdat.btrfs ;; /dev/nbd1) nbdpath=samizdat.patch.btrfs ;; esac nbd-client $nbdsrv -N $nbdpath $nbdport $DEVNAME -swap -persist -systemd-mark done bootdone nbd-script) } write_resolv_dot_conf() { if [ "$IPV4DNS0" != '0.0.0.0' ]; then printf '%s\n' "$IPV4DNS0" "$IPV4DNS1" | sed -e '/^0.0.0.0$/d; s/^/nameserver /' > /root/etc/resolv.conf fi } get_os_name() { [ -r /root/etc/os-release ] && . /root/etc/os-release echo -n ${PRETTY_NAME:-Debian GNU/Linux} } mountroot() { openvt -c 13 sh mkfifo "$MENUFIFO" if [ "$nbdroot" ]; then my_configure_networking run_nbd_client wait_for_gnupghome_tar (sleep 5; echo ) & (. common.sh && . btrfs-create.sh && init_gpg) fi bootmenu samizdat_install_udev_rules bootwait samizdat-gpg bootwait root-mounted osname=$(get_os_name) write_resolv_dot_conf chvt 1 cat >/dev/tty1 < /dev/tty1 (while ! tftp -g -r gnupghome.tar -l /gnupghome.tar.$$ "$ROOTSERVER" 2>/run/initramfs/samizdat/log/tftp.$$.log; do sleep 1; echo -n . > /dev/tty1 done mv /gnupghome.tar.$$ /gnupghome.tar) echo ' done.' > /dev/tty1 bootdone gnupg-tar } samizdat_restart_udev() { local LOG_DIR=/run/initramfs/samizdat/log mkdir -p "$LOG_DIR" killall systemd-udevd 2>/dev/null /lib/systemd/systemd-udevd --resolve-names=never --debug >$LOG_DIR/udevd-systemd.log 2>&1 & udevadm hwdb --update # rule is not executed by 'udevadm trigger' otherwise. not sure why }