[PC-BSD Commits] r5088 - in pcbsd/trunk/pc-sysinstall: backend examples

svn at pcbsd.org svn at pcbsd.org
Thu Nov 19 07:44:37 PST 2009


Author: kris
Date: 2009-11-19 07:44:37 -0800 (Thu, 19 Nov 2009)
New Revision: 5088

Modified:
   pcbsd/trunk/pc-sysinstall/backend/startautoinstall.sh
   pcbsd/trunk/pc-sysinstall/examples/pc-autoinstall.conf
Log:

Added few more options to pc-sysinstall for automated installation support



Modified: pcbsd/trunk/pc-sysinstall/backend/startautoinstall.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/startautoinstall.sh	2009-11-19 10:03:48 UTC (rev 5087)
+++ pcbsd/trunk/pc-sysinstall/backend/startautoinstall.sh	2009-11-19 15:44:37 UTC (rev 5088)
@@ -20,15 +20,18 @@
 
 # Check if the config file is on disk as well
 PC-CFG=`grep "pc_config:" ${CONF} | grep -v "^#" | cut -d ':' -f 2 | tr -d ' '`
+SHUTDOWN_CMD=`grep "shutdown_cmd:" ${CONF} | grep -v "^#" | sed "s|shutdown_cmd: ||g" | sed "s|shutdown_cmd:||g"`
+SHUTDOWN_CMD=`grep "shutdown_cmd:" ${CONF} | grep -v "^#" | sed "s|shutdown_cmd: ||g" | sed "s|shutdown_cmd:||g"`
+CONFIRM_INS=`grep "confirm_install:" ${CONF} | grep -v "^#" | sed "s|confirm_install: ||g" | sed "s|confirm_install:||g"`
 
 # Check that this isn't a http / ftp file we need to fetch later
 echo "${PC-CFG}" | grep -e "^http" -e "^ftp" > /dev/null 2>/dev/null
 if [ "$?" != "0" ]
 then
   # Make sure we have the file which was copied into /tmp previously
-  if [ ! -e "/tmp/pc-sysinstall.cfg" ]
+  if [ ! -e "${INSTALL_CFG}" ]
   then
-    echo "Error: /tmp/pc-sysinstall.cfg is missing! Continuing in 10 seconds..."
+    echo "Error: ${INSTALL_CFG} is missing! Continuing in 10 seconds..."
     sleep 10
     exit 150
   fi
@@ -52,22 +55,32 @@
   fi
 
   # Now try to fetch the remove file
-  echo "Fetching cfg with: \"curl -o /tmp/pc-sysinstall.cfg ${PC-CFG}\""
-  curl -o /tmp/pc-sysinstall.cfg ${PC-CFG}
+  echo "Fetching cfg with: \"curl -o ${INSTALL_CFG} ${PC-CFG}\""
+  curl -o "${INSTALL_CFG}" "${PC-CFG}"
 
 fi
 
+# If we end up with a valid config, lets proccede
 if [ -e "${INSTALL_CFG}" ]
 then
+  
+  if [ "${CONFIRM_INS}" != "no" -a "${CONFIRM_INS}" != "NO" ]
+  then
+    echo "Press ENTER to begin automated installation. Warning: Data on target disks may be destroyed!"
+    read tmp
+  fi
 
-  echo "Press ENTER to begin automated installation. Warning: Data on disks may be destroyed!"
-  read tmp
-
   ${PROGDIR}/pc-sysinstall -c ${INSTALL_CFG}
   if [ "$?" = "0" ]
   then
-    echo "SUCCESS: Installation finished, press ENTER to reboot." 
-    shutdown -r now
+    if [ ! -z "$SHUTDOWN_CMD" ]
+    then
+      ${SHUTDOWN_CMD}
+    else 
+      echo "SUCCESS: Installation finished! Press ENTER to rebooot." 
+      read tmp
+      shutdown -r now
+    fi
   else 
     echo "ERROR: Installation failed, press ENTER to drop to shell."
     read tmp

Modified: pcbsd/trunk/pc-sysinstall/examples/pc-autoinstall.conf
===================================================================
--- pcbsd/trunk/pc-sysinstall/examples/pc-autoinstall.conf	2009-11-19 10:03:48 UTC (rev 5087)
+++ pcbsd/trunk/pc-sysinstall/examples/pc-autoinstall.conf	2009-11-19 15:44:37 UTC (rev 5088)
@@ -17,7 +17,17 @@
 # pc_config: http://192.168.0.2/cust-install.cfg
 # pc_config: /boot/cust-install.cfg
 
+# Set this to yes if we should confirm before doing an install
+# This should normally be set to yes, otherwise booting the wrong
+# disk will result in a system wipe
+# confirm_install: no 
+confirm_install: yes
 
+# Set the command to run post-install, usually best to run shutdown
+# but this can be replaced with any other command / script you wish
+# to execute post-install
+# shutdown_cmd: shutdown -p now
+
 # Options for the network setup, should the cfg need to be fetched
 # from a remote location, only necessary when using ftp or http
 ##################################################################



More information about the Commits mailing list