From owner-svn-src-head@FreeBSD.ORG Mon Sep 19 05:12:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C73C2106564A; Mon, 19 Sep 2011 05:12:53 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5AFC8FC0A; Mon, 19 Sep 2011 05:12:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8J5CrFq064600; Mon, 19 Sep 2011 05:12:53 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8J5CrX2064588; Mon, 19 Sep 2011 05:12:53 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201109190512.p8J5CrX2064588@svn.freebsd.org> From: Josh Paetzel Date: Mon, 19 Sep 2011 05:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225657 - in head/usr.sbin/pc-sysinstall: backend backend-partmanager examples X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 05:12:54 -0000 Author: jpaetzel Date: Mon Sep 19 05:12:53 2011 New Revision: 225657 URL: http://svn.freebsd.org/changeset/base/225657 Log: Fix a logic bug in pc-sysinstall creating partitions. Improve exit when an error occurs. Fix parsing to grab values which contain extra '=' signs. Fix a bug setting the timezone properly. Fix a usage bug when setting up with gmirror. Allow a uzip file from local media to be used. Allow specifying flags for "newfs" when using UFS as the file system. Run custom commands after doing final cleanup / fstab generation and such. Also fix using relative path for config file. Approved by: re (bz) Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh head/usr.sbin/pc-sysinstall/backend/functions-disk.sh head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh head/usr.sbin/pc-sysinstall/backend/functions-localize.sh head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh head/usr.sbin/pc-sysinstall/backend/functions-parse.sh head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh head/usr.sbin/pc-sysinstall/backend/functions.sh head/usr.sbin/pc-sysinstall/backend/parseconfig.sh head/usr.sbin/pc-sysinstall/examples/README Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -90,7 +90,7 @@ if [ $? -eq 0 -a "${SLICENUM}" = "1" ] ; fi # If we have a starting block, use it -if [ -z "$STARTBLOCK" ] ; then +if [ -n "$STARTBLOCK" ] ; then sBLOCK="-b $STARTBLOCK" fi Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -45,7 +45,6 @@ check_for_enc_pass() }; # On check on the disk-label line if we have any extra vars for this device -# Only enabled for ZFS devices now, may add other xtra options in future for other FS's get_fs_line_xvars() { ACTIVEDEV="${1}" @@ -76,6 +75,15 @@ get_fs_line_xvars() return fi # End of ZFS block + # See if we are looking for UFS specific newfs options + echo $LINE | grep -q '^UFS' 2>/dev/null + if [ $? -eq 0 ] ; then + FSVARS="`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`" + VAR="${FSVARS}" + export VAR + return + fi + fi # End of xtra-options block # If we got here, set VAR to empty and export @@ -278,7 +286,7 @@ setup_gpart_partitions() # Check if using zfs mirror echo ${XTRAOPTS} | grep -q "mirror" 2>/dev/null - if [ $? -eq 0 ] ; then + if [ $? -eq 0 -a "$FS" = "ZFS" ] ; then if [ "${_pType}" = "gpt" ] ; then XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_pDisk}p${CURPART}") else Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -554,7 +554,7 @@ init_gmirror() local _mDisk=$3 # Create this mirror device - rc_halt "gmirror label -vb ${_mBal} gm${_mNum} /dev/${_mDisk}" + rc_halt "gmirror label -vb ${_mBal} gm${_mNum} ${_mDisk}" sleep 3 Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -55,6 +55,10 @@ start_extract_uzip_tar() case ${PACKAGETYPE} in uzip) + if ! kldstat -v | grep -q "geom_uzip" ; then + exit_err "Kernel module geom_uzip not loaded" + fi + # Start by mounting the uzip image MDDEVICE=`mdconfig -a -t vnode -o readonly -f ${INSFILE}` mkdir -p ${FSMNT}.uzip @@ -435,6 +439,16 @@ init_extraction() rsync) start_rsync_copy ;; image) start_image_install ;; + local) + get_value_from_cfg localPath + if [ -z "$VAL" ] + then + exit_err "Install medium was set to local, but no localPath was provided!" + fi + LOCALPATH=$VAL + INSFILE="${LOCALPATH}/${INSFILE}" ; export INSFILE + start_extract_uzip_tar + ;; *) exit_err "ERROR: Unknown install medium" ;; esac Modified: head/usr.sbin/pc-sysinstall/backend/functions-localize.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-localize.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/functions-localize.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -509,7 +509,7 @@ run_localize() # Check if we need to set a timezone - echo $line | -q grep "^timeZone=" 2>/dev/null + echo $line | grep -q "^timeZone=" 2>/dev/null if [ $? -eq 0 ] ; then get_value_from_string "$line" set_timezone "$VAL" Modified: head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -138,7 +138,7 @@ setup_filesystems() UFS) echo_log "NEWFS: ${PARTDEV} - ${PARTFS}" sleep 2 - rc_halt "newfs ${PARTDEV}${EXT}" + rc_halt "newfs ${PARTXTRAOPTS} ${PARTDEV}${EXT}" sleep 2 rc_halt "sync" rc_halt "glabel label ${PARTLABEL} ${PARTDEV}${EXT}" @@ -154,7 +154,7 @@ setup_filesystems() UFS+S) echo_log "NEWFS: ${PARTDEV} - ${PARTFS}" sleep 2 - rc_halt "newfs -U ${PARTDEV}${EXT}" + rc_halt "newfs ${PARTXTRAOPTS} -U ${PARTDEV}${EXT}" sleep 2 rc_halt "sync" rc_halt "glabel label ${PARTLABEL} ${PARTDEV}${EXT}" @@ -169,7 +169,7 @@ setup_filesystems() UFS+SUJ) echo_log "NEWFS: ${PARTDEV} - ${PARTFS}" sleep 2 - rc_halt "newfs -U ${PARTDEV}${EXT}" + rc_halt "newfs ${PARTXTRAOPTS} -U ${PARTDEV}${EXT}" sleep 2 rc_halt "sync" rc_halt "tunefs -j enable ${PARTDEV}${EXT}" @@ -192,7 +192,7 @@ setup_filesystems() sleep 2 rc_halt "gjournal label -f ${PARTDEV}${EXT}" sleep 2 - rc_halt "newfs -O 2 -J ${PARTDEV}${EXT}.journal" + rc_halt "newfs ${PARTXTRAOPTS} -O 2 -J ${PARTDEV}${EXT}.journal" sleep 2 rc_halt "sync" rc_halt "glabel label ${PARTLABEL} ${PARTDEV}${EXT}.journal" Modified: head/usr.sbin/pc-sysinstall/backend/functions-parse.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-parse.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/functions-parse.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -33,7 +33,7 @@ get_value_from_string() { if [ -n "${1}" ] then - export VAL="`echo ${1} | cut -d '=' -f 2`" + export VAL="`echo ${1} | cut -d '=' -f 2-15`" else echo "Error: Did we forgot to supply a string to parse?" exit 1 @@ -45,7 +45,7 @@ get_value_from_cfg_with_spaces() { if [ -n "${1}" ] then - export VAL=`grep "^${1}=" ${CFGF} | head -n 1 | cut -d '=' -f 2` + export VAL=`grep "^${1}=" ${CFGF} | head -n 1 | cut -d '=' -f 2-15` else exit_err "Error: Did we forgot to supply a setting to grab?" fi @@ -57,7 +57,7 @@ get_value_from_cfg() { if [ -n "${1}" ] then - export VAL=`grep "^${1}=" ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '` + export VAL=`grep "^${1}=" ${CFGF} | head -n 1 | cut -d '=' -f 2-15 | tr -d ' '` else exit_err "Error: Did we forgot to supply a setting to grab?" fi Modified: head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -176,35 +176,35 @@ unmount_all_filesystems_failure() then if [ "${PARTENC}" = "ON" ] then - rc_nohalt "swapoff ${PARTDEV}.eli" + swapoff ${PARTDEV}.eli >/dev/null 2>/dev/null else - rc_nohalt "swapoff ${PARTDEV}" + swapoff ${PARTDEV} >/dev/null 2>/dev/null fi fi # Check if we've found "/" again, don't need to mount it twice if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ] then - rc_nohalt "umount -f ${PARTDEV}" - rc_nohalt "umount -f ${FSMNT}${PARTMNT}" + umount -f ${PARTDEV} >/dev/null 2>/dev/null + umount -f ${FSMNT}${PARTMNT} >/dev/null 2>/dev/null fi done # Last lets the /mnt partition ######################################################### - rc_nohalt "umount -f ${FSMNT}" + umount -f ${FSMNT} >/dev/null 2>/dev/null fi else # We are doing a upgrade, try unmounting any of these filesystems - chroot ${FSMNT} /sbin/umount -a >>${LOGOUT} >>${LOGOUT} - umount -f ${FSMNT}/usr >>${LOGOUT} 2>>${LOGOUT} - umount -f ${FSMNT}/dev >>${LOGOUT} 2>>${LOGOUT} - umount -f ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} - rc_nohalt "sh ${TMPDIR}/.upgrade-unmount" + chroot ${FSMNT} /sbin/umount -a >/dev/null 2>/dev/null + umount -f ${FSMNT}/usr >/dev/null 2>/dev/null + umount -f ${FSMNT}/dev >/dev/null 2>/dev/null + umount -f ${FSMNT} >/dev/null 2>/dev/null + sh ${TMPDIR}/.upgrade-unmount >/dev/null 2>/dev/null fi # Unmount our CDMNT - rc_nohalt "umount ${CDMNT}" + umount ${CDMNT} >/dev/null 2>/dev/null }; Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/functions.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -98,10 +98,10 @@ strip_white_space() exit_err() { # Echo the message for the users benefit - echo "$1" + echo "EXITERROR: $1" # Save this error to the log file - echo "${1}" >>$LOGOUT + echo "EXITERROR: ${1}" >>$LOGOUT # Check if we need to unmount any file-systems after this failure unmount_all_filesystems_failure @@ -446,12 +446,12 @@ install_fresh() # Now add any users setup_users - # Now run any commands specified - run_commands - # Do any last cleanup / setup before unmounting run_final_cleanup + # Now run any commands specified + run_commands + # Unmount and finish up unmount_all_filesystems fi Modified: head/usr.sbin/pc-sysinstall/backend/parseconfig.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Mon Sep 19 05:12:53 2011 (r225657) @@ -58,12 +58,8 @@ fi # Set our config file variable CFGF="$1" -# Check the dirname of the provided CFGF and make sure its a full path -DIR="`dirname ${CFGF}`" -if [ "${DIR}" = "." ] -then - CFGF="`pwd`/${CFGF}" -fi +# Resolve any relative pathing +CFGF="`realpath ${CFGF}`" export CFGF # Start by doing a sanity check, which will catch any obvious mistakes in the config @@ -72,7 +68,7 @@ file_sanity_check "installMode installTy # We passed the Sanity check, lets grab some of the universal config settings and store them check_value installMode "fresh upgrade extract" check_value installType "PCBSD FreeBSD" -check_value installMedium "dvd usb ftp rsync image" +check_value installMedium "dvd usb ftp rsync image local" check_value packageType "uzip tar rsync split" if_check_value_exists partition "all s1 s2 s3 s4 free image" if_check_value_exists mirrorbal "load prefer round-robin split" Modified: head/usr.sbin/pc-sysinstall/examples/README ============================================================================== --- head/usr.sbin/pc-sysinstall/examples/README Mon Sep 19 04:08:52 2011 (r225656) +++ head/usr.sbin/pc-sysinstall/examples/README Mon Sep 19 05:12:53 2011 (r225657) @@ -184,7 +184,7 @@ the listing of any additional diskX= dir The following settings specify the partitioning / mount points to setup on the target partition -# disk0-part=UFS+S 500 / +# disk0-part=UFS+S 500 / (-n -o time) # disk0-part=SWAP 2000 none # disk0-part=UFS.eli 500 /usr # encpass=mypass @@ -219,6 +219,12 @@ All sizes are expressed in MegaBytes Specifying a size 0 instructs pc-sysinstall to use the rest of the available slice size, and should only be used for the last partition / mount +When using "UFS" and its various types, it is possible to specify custom options +for newfs using (). For examplei: +disk0-part=UFS+SUJ 1000 / (-o time) +In this case "-o time" would be passed to newfs when creating the "/" filesystem. + + When using "ZFS" specifically, it is possible to specify additional disks / partitions to include in the zpool. By using the syntax: (mirror: ad1,ad2) or (raidz: ad1,ad2), it is possible to include the disk "ad1" into the zpool for this partition, using the raidz / mirror methods.