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

svn at pcbsd.org svn at pcbsd.org
Thu Oct 1 09:27:44 PDT 2009


Author: kris
Date: 2009-10-01 09:27:43 -0700 (Thu, 01 Oct 2009)
New Revision: 4576

Added:
   pcbsd/trunk/pc-sysinstall/backend/functions-unmount.sh
Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-extractimage.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-mountoptical.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-mountusb.sh
   pcbsd/trunk/pc-sysinstall/backend/functions-runcommands.sh
   pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh
   pcbsd/trunk/pc-sysinstall/conf/pc-sysinstall.conf
   pcbsd/trunk/pc-sysinstall/pcinstall.cfg
Log:

Updated the new installer backend, now its able to install FreeBSD vanilla from DVD properly,
and fixes some bugs running scripts, also will unmount file-systems at end of install



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-extractimage.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-extractimage.sh	2009-10-01 15:43:11 UTC (rev 4575)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-extractimage.sh	2009-10-01 16:27:43 UTC (rev 4576)
@@ -41,7 +41,7 @@
          umount ${FSMNT}.uzip
          mdconfig -d -u ${MDDEVICE}
          ;;
-    tar) tar -xpvf -C ${FSMNT} -f ${CDMNT}/${INSFILE} ${TAROPTS} >&1 2>&1
+    tar) tar -xpv -C ${FSMNT} -f ${CDMNT}/${INSFILE} ${TAROPTS} >&1 2>&1
          if [ "$?" != "0" ]
          then
            exit_err "ERROR: Failed extracting the image with: ${CMD}"
@@ -55,7 +55,7 @@
 init_extraction()
 {
  # Lets figure out what file we are working on here and set it
- if [ "$INSTALLMODE" = "FreeBSD" ]
+ if [ "$INSTALLTYPE" = "FreeBSD" ]
  then
    case $PACKAGETYPE in
       lzma) INSFILE="${FBSD_LZMA_FILE}" ;;

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2009-10-01 15:43:11 UTC (rev 4575)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountdisk.sh	2009-10-01 16:27:43 UTC (rev 4576)
@@ -42,6 +42,7 @@
     echo "zfs create ${PART}${ZNAME}"
     zfs create ${PART}${ZNAME} >>${LOGOUT} 2>>${LOGOUT}
     echo "zfs set mountpoint=${FSMNT}${MNTPOINT} ${PART}${ZNAME}"
+    sleep 2
     zfs set mountpoint=${FSMNT}${MNTPOINT} ${PART}${ZNAME} >>${LOGOUT} 2>>${LOGOUT}
     if [ "$?" != "0" ]
     then
@@ -51,6 +52,7 @@
   else
   # If we are not on ZFS, lets do the mount now
     echo "mount ${MNTFLAGS} /dev/${PART} -> ${FSMNT}${MNTPOINT}"
+    sleep 2
     mount ${MNTFLAGS} /dev/${PART} ${FSMNT}${MNTPOINT} >>${LOGOUT} 2>>${LOGOUT}
     if [ "$?" != "0" ]
     then

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountoptical.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountoptical.sh	2009-10-01 15:43:11 UTC (rev 4575)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountoptical.sh	2009-10-01 16:27:43 UTC (rev 4576)
@@ -4,16 +4,51 @@
 . ${BACKEND}/functions.sh
 . ${BACKEND}/functions-parse.sh
 
+# Displays an optical failure message
+opt_fail()
+{
+   # If we got here, we must not have a DVD we can find :(
+   get_value_from_cfg installInteractive
+   if [ "${VAL}" = "yes" ]
+   then
+     # We are running interactive, and didn't find a DVD, prompt user again
+     echo "OPT DISK ERROR: Unable to find installation disk!"
+     echo "Please insert the installation disk and press enter."
+     read tmp
+   else
+    exit_err "ERROR: Unable to locate installation DVD"
+   fi
+};
+
 # Performs the extraction of data to disk
 opt_mount()
 {
  FOUND="0"
 
+
+ # Start by checking if we already have a cd mounted at CDMNT
+ mount | grep "${CDMNT} " >/dev/null 2>/dev/null
+ if [ "$?" = "0" ]
+ then
+   if [ -e "${CDMNT}/${INSFILE}" ]
+   then
+     echo "MOUNTED" >${TMPDIR}/cdmnt
+     echo "FOUND DVD: MOUNTED" >>${LOGOUT}
+     FOUND="1"
+     return
+   fi
+
+   # failed to find optical disk
+   opt_fail
+   return
+ fi
+
 # Setup our loop to search for installation media
  while
  z=1
  do
 
+
    # Loop though and look for an installation disk
    for i in `ls -1 /dev/acd* /dev/cd* /dev/scd* /dev/rscd* 2>/dev/null`
    do
@@ -36,18 +71,10 @@
    then
      break
    fi
- 
-   # If we got this far, we must not have a DVD we can find :(
-   get_value_from_cfg installInteractive
-   if [ "${VAL}" = "yes" ]
-   then
-     # We are running interactive, and didn't find a DVD, prompt user again
-     echo "OPT DISK ERROR: Unable to find installation disk!"
-     echo "Please insert the installation disk and press enter."
-     read tmp
-   else
-    exit_err "ERROR: Unable to locate installation DVD"
-   fi
+   
+   # Failed to find a disk, take action now
+   opt_fail
+
  done
 
 };

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-mountusb.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-mountusb.sh	2009-10-01 15:43:11 UTC (rev 4575)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-mountusb.sh	2009-10-01 16:27:43 UTC (rev 4576)
@@ -4,11 +4,45 @@
 . ${BACKEND}/functions.sh
 . ${BACKEND}/functions-parse.sh
 
+usb_fail()
+{
+   # If we got here, we must not have a DVD we can find :(
+   get_value_from_cfg installInteractive
+   if [ "${VAL}" = "yes" ]
+   then
+     # We are running interactive, and didn't find a USB, prompt user again
+     echo "OPT DISK ERROR: Unable to find installation disk!"
+     echo "Please insert the installation disk and press enter."
+     read tmp
+   else
+    exit_err "ERROR: Unable to locate installation USB"
+   fi
+};
+
+
 # Performs the extraction of data to disk
 usb_mount()
 {
  FOUND="0"
 
+ # Start by checking if we already have a usb mounted at CDMNT
+ mount | grep "${CDMNT} " >/dev/null 2>/dev/null
+ if [ "$?" = "0" ]
+ then
+   if [ -e "${CDMNT}/${INSFILE}" ]
+   then
+     echo "MOUNTED" >${TMPDIR}/cdmnt
+     echo "FOUND USB: MOUNTED" >>${LOGOUT}
+     FOUND="1"
+     return
+   fi
+
+   # failed to find optical disk
+   usb_fail
+   return
+ fi
+
+
 # Setup our loop to search for installation media
  while
  z=1
@@ -53,17 +87,9 @@
      break
    fi
  
-   # If we got this far, we must not have a USB we can find :(
-   get_value_from_cfg installInteractive
-   if [ "${VAL}" = "yes" ]
-   then
-     # We are running interactive, and didn't find a USB, prompt user again
-     echo "USB DISK ERROR: Unable to find installation disk!"
-     echo "Please insert the installation usb device and press enter."
-     read tmp
-   else
-    exit_err "ERROR: Unable to locate installation USB"
-   fi
+   # Failed to find any valid USB disk
+   usb_fail
+
  done
 
 };

Modified: pcbsd/trunk/pc-sysinstall/backend/functions-runcommands.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-runcommands.sh	2009-10-01 15:43:11 UTC (rev 4575)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-runcommands.sh	2009-10-01 16:27:43 UTC (rev 4576)
@@ -48,7 +48,7 @@
   while read line
   do
     # Check if we need to run any chroot command
-    echo $line | grep runCommand= >/dev/null 2>/dev/null
+    echo $line | grep ^runCommand= >/dev/null 2>/dev/null
     if [ "$?" = "0" ]
     then
       get_value_from_string "$line"
@@ -56,7 +56,7 @@
     fi
 
     # Check if we need to run any chroot script
-    echo $line | grep runScript= >/dev/null 2>/dev/null
+    echo $line | grep ^runScript= >/dev/null 2>/dev/null
     if [ "$?" = "0" ]
     then
       get_value_from_string "$line"
@@ -64,7 +64,7 @@
     fi
 
     # Check if we need to run any chroot command
-    echo $line | grep runExtCommand= >/dev/null 2>/dev/null
+    echo $line | grep ^runExtCommand= >/dev/null 2>/dev/null
     if [ "$?" = "0" ]
     then
       get_value_from_string "$line"

Modified: pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh	2009-10-01 15:43:11 UTC (rev 4575)
+++ pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh	2009-10-01 16:27:43 UTC (rev 4576)
@@ -13,6 +13,7 @@
 . ${BACKEND}/functions-installcomponents.sh
 . ${BACKEND}/functions-runcommands.sh
 . ${BACKEND}/functions-localize.sh
+. ${BACKEND}/functions-unmount.sh
 
 # Check that the config file exists
 if [ ! -e "${1}" ]
@@ -87,6 +88,9 @@
   # Do any localization in configuration
   run_localize
 
+  # Unmount and finish up
+  unmount_all_filesystems
+
 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/conf/pc-sysinstall.conf
===================================================================
--- pcbsd/trunk/pc-sysinstall/conf/pc-sysinstall.conf	2009-10-01 15:43:11 UTC (rev 4575)
+++ pcbsd/trunk/pc-sysinstall/conf/pc-sysinstall.conf	2009-10-01 16:27:43 UTC (rev 4576)
@@ -21,11 +21,6 @@
 LOGOUT="${TMPDIR}/pc-sysinstall.log"
 export LOGOUT
 
-# Set our port options
-PKG_DBDIR="/usr/PCBSD/var/db/pkg"
-PORT_DBDIR="/usr/PCBSD/var/db/pkg" 
-export PKG_DBDIR PORT_DBDIR
-
 # Set our mount-points
 CDMNT="/cdmnt"
 FSMNT="/mnt"
@@ -45,15 +40,15 @@
 # Variables to set the location of installation data
 LZMA_FILE="PCBSD.tar.lzma"
 UZIP_FILE="PCBSD.ufs.uzip"
-TAR_FILE="PCBSD.tar"
+TAR_FILE="PCBSD.tbz"
 
 export LZMA_FILE UZIP_FILE TAR_FILE
 
 
 # Locations of FreeBSD only install files
-FBSD_LZMA_FILE="FBSD.tar.lzma"
-FBSD_UZIP_FILE="FBSD.ufs.uzip"
-FBSD_TAR_FILE="FBSD.tar"
+FBSD_LZMA_FILE="fbsd-release.tar.lzma"
+FBSD_UZIP_FILE="fbsd-release.ufs.uzip"
+FBSD_TAR_FILE="fbsd-release.tbz"
 
 export FBSD_LZMA_FILE FBSD_UZIP_FILE FBSD_TAR_FILE
 

Modified: pcbsd/trunk/pc-sysinstall/pcinstall.cfg
===================================================================
--- pcbsd/trunk/pc-sysinstall/pcinstall.cfg	2009-10-01 15:43:11 UTC (rev 4575)
+++ pcbsd/trunk/pc-sysinstall/pcinstall.cfg	2009-10-01 16:27:43 UTC (rev 4576)
@@ -22,17 +22,17 @@
 
 
 # Set if we are installing via optical, USB, or FTP
-installType=PCBSD-Desktop
+installType=FreeBSD
 installMedium=dvd
 
 #packageType=lzma
-packageType=uzip
-#packageType=tar
+#packageType=uzip
+packageType=tar
 #installComponents=ports,src
 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
 



More information about the Commits mailing list