[PC-BSD Commits] r4817 - in pcbsd/trunk/pc-sysinstall: . backend

svn at pcbsd.org svn at pcbsd.org
Thu Oct 29 13:22:35 PST 2009


Author: kris
Date: 2009-10-29 14:22:35 -0700 (Thu, 29 Oct 2009)
New Revision: 4817

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh
   pcbsd/trunk/pc-sysinstall/backend/functions.sh
   pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh
   pcbsd/trunk/pc-sysinstall/pcinstall.cfg
Log:

Added support for rootPass= command, and fixed up gjournaling w/ geli, works nicely now

Also bugfixed a few file checks



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh	2009-10-29 20:47:57 UTC (rev 4816)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh	2009-10-29 21:22:35 UTC (rev 4817)
@@ -28,12 +28,12 @@
   if [ ! -z "${FOUNDZFS}" ]
   then
     # Check if we need to add our ZFS flags to rc.conf, src.conf and loader.conf
-    cat ${FSMNT}/boot/loader.conf >/dev/null 2>/dev/null | grep 'zfs_load="YES"' >/dev/null 2>/dev/null
+    cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep 'zfs_load="YES"' >/dev/null 2>/dev/null
     if [ "$?" != "0" ]
     then
       echo 'zfs_load="YES"' >>${FSMNT}/boot/loader.conf
     fi
-    cat ${FSMNT}/etc/rc.conf >/dev/null 2>/dev/null | grep 'zfs_enable="YES"' >/dev/null 2>/dev/null
+    cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep 'zfs_enable="YES"' >/dev/null 2>/dev/null
     if [ "$?" != "0" ]
     then
       echo 'zfs_enable="YES"' >>${FSMNT}/etc/rc.conf
@@ -87,6 +87,8 @@
       fi
       if [ "${PARTFS}" = "UFS+J" ]
       then
+        # Make sure geom_journal is loaded
+        setup_gjournal
         EXT="${EXT}.journal"
       fi
       if [ "${PARTFS}" = "SWAP" ]
@@ -125,7 +127,7 @@
   done
 
   
-  cat ${FSMNT}/boot/loader.conf >/dev/null 2>/dev/null | grep 'geom_mirror_load="YES"' >/dev/null 2>/dev/null
+  cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep 'geom_mirror_load="YES"' >/dev/null 2>/dev/null
   if [ "$?" != "0" ]
   then
     echo 'geom_mirror_load="YES"' >>${FSMNT}/boot/loader.conf
@@ -156,7 +158,7 @@
   done
 
   # Make sure we have geom_eli set to load at boot
-  cat ${FSMNT}/boot/loader.conf >/dev/null 2>/dev/null | grep 'geom_eli_load="YES"' >/dev/null 2>/dev/null
+  cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep 'geom_eli_load="YES"' >/dev/null 2>/dev/null
   if [ "$?" != "0" ]
   then
     echo 'geom_eli_load="YES"' >>${FSMNT}/boot/loader.conf
@@ -203,6 +205,39 @@
 };
 
 
+# Check and make sure geom_journal is enabled on the system
+setup_gjournal()
+{
+
+  # Make sure we have geom_journal set to load at boot
+  cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep 'geom_journal_load="YES"' >/dev/null 2>/dev/null
+  if [ "$?" != "0" ]
+  then
+    echo 'geom_journal_load="YES"' >>${FSMNT}/boot/loader.conf
+  fi
+
+};
+
+# Function which sets the root password from the install config
+set_root_pw()
+{
+  get_value_from_cfg rootPass
+  PW="${VAL}"
+
+  # If we don't have a root pass, return
+  if [ -z "${PW}" ]
+  then
+    return 0
+  fi
+
+  echo_log "Setting root password"
+  echo "${PW}" > ${FSMNT}/.rootpw
+  run_chroot_cmd "cat /.rootpw | pw usermod root -h 0"
+  rc_halt "rm ${FSMNT}/.rootpw"
+
+};
+
+
 run_final_cleanup()
 {
 
@@ -231,4 +266,7 @@
  # Set a hostname on the install system
  setup_hostname
 
+ # Set the root_pw if it is specified
+ set_root_pw
+
 };

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh	2009-10-29 20:47:57 UTC (rev 4816)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh	2009-10-29 21:22:35 UTC (rev 4817)
@@ -78,7 +78,9 @@
               ;;
        UFS+J) echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
               rc_halt "newfs /dev/${PART}${EXT}"
+              sleep 2
               rc_halt "gjournal label -f /dev/${PART}${EXT}"
+              sleep 2
               rc_halt "newfs -O 2 -J /dev/${PART}${EXT}.journal"
               ;;
          ZFS) echo_log "NEWFS: /dev/${PART} - ${PARTFS}" 

Modified: pcbsd/trunk/pc-sysinstall/backend/functions.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions.sh	2009-10-29 20:47:57 UTC (rev 4816)
+++ pcbsd/trunk/pc-sysinstall/backend/functions.sh	2009-10-29 21:22:35 UTC (rev 4817)
@@ -101,9 +101,10 @@
 
   echo "Running: ${CMD}" >>${LOGOUT}
   ${CMD} >>${LOGOUT} 2>>${LOGOUT}
-  if [ "$?" != "0" ]
+  STATUS="$?"
+  if [ "${STATUS}" != "0" ]
   then
-    exit_err "Error $?"
+    exit_err "Error ${STATUS}: ${CMD}"
   fi
 };
 
@@ -119,9 +120,10 @@
 
   echo "Running: ${CMD}" >>${LOGOUT}
   ${CMD} 2>&1 | tee -a ${LOGOUT} 
-  if [ "$?" != "0" ]
+  STATUS="$?"
+  if [ "$STATUS" != "0" ]
   then
-    exit_err "Error $?: $CMD"
+    exit_err "Error ${STATUS}: $CMD"
   fi
 
 };

Modified: pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh	2009-10-29 20:47:57 UTC (rev 4816)
+++ pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh	2009-10-29 21:22:35 UTC (rev 4817)
@@ -96,6 +96,9 @@
   # Unmount and finish up
   unmount_all_filesystems
 
+  echo_log "Installation finished!"
+  exit 0
+
 else
   # We're going to do an upgrade, skip all the disk setup 
   # and start by mounting the target drive/slice

Modified: pcbsd/trunk/pc-sysinstall/pcinstall.cfg
===================================================================
--- pcbsd/trunk/pc-sysinstall/pcinstall.cfg	2009-10-29 20:47:57 UTC (rev 4816)
+++ pcbsd/trunk/pc-sysinstall/pcinstall.cfg	2009-10-29 21:22:35 UTC (rev 4817)
@@ -1,8 +1,8 @@
 # Sample configuration file for an installation using pc-sysinstall
 
 installMode=fresh
-installInteractive=yes
-hostname=pcbsd8
+installInteractive=no
+hostname=freebsd8
 
 # Set the disk parameters
 disk0=ad0
@@ -16,7 +16,7 @@
 # UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli
 disk0-part=UFS+S 500 /
 disk0-part=SWAP.eli 2000 none
-disk0-part=UFS+S.eli 0 /usr
+disk0-part=UFS+J.eli 0 /usr
 # Size 0 means use the rest of the slice size
 # Do it now!
 commitDiskLabel
@@ -32,10 +32,13 @@
 commitInstall
 
 # Run any commands post-install
-runCommand=echo 'root' | pw usermod root -h 0
+#runCommand=echo 'root' | pw usermod root -h 0
 #runScript=/root/test.sh
 #runExtCommand=echo 'hey there'; touch $FSMNT/touched
 
+# Set the root pass
+rootPass=root
+
 #autoLoginUser=kris
 
 # Options for localizing an install



More information about the Commits mailing list