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

svn at pcbsd.org svn at pcbsd.org
Wed Oct 28 08:39:14 PST 2009


Author: kris
Date: 2009-10-28 09:39:14 -0700 (Wed, 28 Oct 2009)
New Revision: 4797

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

Started adding support for GELI, support is working for encrypted swap space,
still working on file-system support



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh	2009-10-28 15:31:48 UTC (rev 4796)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-bsdlabel.sh	2009-10-28 16:39:14 UTC (rev 4797)
@@ -44,11 +44,22 @@
       FS=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 1` 
       SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2` 
       MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 3` 
+
+      # Check if we have a .eli extension on this FS
+      echo ${FS} | grep ".eli" >/dev/null 2>/dev/null
+      if [ "$?" = "0" ]
+      then
+        FS="`echo ${FS} | cut -d '.' -f 1`"
+        ENC="ON"
+      else
+        ENC="OFF"
+      fi
           
       # Now check that these values are sane
-      if [ "$FS" != "UFS" -a "$FS" != "UFS+S" -a "$FS" != "UFS+J" -a "$FS" != "ZFS" -a "$FS" != "SWAP" ]; then
-        exit_err "ERROR: Invalid file system specified on $line"
-      fi
+      case $FS in
+       UFS|UFS+S|UFS+J|ZFS|SWAP) ;;
+       *) exit_err "ERROR: Invalid file system specified on $line" ;;
+      esac
 
       # Check that we have a valid size number
       expr $SIZE + 1 >/dev/null 2>/dev/null
@@ -96,7 +107,7 @@
       fi
 
       # Save this data to our partition config dir
-      echo "${FS}:${MNT}" >${PARTDIR}/${WRKSLICE}${PARTLETTER}
+      echo "${FS}:${MNT}:${ENC}" >${PARTDIR}/${WRKSLICE}${PARTLETTER}
 
       # This partition letter is used, get the next one
       case ${PARTLETTER} in

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh	2009-10-28 15:31:48 UTC (rev 4796)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-cleanup.sh	2009-10-28 16:39:14 UTC (rev 4797)
@@ -9,6 +9,7 @@
   do
     PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
     PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
+    PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
 
     if [ "$PARTFS" = "ZFS" ]
     then
@@ -62,6 +63,7 @@
   do
     PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
     PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
+    PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
 
     DRIVE="`echo ${PART} | rev | cut -b 4- | rev`"
     # Check if this device is being mirrored
@@ -76,11 +78,13 @@
 
     if [ "${PARTFS}" != "ZFS" ]
     then
+      if [ "${PARTENC}" = "ON" ]
+      then
+        EXT=".eli"
+      fi
       if [ "${PARTFS}" = "UFS+J" ]
       then
-        EXT=".journal"
-      else
-        EXT=""
+        EXT="${EXT}.journal"
       fi
       if [ "${PARTFS}" = "SWAP" ]
       then

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh	2009-10-28 15:31:48 UTC (rev 4796)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-disk.sh	2009-10-28 16:39:14 UTC (rev 4797)
@@ -12,10 +12,13 @@
     gmirror list | grep "Name: ${DISK}" >/dev/null 2>/dev/null
     if [ "$?" = "0" ]
     then
+      echo "gmirror remove $gprov $DISK"
       echo "gmirror remove $gprov $DISK" >>${LOGOUT} 2>>${LOGOUT}
       gmirror remove $gprov $DISK >>${LOGOUT} 2>>${LOGOUT}
       echo "dd if=/dev/zero of=/dev/${DISK} count=4096" >>${LOGOUT} 2>>${LOGOUT}
       dd if=/dev/zero of=/dev/${DISK} count=4096 >>${LOGOUT} 2>>${LOGOUT}
+      fdisk -I /dev/${DISK} >>${LOGOUT} 2>>${LOGOUT}
+      dd if=/dev/zero of=/dev/${DISK} count=4096 >>${LOGOUT} 2>>${LOGOUT}
     fi
   done
 };
@@ -252,6 +255,7 @@
   if [ -e "${slice}b" ]
   then
    swapoff ${slice}b >/dev/null 2>/dev/null
+   swapoff ${slice}b.eli >/dev/null 2>/dev/null
   fi
 
   # Slice already exists, lets mark it as 165 for FreeBSD

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2009-10-28 15:31:48 UTC (rev 4796)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2009-10-28 16:39:14 UTC (rev 4797)
@@ -79,6 +79,7 @@
 
     PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
     PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
+    PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
 
     if [ "$PARTMNT" = "/" ]
     then
@@ -109,6 +110,7 @@
      
      PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
      PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
+     PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
 
      # Check if we've found "/" again, don't need to mount it twice
      if [ "$PARTMNT" != "/" ]
@@ -123,8 +125,16 @@
          ZFS) mount_partition ${PART} ${PARTFS} ${PARTMNT}
               ;;
         SWAP) # Lets enable this swap now
-              echo "swapon ${PART}"
-              swapon /dev/${PART}
+              if [ "$PARTENC" = "ON" ]
+              then
+                echo "Enabling encrypted swap on /dev/${PART}"
+                dd if=/dev/random of=/dev/${PART} bs=1m >>${LOGOUT} 2>>${LOGOUT}
+                geli onetime -d -e 3des ${PART} >>${LOGOUT} 2>>${LOGOUT}
+                swapon /dev/${PART}.eli >>${LOGOUT} 2>>${LOGOUT}
+              else
+                echo "swapon ${PART}"
+                swapon /dev/${PART}
+              fi
               ;;
           *) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
        esac

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh	2009-10-28 15:31:48 UTC (rev 4796)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-newfs.sh	2009-10-28 16:39:14 UTC (rev 4797)
@@ -43,6 +43,7 @@
      
      PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
      PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
+     PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
 
      # Make sure journaling isn't enabled on this device
      if [ -e "/dev/${PART}.journal" ]

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh	2009-10-28 15:31:48 UTC (rev 4796)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh	2009-10-28 16:39:14 UTC (rev 4797)
@@ -29,10 +29,16 @@
      
      PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
      PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
+     PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
 
      if [ "${PARTFS}" = "SWAP" ]
      then
-       swapoff /dev/${PART}
+       if [ "${PARTENC}" = "ON" ]
+       then
+         swapoff /dev/${PART}.eli
+       else
+         swapoff /dev/${PART}
+       fi
      fi
 
      # Check if we've found "/" again, don't need to mount it twice

Modified: pcbsd/trunk/pc-sysinstall/conf/sample-install.cfg
===================================================================
--- pcbsd/trunk/pc-sysinstall/conf/sample-install.cfg	2009-10-28 15:31:48 UTC (rev 4796)
+++ pcbsd/trunk/pc-sysinstall/conf/sample-install.cfg	2009-10-28 16:39:14 UTC (rev 4797)
@@ -35,6 +35,7 @@
 # Setup the disk label
 # All sizes are expressed in MB
 # Avail FS Types, UFS, UFS+S, UFS+J, ZFS
+# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli
 disk0-part=UFS+S 500 / 
 disk0-part=SWAP 2000 none
 disk0-part=UFS+J 500 /var

Modified: pcbsd/trunk/pc-sysinstall/pcinstall.cfg
===================================================================
--- pcbsd/trunk/pc-sysinstall/pcinstall.cfg	2009-10-28 15:31:48 UTC (rev 4796)
+++ pcbsd/trunk/pc-sysinstall/pcinstall.cfg	2009-10-28 16:39:14 UTC (rev 4797)
@@ -13,8 +13,9 @@
 # Setup the disk label
 # All sizes are expressed in MB
 # Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-disk0-part=UFS+S 500 / 
-disk0-part=SWAP 2000 none
+# 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 0 /usr
 # Size 0 means use the rest of the slice size
 # Do it now!



More information about the Commits mailing list