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

svn at pcbsd.org svn at pcbsd.org
Thu Oct 1 11:01:36 PDT 2009


Author: kris
Date: 2009-10-01 11:01:36 -0700 (Thu, 01 Oct 2009)
New Revision: 4577

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh
   pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh
   pcbsd/trunk/pc-sysinstall/conf/sample-install.cfg
   pcbsd/trunk/pc-sysinstall/pcinstall.cfg
Log:

Updated the pc-sysinstall backend further

Changed how the config file indicates disk / slices, and partitions, now
you can simply update disk0=ad0 -> disk0=da0 without needing to change
the rest of the config for the partition setup, they will still use disk0-part=



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh	2009-10-01 16:27:43 UTC (rev 4576)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh	2009-10-01 18:01:36 UTC (rev 4577)
@@ -12,6 +12,16 @@
     exit_err "ERROR: populate_disk_label() called without argument!"
   fi
 
+  # Make our tmpdir with slice info
+  SLICECFGDIR="${TMPDIR}/.slice-cfg"
+
+  if [ -e "${SLICECFGDIR}/${WRKSLICE}" ]
+  then
+    DISKTAG="`cat ${SLICECFGDIR}/${WRKSLICE}`"
+  else
+    exit_err "ERROR: Missing SLICETAG data. This shouldn't happen - please let the developers know"
+  fi
+
   # Lets setup the BSDLABEL
   BSDLABEL="${TMPDIR}/bsdLabel-${WRKSLICE}"
   export BSDLABEL
@@ -26,7 +36,7 @@
   while read line
   do
     # Check for data on this slice
-    echo $line | grep "^${WRKSLICE}=" >/dev/null 2>/dev/null
+    echo $line | grep "^${DISKTAG}-part=" >/dev/null 2>/dev/null
     if [ "$?" = "0" ]
     then
       # Found a slice- entry, lets get the slice info

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh	2009-10-01 16:27:43 UTC (rev 4576)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh	2009-10-01 18:01:36 UTC (rev 4577)
@@ -5,22 +5,30 @@
 # Function which reads in the disk slice config, and performs it
 setup_disk_slice()
 {
+  # Make our tmpdir with slice info
+  SLICECFGDIR="${TMPDIR}/.slice-cfg"
+  rm -rf ${SLICECFGDIR} >/dev/null 2>/dev/null
+  mkdir ${SLICECFGDIR}
+
+  # Start with disk0
+  disknum="0"
+
   # We are ready to start setting up the disks, lets read the config and do the actions
   while read line
   do
-     echo $line | grep "^disk=" >/dev/null 2>/dev/null
+     echo $line | grep "^disk${disknum}=" >/dev/null 2>/dev/null
      if [ "$?" = "0" ]
      then
+
        # Found a disk= entry, lets get the disk we are working on
        get_value_from_string "${line}"
        strip_white_space "$VAL"
        DISK="$VAL"
-       
+     
        # Before we go further, lets confirm this disk really exists
        if [ ! -e "/dev/${DISK}" ]
        then
-         echo "ERROR: The disk ${DISK} does not exist!"
-         exit 1
+         exit_err "ERROR: The disk ${DISK} does not exist!"
        fi
      fi
 
@@ -31,6 +39,25 @@
        get_value_from_string "${line}"
        strip_white_space "$VAL"
        PTYPE="$VAL"
+
+       # We are using free space, figure out the slice number
+       if [ "${PTYPE}" = "free" ]
+       then
+         # Lets figure out what number this slice will be
+         LASTSLICE="`fdisk -s /dev/${DISK} | grep -v ${DISK} | grep ':' | tail -n 1 | cut -d ':' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
+         if [ -z "${LASTSLICE}" ]
+         then
+           LASTSLICE="1"
+         else
+           LASTSLICE="`expr $LASTSLICE + 1`"
+         fi
+
+         if [ $LASTSLICE -gt 4 ]
+         then
+           exit_err "ERROR: BSD only supports primary partitions, and there are none availble on $DISK"
+         fi
+
+       fi
      fi
 
      echo $line | grep "^bootManager=" >/dev/null 2>/dev/null
@@ -49,19 +76,28 @@
        if [ ! -z "${DISK}" -a ! -z "${PTYPE}" ]
        then
          case ${PTYPE} in
-                   all) run_fdisk_full "${DISK}" "${BMANAGER}" ;;
-           s1|s2|s3|s4) run_fdisk_slice "${DISK}" "${BMANAGER}" "${PTYPE}" ;;
-                  free) run_fdisk_free "${DISK}" "${BMANAGER}" ;;
-                     *) echo "ERROR: Unknown PTYPE: $PTYPE" ; exit 1 ;;
+                   all) tmpSLICE="${DISK}s1"  
+                        run_fdisk_full "${DISK}" "${BMANAGER}" ;;
+           s1|s2|s3|s4) tmpSLICE="${DISK}${PTYPE}" 
+                        run_fdisk_slice "${DISK}" "${BMANAGER}" "${PTYPE}" ;;
+                  free) tmpSLICE="${DISK}s${LASTSLICE}"
+                        run_fdisk_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" ;;
+                     *) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;;
          esac
          unset BMANAGER PTYPE DISK
+
+         # Now save which disk<num> this is, so we can parse it later during slice partition setup
+         echo "disk${disknum}" >${SLICECFGDIR}/$tmpSLICE
+
+         # Increment our disk counter to look for next disk
+         disknum="`expr $disknum + 1`"
        else
-         echo "ERROR: commitDiskPart was called without procceding disk= and partition= entries!!!" 
-         exit 1
+         exit_err "ERROR: commitDiskPart was called without procceding disk<num>= and partition= entries!!!" 
        fi
      fi
 
   done <${CFGF}
+
 };
 
 # Function which runs fdisk and creates a single large slice
@@ -197,32 +233,18 @@
 run_fdisk_free()
 {
   DISK=$1
-  if [ ! -z "$2" ]
+  SLICENUM=$2
+  if [ ! -z "$3" ]
   then
-    BMANAGER="$2"
+    BMANAGER="$3"
   fi
 
   # Set our sysctl so we can overwrite any geom using drives
   sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT}
 
-  # Lets figure out what number this slice will be
-  LASTSLICE="`fdisk -s /dev/${DISK} | grep -v ${DISK} | grep ':' | tail -n 1 | cut -d ':' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
-  if [ -z "${LASTSLICE}" ]
-  then
-    LASTSLICE="1"
-  else
-    LASTSLICE="`expr $LASTSLICE + 1`"
-  fi
+  slice="${DISK}s${SLICENUM}"
+  slicenum="${SLICENUM}" 
 
-  if [ $LASTSLICE -gt 4 ]
-  then
-    echo "ERROR: BSD only supports primary partitions, and there are none availble!"
-    exit 1
-  fi
-
-  slice="${DISK}s${LASTSLICE}"
-  slicenum="${LASTSLICE}" 
-
   # Lets get the starting block first
   if [ "${slicenum}" = "1" ]
   then

Modified: pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh	2009-10-01 16:27:43 UTC (rev 4576)
+++ pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh	2009-10-01 18:01:36 UTC (rev 4577)
@@ -34,7 +34,7 @@
 export CFGF
 
 # Start by doing a sanity check, which will catch any obvious mistakes in the config
-file_sanity_check "installMode disk partition bootManager installType installMedium packageType"
+file_sanity_check "installMode disk0 partition bootManager installType installMedium packageType"
 
 # We passed the Sanity check, lets grab some of the universal config settings and store them
 check_value installMode "fresh upgrade restore"

Modified: pcbsd/trunk/pc-sysinstall/conf/sample-install.cfg
===================================================================
--- pcbsd/trunk/pc-sysinstall/conf/sample-install.cfg	2009-10-01 16:27:43 UTC (rev 4576)
+++ pcbsd/trunk/pc-sysinstall/conf/sample-install.cfg	2009-10-01 18:01:36 UTC (rev 4577)
@@ -18,7 +18,7 @@
 
 
 #  Set the disk parameters
-disk=ad0
+disk0=ad0
 partition=all
 bootManager=none
 #bootManager=bsd
@@ -26,7 +26,7 @@
 commitDiskPart
 
 #  Set the disk parameters
-disk=ad1
+disk1=ad1
 partition=s1
 #partition=free
 # Do it now!
@@ -35,12 +35,12 @@
 # Setup the disk label
 # All sizes are expressed in MB
 # Avail FS Types, UFS, UFS+S, UFS+J, ZFS
-ad0s1-1=UFS+S 500 / 
-ad0s1-2=SWAP 2000 none
-ad0s1-2=UFS+J 500 /var
-ad0s1-3=UFS+J 500 /tmp
+disk0-part=UFS+S 500 / 
+disk0-part=SWAP 2000 none
+disk0-part=UFS+J 500 /var
+disk0-part=UFS+J 500 /tmp
 # Size 0 means use the rest of the slice size
-ad0s1-4=ZFS 0 /usr
+disk0-part=ZFS 0 /usr
 # Do it now!
 commitDiskLabel
 

Modified: pcbsd/trunk/pc-sysinstall/pcinstall.cfg
===================================================================
--- pcbsd/trunk/pc-sysinstall/pcinstall.cfg	2009-10-01 16:27:43 UTC (rev 4576)
+++ pcbsd/trunk/pc-sysinstall/pcinstall.cfg	2009-10-01 18:01:36 UTC (rev 4577)
@@ -5,7 +5,7 @@
 hostname=pcbsd8
 
 # Set the disk parameters
-disk=ad0
+disk0=ad0
 partition=all
 bootManager=bsd
 commitDiskPart
@@ -13,9 +13,9 @@
 # Setup the disk label
 # All sizes are expressed in MB
 # Avail FS Types, UFS, UFS+S, UFS+J, ZFS
-ad0s1=UFS 500 / 
-ad0s1=SWAP 2000 none
-ad0s1=UFS+S 0 /usr
+disk0-part=UFS 500 / 
+disk0-part=SWAP 2000 none
+disk0-part=UFS+S 0 /usr
 # Size 0 means use the rest of the slice size
 # Do it now!
 commitDiskLabel



More information about the Commits mailing list