#!/bin/bash
# Setup critical hurd translators

PATH=/bin:/sbin

# BOOT_DEV="$1"
# if [ ! "$BOOT_DEV" ]; then
#   echo "No device to install a boot loader was specified."
#   echo "Here are some possible devices to use:"
#   /bin/devprobe sd0 hd0 sd1 hd1
#   echo -n "Boot device? [none] "
#   read BOOT_DEV
# fi
# 
# if [ "$BOOT_DEV" ]; then
#   if /bin/devprobe -s "$BOOT_DEV"; then true; else
#     echo 2>&1 "$0: $BOOT_DEV: No such device known"; exit 1
#   fi
# fi

set -v

# Make sure the filesystem is writable
fsysopts / --writable 

# Set up standard passive translators
/bin/settrans -c /servers/socket/local /hurd/pflocal
/bin/settrans -c /servers/crash /hurd/crash
/bin/settrans -c /servers/password /hurd/password

# Setup crucial devices
cd /dev
/bin/sh ./MAKEDEV std ptyp ptyq

set +v

# if test "$BOOT_DEV" && /bin/sh ./MAKEDEV "$BOOT_DEV"; then
#   echo -n "Install grub as main boot record on $BOOT_DEV? [y] "
#   read yn
#   case "$yn" in
#     "" | "[yY]*")
#       /bin/sh /INSTALL-GRUB-MBR /dev/$BOOT_DEV;;
#   esac
# fi

echo 'Hit ^C now for shell prompt or RET to reboot'
read response
sync
reboot
