[PC-BSD Commits] r4816 - pcbsd/trunk/pc-sysinstall/backend

svn at pcbsd.org svn at pcbsd.org
Thu Oct 29 12:47:57 PST 2009


Author: kris
Date: 2009-10-29 13:47:57 -0700 (Thu, 29 Oct 2009)
New Revision: 4816

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
Log:

Fixed a few bugs, and added host-name support to our installer backend, plus the
ability to generate a random hostname



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh	2009-10-29 19:50:09 UTC (rev 4815)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh	2009-10-29 20:47:57 UTC (rev 4816)
@@ -164,6 +164,45 @@
 
 };
 
+
+# Function to generate a random hostname if none was specified
+gen_hostname()
+{
+  RAND="`jot -r 1 1 9000`"
+
+  if [ "$INSTALLTYPE" = "FreeBSD" ]
+  then
+    VAL="freebsd-${RAND}" 
+  else
+    VAL="pcbsd-${RAND}" 
+  fi
+
+  export VAL
+
+};
+
+# Function which sets up the hostname for the system
+setup_hostname()
+{
+
+  get_value_from_cfg hostname
+  HOSTNAME="${VAL}"
+
+  # If we don't have a hostname, make one up
+  if [ -z "${HOSTNAME}" ]
+  then
+    gen_hostname
+    HOSTNAME="${VAL}"
+  fi
+
+  # Set the hostname now
+  echo_log "Setting hostname: ${HOSTNAME}"
+  echo "hostname=\"${HOSTNAME}\"" >> ${FSMNT}/etc/rc.conf
+  sed -i -e "s|my.domain|${HOSTNAME} ${HOSTNAME}|g" ${FSMNT}/etc/hosts
+
+};
+
+
 run_final_cleanup()
 {
 
@@ -189,4 +228,7 @@
  # Check if we need to setup any ZFS  
  zfs_cleanup 
 
+ # Set a hostname on the install system
+ setup_hostname
+
 };

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh	2009-10-29 19:50:09 UTC (rev 4815)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh	2009-10-29 20:47:57 UTC (rev 4816)
@@ -192,7 +192,7 @@
 
   #Erase any existing bootloader
   echo_log "Wiping ${DISK} with dd"
-  run_halt "dd if=/dev/zero of=/dev/${DISK} count=2048"
+  rc_halt "dd if=/dev/zero of=/dev/${DISK} count=2048"
 
   sleep 2
 

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2009-10-29 19:50:09 UTC (rev 4815)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2009-10-29 20:47:57 UTC (rev 4816)
@@ -133,7 +133,6 @@
               if [ "$PARTENC" = "ON" ]
               then
                 echo_log "Enabling encrypted swap on /dev/${PART}"
-                rc_nohalt "dd if=/dev/random of=/dev/${PART} bs=1m"
                 rc_halt "geli onetime -d -e 3des ${PART}"
                 rc_halt "swapon /dev/${PART}.eli"
               else



More information about the Commits mailing list