Advertisement
unixwz0r

rc.local (bsdbox 2.0)

Feb 12th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.52 KB | None | 0 0
  1. #!/bin/sh
  2. # $FreeBSD: release/10.2.0/release/rc.local 272309 2014-09-30 16:36:50Z emaste $
  3.  
  4. BSDBOX="/usr/share/bsdbox-2.0/bbinst"
  5. PATH_FSTAB="/tmp/bsdinstall_etc/fstab" #  FStab file to make partedit work
  6.  
  7. MACHINE=`uname -m`
  8.  
  9. # resolv.conf from DHCP ends up in here, so make sure the directory exists
  10. mkdir /tmp/bsdinstall_etc
  11.  
  12. kbdcontrol -d >/dev/null 2>&1
  13. if [ $? -eq 0 ]; then
  14.     # Syscons: use xterm, start interesting things on other VTYs
  15.     if [ ${MACHINE} = "pc98" ]; then
  16.         TERM=cons25w
  17.     else
  18.         TERM=xterm
  19.     fi
  20.  
  21.     # Don't send ESC on function-key 62/63 (left/right command key)
  22.     kbdcontrol -f 62 '' > /dev/null 2>&1
  23.     kbdcontrol -f 63 '' > /dev/null 2>&1
  24.  
  25.     if [ -z "$EXTERNAL_VTY_STARTED" ]; then
  26.         # Init will clean these processes up if/when the system
  27.         # goes multiuser
  28.         touch /tmp/bsdinstall_log
  29.         tail -f /tmp/bsdinstall_log > /dev/ttyv2 &
  30.         /usr/libexec/getty autologin ttyv3 &
  31.         EXTERNAL_VTY_STARTED=1
  32.     fi
  33. else
  34.     # Serial or other console
  35.     echo
  36.     echo "Welcome to `uname`!"
  37.     echo
  38.     echo "Please choose the appropriate terminal type for your system."
  39.     echo "Common console types are:"
  40.     echo "   ansi     Standard ANSI terminal"
  41.     echo "   vt100    VT100 or compatible terminal"
  42.     echo "   xterm    xterm terminal emulator (or compatible)"
  43.     echo "   cons25w  cons25w terminal"
  44.     echo
  45.     echo -n "Console type [vt100]: "
  46.     read TERM
  47.     TERM=${TERM:-vt100}
  48. fi
  49. export TERM
  50.  
  51. while true  
  52. do
  53.     echo
  54.     echo
  55.     echo "Welcome to BSDBox Install"
  56.     echo
  57.     echo "You have these choices to choose from"
  58.     echo
  59.     echo "1. Install FreeBSD-10.3-RELEASE."
  60.     echo "2. Install BSDBox 2.0"
  61.     echo "3. Live filesystem"
  62.     echo
  63.     echo "4. Reboot"
  64.     echo "5. Halt"
  65.     echo
  66.     echo
  67.  
  68.     echo -n "Press 1 - 5 to select an option: "
  69.     read Options
  70.  
  71.       case $Options in
  72.    
  73.     1)
  74.         # if not netbooting, have the installer configure the network
  75.         # This will make DHCP work
  76.        
  77.        
  78.             dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
  79.             if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then
  80.                   BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT
  81.             fi
  82.    
  83.  
  84.         trap true sigint  # trap control+c
  85.         bsdinstall
  86.     ;;
  87.    
  88.     2)
  89.        echo "entering the BSDBox installer"
  90.        echo "Exit to return"
  91.        echo
  92.        $BSDBOX
  93.     ;;
  94.    
  95.     3)
  96.         echo "Continuing to Live filesystem"
  97.         exit
  98.     ;;
  99.    
  100.     4)
  101.         echo "Rebooting"
  102.         sleep 2
  103.         reboot
  104.     ;;
  105.    
  106.     5)
  107.       echo "Halting"
  108.       sleep 2
  109.       halt
  110.     ;;
  111.     esac
  112. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement