Date: Tue, 24 Aug 2010 06:11:46 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r211730 - in head/usr.sbin/pc-sysinstall: backend backend-query pc-sysinstall Message-ID: <201008240611.o7O6Bkpi065153@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Tue Aug 24 06:11:46 2010 New Revision: 211730 URL: http://svn.freebsd.org/changeset/base/211730 Log: Indent things consistently PR: 149926 Submitted by: John Hixson Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh head/usr.sbin/pc-sysinstall/backend-query/disk-part.sh head/usr.sbin/pc-sysinstall/backend-query/enable-net.sh head/usr.sbin/pc-sysinstall/backend-query/get-packages.sh head/usr.sbin/pc-sysinstall/backend-query/list-packages.sh head/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh head/usr.sbin/pc-sysinstall/backend-query/test-netup.sh head/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh head/usr.sbin/pc-sysinstall/backend/functions-cleanup.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-ftp.sh head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh head/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh head/usr.sbin/pc-sysinstall/backend/functions-localize.sh head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh head/usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh head/usr.sbin/pc-sysinstall/backend/functions-networking.sh head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh head/usr.sbin/pc-sysinstall/backend/functions-packages.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-upgrade.sh head/usr.sbin/pc-sysinstall/backend/functions-users.sh head/usr.sbin/pc-sysinstall/backend/functions.sh head/usr.sbin/pc-sysinstall/backend/parseconfig.sh head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -54,7 +54,6 @@ HEADS="${VAL}" get_disk_sectors "${DISK}" SECS="${VAL}" - # Now get the disks size in MB KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`" MB=$(convert_byte_to_megabyte ${KB}) @@ -62,10 +61,9 @@ MB=$(convert_byte_to_megabyte ${KB}) # Now get the Controller Type CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`" - echo "cylinders=${CYLS}" echo "heads=${HEADS}" echo "sectors=${SECS}" -echo "size=$MB" -echo "type=$CTYPE" +echo "size=${MB}" +echo "type=${CTYPE}" Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -26,16 +26,32 @@ # $FreeBSD$ ARGS=$1 +FLAGS_MD="" +FLAGS_VERBOSE="" + +shift +while [ -n "$1" ] +do + case "$1" in + -m) + FLAGS_MD=1 + ;; + -v) + FLAGS_VERBOSE=1 + ;; + esac + shift +done # Create our device listing SYSDISK=$(sysctl -n kern.disks) -if [ "${ARGS}" = "-m" ] +if [ -n "${FLAGS_MD}" ] then - MDS=`mdconfig -l` - if [ -n "${MDS}" ] - then - SYSDISK="${SYSDISK} ${MDS}" - fi + MDS=`mdconfig -l` + if [ -n "${MDS}" ] + then + SYSDISK="${SYSDISK} ${MDS}" + fi fi # Now loop through these devices, and list the disk drives @@ -47,7 +63,7 @@ do # Make sure we don't find any cd devices case "${DEV}" in - acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; + acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; esac # Check the dmesg output for some more info about this device @@ -55,11 +71,17 @@ do if [ -z "$NEWLINE" ]; then NEWLINE=" <Unknown Device>" fi - if echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null + + if [ -n "${FLAGS_MD}" ] && echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null then NEWLINE=" <Memory Disk>" fi + if [ -n "${FLAGS_VERBOSE}" ] + then + : + fi + # Save the disk list if [ ! -z "$DLIST" ] then Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-part.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/disk-part.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/disk-part.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -51,8 +51,6 @@ MB=$(convert_byte_to_megabyte ${KB}) TOTALSIZE="$MB" TOTALB="`diskinfo -v ${1} | grep 'in sectors' | tr -s '\t' ' ' | cut -d ' ' -f 2`" - - gpart show ${1} >/dev/null 2>/dev/null if [ "$?" != "0" ] ; then # No partitions on this disk, display entire disk size and exit @@ -85,14 +83,14 @@ do # First get the sysid / label for this partition if [ "$TYPE" = "MBR" ] ; then - get_partition_sysid_mbr "${DISK}" "${curpart}" - echo "${curpart}-sysid: ${VAL}" - get_partition_label_mbr "${DISK}" "${curpart}" - echo "${curpart}-label: ${VAL}" + get_partition_sysid_mbr "${DISK}" "${curpart}" + echo "${curpart}-sysid: ${VAL}" + get_partition_label_mbr "${DISK}" "${curpart}" + echo "${curpart}-label: ${VAL}" else - get_partition_label_gpt "${DISK}" "${curpart}" - echo "${curpart}-sysid: ${VAL}" - echo "${curpart}-label: ${VAL}" + get_partition_label_gpt "${DISK}" "${curpart}" + echo "${curpart}-sysid: ${VAL}" + echo "${curpart}-label: ${VAL}" fi # Now get the startblock, blocksize and MB size of this partition Modified: head/usr.sbin/pc-sysinstall/backend-query/enable-net.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/enable-net.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/enable-net.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -60,6 +60,6 @@ else fi case ${MIRRORFETCH} in - ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;; - *) ;; + ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;; + *) ;; esac Modified: head/usr.sbin/pc-sysinstall/backend-query/get-packages.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/get-packages.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/get-packages.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -34,19 +34,19 @@ ID=`id -u` if [ "${ID}" -ne "0" ] then - echo "Error: must be root!" - exit 1 + echo "Error: must be root!" + exit 1 fi if [ ! -f "${PKGDIR}/INDEX" ] then - get_package_index + get_package_index fi if [ -f "${PKGDIR}/INDEX" ] then - echo "${PKGDIR}/INDEX" - exit 0 + echo "${PKGDIR}/INDEX" + exit 0 fi exit 1 Modified: head/usr.sbin/pc-sysinstall/backend-query/list-packages.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/list-packages.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/list-packages.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -37,50 +37,50 @@ NARGS=0 if [ ! -f "${PKGDIR}/INDEX" ] then - echo "Error: please fetch package index with get-packages!" - exit 1 + echo "Error: please fetch package index with get-packages!" + exit 1 fi if [ ! -f "${PKGDIR}/INDEX.parsed" ] then - parse_package_index + parse_package_index fi if [ -n "${PACKAGE_CATEGORY}" ] then - NARGS=$((NARGS+1)) + NARGS=$((NARGS+1)) fi if [ -n "${PACKAGE_NAME}" ] then - NARGS=$((NARGS+1)) + NARGS=$((NARGS+1)) fi if [ "${NARGS}" -eq "0" ] then - show_packages + show_packages elif [ "${NARGS}" -eq "1" ] then - if [ "${PACKAGE_CATEGORY}" = "@INDEX@" ] - then - if [ -f "${PKGDIR}/INDEX" ] - then - echo "${PKGDIR}/INDEX" - exit 0 - else - exit 1 - fi + if [ "${PACKAGE_CATEGORY}" = "@INDEX@" ] + then + if [ -f "${PKGDIR}/INDEX" ] + then + echo "${PKGDIR}/INDEX" + exit 0 + else + exit 1 + fi - else - show_packages_by_category "${PACKAGE_CATEGORY}" - fi + else + show_packages_by_category "${PACKAGE_CATEGORY}" + fi elif [ "${NARGS}" -eq "2" ] then - show_package_by_name "${PACKAGE_CATEGORY}" "${PACKAGE_NAME}" + show_package_by_name "${PACKAGE_CATEGORY}" "${PACKAGE_NAME}" else - show_packages + show_packages fi Modified: head/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -32,8 +32,8 @@ MIRROR="${1}" if [ -z "${MIRROR}" ] then - echo "Error: No mirror specified!" - exit 1 + echo "Error: No mirror specified!" + exit 1 fi set_ftp_mirror "${MIRROR}" Modified: head/usr.sbin/pc-sysinstall/backend-query/test-netup.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/test-netup.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/test-netup.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -35,15 +35,15 @@ rm ${TMPDIR}/.testftp >/dev/null 2>/dev/ ping -c 2 www.pcbsd.org >/dev/null 2>/dev/null if [ "$?" = "0" ] then - echo "ftp: Up" - exit 0 + echo "ftp: Up" + exit 0 fi ping -c 2 www.freebsd.org >/dev/null 2>/dev/null if [ "$?" = "0" ] then - echo "ftp: Up" - exit 0 + echo "ftp: Up" + exit 0 fi echo "ftp: Down" Modified: head/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -35,16 +35,17 @@ rm ${TMPDIR}/AvailUpgrades >/dev/null 2> FSMNT="/mnt" # Get the freebsd version on this partition -get_fbsd_ver() { +get_fbsd_ver() +{ VER="`file ${FSMNT}/bin/sh | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' | cut -d ';' -f 2 | cut -d ',' -f 1`" if [ "$?" = "0" ] ; then - file ${FSMNT}/bin/sh | grep '32-bit' >/dev/null 2>/dev/null - if [ "${?}" = "0" ] ; then - echo "${1}: FreeBSD ${VER} (32bit)" - else - echo "${1}: FreeBSD ${VER} (64bit)" - fi + file ${FSMNT}/bin/sh | grep '32-bit' >/dev/null 2>/dev/null + if [ "${?}" = "0" ] ; then + echo "${1}: FreeBSD ${VER} (32bit)" + else + echo "${1}: FreeBSD ${VER} (64bit)" + fi fi } @@ -62,7 +63,7 @@ do # Make sure we don't find any cd devices echo "${DEV}" | grep -e "^acd[0-9]" -e "^cd[0-9]" -e "^scd[0-9]" >/dev/null 2>/dev/null if [ "$?" != "0" ] ; then - DEVS="${DEVS} `ls /dev/${i}*`" + DEVS="${DEVS} `ls /dev/${i}*`" fi done @@ -70,25 +71,25 @@ done # Search for regular UFS / Geom Partitions to upgrade for i in $DEVS do - if [ ! -e "${i}a.journal" -a ! -e "${i}a" -a ! -e "${i}p2" -a ! -e "${i}p2.journal" ] ; then - continue - fi + if [ ! -e "${i}a.journal" -a ! -e "${i}a" -a ! -e "${i}p2" -a ! -e "${i}p2.journal" ] ; then + continue + fi - if [ -e "${i}a.journal" ] ; then - _dsk="${i}a.journal" - elif [ -e "${i}a" ] ; then - _dsk="${i}a" - elif [ -e "${i}p2" ] ; then - _dsk="${i}p2" - elif [ -e "${i}p2.journal" ] ; then - _dsk="${i}p2.journal" - fi + if [ -e "${i}a.journal" ] ; then + _dsk="${i}a.journal" + elif [ -e "${i}a" ] ; then + _dsk="${i}a" + elif [ -e "${i}p2" ] ; then + _dsk="${i}p2" + elif [ -e "${i}p2.journal" ] ; then + _dsk="${i}p2.journal" + fi - mount -o ro ${_dsk} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} - if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then - get_fbsd_ver "`echo ${_dsk} | sed 's|/dev/||g'`" - umount -f ${FSMNT} >/dev/null 2>/dev/null - fi + mount -o ro ${_dsk} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} + if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then + get_fbsd_ver "`echo ${_dsk} | sed 's|/dev/||g'`" + umount -f ${FSMNT} >/dev/null 2>/dev/null + fi done # Now search for any ZFS root partitions @@ -101,9 +102,9 @@ umount_all_dir "${FSMNT}" _zps="`zpool list | grep -v 'NAME' | cut -d ' ' -f 1`" for _zpools in ${_zps} do - mount -o ro -t zfs ${_zpools} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} - if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then - get_fbsd_ver "${_zpools}" - umount -f ${FSMNT} >/dev/null 2>/dev/null - fi + mount -o ro -t zfs ${_zpools} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} + if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then + get_fbsd_ver "${_zpools}" + umount -f ${FSMNT} >/dev/null 2>/dev/null + fi done Modified: head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -36,7 +36,7 @@ do echo $line | grep '! ' >/dev/null 2>/dev/null if [ "$?" = "0" ] then - exit 0 + exit 0 else echo "$line" fi Modified: head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -36,7 +36,7 @@ do echo $line | grep '! ' >/dev/null 2>/dev/null if [ "$?" = "0" ] then - exit 0 + exit 0 else model="`echo $line | sed 's|(|[|g'`" model="`echo $model | sed 's|)|]|g'`" Modified: head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -36,7 +36,7 @@ do echo $line | grep '! ' >/dev/null 2>/dev/null if [ "$?" = "0" ] then - exit 0 + exit 0 else echo "$line" fi Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -76,7 +76,6 @@ get_fs_line_xvars() return fi # End of ZFS block - fi # End of xtra-options block # If we got here, set VAR to empty and export @@ -86,30 +85,31 @@ get_fs_line_xvars() }; # Init each zfs mirror disk with a boot sector so we can failover -setup_zfs_mirror_parts() { - - _nZFS="" - # Using mirroring, setup boot partitions on each disk - _mirrline="`echo ${1} | sed 's|mirror ||g'`" - for _zvars in $_mirrline - do - echo "Looping through _zvars: $_zvars" >>${LOGOUT} - echo "$_zvars" | grep "${2}" >/dev/null 2>/dev/null - if [ "$?" = "0" ] ; then continue ; fi - if [ -z "$_zvars" ] ; then continue ; fi - - is_disk "$_zvars" >/dev/null 2>/dev/null - if [ "$?" = "0" ] ; then - echo "Setting up ZFS mirror disk $_zvars" >>${LOGOUT} - init_gpt_full_disk "$_zvars" >/dev/null 2>/dev/null - rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${_zvars}" >/dev/null 2>/dev/null - rc_halt "gpart add -t freebsd-zfs ${_zvars}" >/dev/null 2>/dev/null - _nZFS="$_nZFS ${_zvars}p2" - else - _nZFS="$_nZFS ${_zvars}" - fi - done - echo "mirror $2 `echo $_nZFS | tr -s ' '`" +setup_zfs_mirror_parts() +{ + _nZFS="" + + # Using mirroring, setup boot partitions on each disk + _mirrline="`echo ${1} | sed 's|mirror ||g'`" + for _zvars in $_mirrline + do + echo "Looping through _zvars: $_zvars" >>${LOGOUT} + echo "$_zvars" | grep "${2}" >/dev/null 2>/dev/null + if [ "$?" = "0" ] ; then continue ; fi + if [ -z "$_zvars" ] ; then continue ; fi + + is_disk "$_zvars" >/dev/null 2>/dev/null + if [ "$?" = "0" ] ; then + echo "Setting up ZFS mirror disk $_zvars" >>${LOGOUT} + init_gpt_full_disk "$_zvars" >/dev/null 2>/dev/null + rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${_zvars}" >/dev/null 2>/dev/null + rc_halt "gpart add -t freebsd-zfs ${_zvars}" >/dev/null 2>/dev/null + _nZFS="$_nZFS ${_zvars}p2" + else + _nZFS="$_nZFS ${_zvars}" + fi + done + echo "mirror $2 `echo $_nZFS | tr -s ' '`" } ; # Function which creates a unique label name for the specified mount @@ -161,7 +161,6 @@ gen_glabel_name() # Function to setup / stamp a legacy MBR bsdlabel setup_mbr_partitions() { - DISKTAG="$1" WRKSLICE="$2" FOUNDPARTS="1" @@ -218,7 +217,7 @@ setup_mbr_partitions() # Now check that these values are sane case $FS in - UFS|UFS+S|UFS+J|ZFS|SWAP) ;; + UFS|UFS+S|UFS+J|ZFS|SWAP) ;; *) exit_err "ERROR: Invalid file system specified on $line" ;; esac @@ -316,16 +315,16 @@ setup_mbr_partitions() # This partition letter is used, get the next one case ${PARTLETTER} in - a) PARTLETTER="b" ;; - b) # When we hit b, add the special c: setup for bsdlabel - echo "c: * * unused" >>${BSDLABEL} - PARTLETTER="d" ;; - d) PARTLETTER="e" ;; - e) PARTLETTER="f" ;; - f) PARTLETTER="g" ;; - g) PARTLETTER="h" ;; - h) PARTLETTER="ERR" ;; - *) exit_err "ERROR: bsdlabel only supports up to letter h for partitions." ;; + a) PARTLETTER="b" ;; + b) # When we hit b, add the special c: setup for bsdlabel + echo "c: * * unused" >>${BSDLABEL} + PARTLETTER="d" ;; + d) PARTLETTER="e" ;; + e) PARTLETTER="f" ;; + f) PARTLETTER="g" ;; + g) PARTLETTER="h" ;; + h) PARTLETTER="ERR" ;; + *) exit_err "ERROR: bsdlabel only supports up to letter h for partitions." ;; esac fi # End of subsection locating a slice in config @@ -402,7 +401,7 @@ setup_gpt_partitions() # Now check that these values are sane case $FS in - UFS|UFS+S|UFS+J|ZFS|SWAP) ;; + UFS|UFS+S|UFS+J|ZFS|SWAP) ;; *) exit_err "ERROR: Invalid file system specified on $line" ;; esac @@ -464,9 +463,9 @@ setup_gpt_partitions() # Figure out the gpart type to use case ${FS} in - ZFS) PARTYPE="freebsd-zfs" ;; - SWAP) PARTYPE="freebsd-swap" ;; - *) PARTYPE="freebsd-ufs" ;; + ZFS) PARTYPE="freebsd-zfs" ;; + SWAP) PARTYPE="freebsd-swap" ;; + *) PARTYPE="freebsd-ufs" ;; esac # Create the partition @@ -507,8 +506,8 @@ setup_gpt_partitions() # If this is the boot disk, stamp the right gptboot if [ ! -z "${BOOTTYPE}" ] ; then case ${BOOTTYPE} in - freebsd-ufs) rc_halt "gpart bootcode -p /boot/gptboot -i 1 ${DISK}" ;; - freebsd-zfs) rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${DISK}" ;; + freebsd-ufs) rc_halt "gpart bootcode -p /boot/gptboot -i 1 ${DISK}" ;; + freebsd-zfs) rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${DISK}" ;; esac fi Modified: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -166,8 +166,8 @@ setup_fstab() # Set mount options for file-systems case $PARTFS in UFS+J) MNTOPTS="rw,noatime,async" ;; - SWAP) MNTOPTS="sw" ;; - *) MNTOPTS="rw,noatime" ;; + SWAP) MNTOPTS="sw" ;; + *) MNTOPTS="rw,noatime" ;; esac @@ -391,30 +391,28 @@ set_root_pw() run_final_cleanup() { + # Check if we need to run any gmirror setup + ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + # Lets setup gmirror now + setup_gmirror + fi - # Check if we need to run any gmirror setup - ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - # Lets setup gmirror now - setup_gmirror - fi - - # Check if we need to save any geli keys - ls ${GELIKEYDIR}/* >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - # Lets setup geli loading - setup_geli_loading - fi - - # Set a hostname on the install system - setup_hostname + # Check if we need to save any geli keys + ls ${GELIKEYDIR}/* >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + # Lets setup geli loading + setup_geli_loading + fi - # Set the root_pw if it is specified - set_root_pw + # Set a hostname on the install system + setup_hostname - # Generate the fstab for the installed system - setup_fstab + # Set the root_pw if it is specified + set_root_pw + # Generate the fstab for the installed system + setup_fstab }; Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -28,13 +28,14 @@ # Functions related to disk operations using gpart # See if device is a full disk or partition/slice -is_disk() { - for _dsk in `sysctl -n kern.disks` - do - if [ "$_dsk" = "${1}" ] ; then return 0 ; fi - done +is_disk() +{ + for _dsk in `sysctl -n kern.disks` + do + if [ "$_dsk" = "${1}" ] ; then return 0 ; fi + done - return 1 + return 1 } # Get a MBR partitions sysid @@ -190,9 +191,9 @@ get_disk_partitions() for i in ${SLICES} do case $type in - MBR) name="${1}s${i}" ;; - GPT) name="${1}p${i}";; - *) name="${1}s${i}";; + MBR) name="${1}s${i}" ;; + GPT) name="${1}p${i}";; + *) name="${1}s${i}";; esac if [ -z "${RSLICES}" ] then @@ -226,8 +227,19 @@ get_disk_heads() VAL="${head}" ; export VAL }; +# Function which returns a target disks mediasize in sectors +get_disk_mediasize() +{ + mediasize=`diskinfo -v ${1} | grep "# mediasize in sectors" | tr -s ' ' | cut -f 2` + + # Not sure why this is, memory disks need it though. + mediasize=`expr ${mediasize} - 10` + VAL="${mediasize}" ; export VAL +}; + # Function which exports all zpools, making them safe to overwrite potentially -export_all_zpools() { +export_all_zpools() +{ # Export any zpools for i in `zpool list -H -o name` do @@ -434,20 +446,30 @@ setup_disk_slice() if [ ! -z "${DISK}" -a ! -z "${PTYPE}" ] then case ${PTYPE} in - all|ALL) if [ "$PSCHEME" = "MBR" -o -z "$PSCHEME" ] ; then - PSCHEME="MBR" - tmpSLICE="${DISK}s1" - else - tmpSLICE="${DISK}p1" - fi - run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}" ;; - s1|s2|s3|s4) tmpSLICE="${DISK}${PTYPE}" - # Get the number of the slice we are working on - s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`" - run_gpart_slice "${DISK}" "${BMANAGER}" "${s}" ;; - free|FREE) tmpSLICE="${DISK}s${LASTSLICE}" - run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" ;; - *) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;; + all|ALL) + if [ "$PSCHEME" = "MBR" -o -z "$PSCHEME" ] ; then + PSCHEME="MBR" + tmpSLICE="${DISK}s1" + else + tmpSLICE="${DISK}p1" + fi + + run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}" + ;; + + s1|s2|s3|s4) + tmpSLICE="${DISK}${PTYPE}" + # Get the number of the slice we are working on + s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`" + run_gpart_slice "${DISK}" "${BMANAGER}" "${s}" + ;; + + free|FREE) + tmpSLICE="${DISK}s${LASTSLICE}" + run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" + ;; + + *) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;; esac # Now save which disk<num> this is, so we can parse it later during slice partition setup @@ -478,7 +500,8 @@ setup_disk_slice() }; # Stop all gjournals on disk / slice -stop_gjournal() { +stop_gjournal() +{ _gdsk="$1" # Check if we need to shutdown any journals on this drive ls /dev/${_gdsk}*.journal >/dev/null 2>/dev/null @@ -565,7 +588,11 @@ init_mbr_full_disk() # Multiply them all together to get our total blocks totalblocks="`expr ${cyl} \* ${head}`" totalblocks="`expr ${totalblocks} \* ${sec}`" - + if [ -z "${totalblocks}" ] + then + get_disk_mediasize "${_intDISK}" + totalblocks="${VAL}" + fi # Now set the ending block to the total disk block size sizeblock="`expr ${totalblocks} - ${startblock}`" Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Tue Aug 24 00:23:40 2010 (r211729) +++ head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Tue Aug 24 06:11:46 2010 (r211730) @@ -54,39 +54,41 @@ start_extract_uzip_tar() echo_log "pc-sysinstall: Starting Extraction" case ${PACKAGETYPE} in - uzip) # Start by mounting the uzip image - MDDEVICE=`mdconfig -a -t vnode -o readonly -f ${INSFILE}` - mkdir -p ${FSMNT}.uzip - mount -r /dev/${MDDEVICE}.uzip ${FSMNT}.uzip - if [ "$?" != "0" ] - then - exit_err "ERROR: Failed mounting the ${INSFILE}" - fi - cd ${FSMNT}.uzip - - # Copy over all the files now! - tar cvf - . 2>/dev/null | tar -xpv -C ${FSMNT} ${TAROPTS} -f - 2>&1 | tee -a ${FSMNT}/.tar-extract.log - if [ "$?" != "0" ] - then - cd / - echo "TAR failure occured:" >>${LOGOUT} - cat ${FSMNT}/.tar-extract.log | grep "tar:" >>${LOGOUT} - umount ${FSMNT}.uzip - mdconfig -d -u ${MDDEVICE} - exit_err "ERROR: Failed extracting the tar image" - fi - - # All finished, now lets umount and cleanup - cd / - umount ${FSMNT}.uzip - mdconfig -d -u ${MDDEVICE} - ;; - tar) tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1 - if [ "$?" != "0" ] - then - exit_err "ERROR: Failed extracting the tar image" - fi - ;; + uzip) + # Start by mounting the uzip image + MDDEVICE=`mdconfig -a -t vnode -o readonly -f ${INSFILE}` + mkdir -p ${FSMNT}.uzip + mount -r /dev/${MDDEVICE}.uzip ${FSMNT}.uzip + if [ "$?" != "0" ] + then + exit_err "ERROR: Failed mounting the ${INSFILE}" + fi + cd ${FSMNT}.uzip + + # Copy over all the files now! + tar cvf - . 2>/dev/null | tar -xpv -C ${FSMNT} ${TAROPTS} -f - 2>&1 | tee -a ${FSMNT}/.tar-extract.log + if [ "$?" != "0" ] + then + cd / + echo "TAR failure occured:" >>${LOGOUT} + cat ${FSMNT}/.tar-extract.log | grep "tar:" >>${LOGOUT} + umount ${FSMNT}.uzip + mdconfig -d -u ${MDDEVICE} + exit_err "ERROR: Failed extracting the tar image" + fi + + # All finished, now lets umount and cleanup + cd / + umount ${FSMNT}.uzip + mdconfig -d -u ${MDDEVICE} + ;; + tar) + tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1 + if [ "$?" != "0" ] + then + exit_err "ERROR: Failed extracting the tar image" + fi + ;; esac # Check if this was a FTP download and clean it up now @@ -120,10 +122,10 @@ start_extract_split() DIRS=`ls -d ${INSDIR}/*|grep -Ev '(uzip|kernels|src)'` for dir in ${DIRS} do - cd "${dir}" - if [ -f "install.sh" ] - then - echo_log "Extracting" `basename ${dir}` + cd "${dir}" + if [ -f "install.sh" ] + then + echo_log "Extracting" `basename ${dir}` echo "y" | sh install.sh >/dev/null if [ "$?" != "0" ] then @@ -139,13 +141,13 @@ start_extract_split() cd "${KERNELS}" if [ -f "install.sh" ] then - echo_log "Extracting" `basename ${KERNELS}` + echo_log "Extracting" `basename ${KERNELS}` echo "y" | sh install.sh generic >/dev/null if [ "$?" != "0" ] then exit_err "ERROR: Failed extracting ${KERNELS}" fi - echo 'kernel="GENERIC"' > "${FSMNT}/boot/loader.conf" + mv "${FSMNT}/boot/GENERIC" "${FSMNT}/boot/kernel" else exit_err "ERROR: ${KERNELS}/install.sh does not exist" fi @@ -155,7 +157,7 @@ start_extract_split() cd "${SOURCE}" if [ -f "install.sh" ] then - echo_log "Extracting" `basename ${SOURCE}` + echo_log "Extracting" `basename ${SOURCE}` echo "y" | sh install.sh all >/dev/null if [ "$?" != "0" ] then @@ -206,14 +208,14 @@ fetch_install_file() # Function which will download freebsd install files fetch_split_files() { - get_value_from_cfg ftpHost + get_ftpHost if [ -z "$VAL" ] then exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!" fi FTPHOST="${VAL}" - get_value_from_cfg ftpDir + get_ftpDir if [ -z "$VAL" ] then exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!" @@ -228,6 +230,18 @@ fetch_split_files() OUTFILE="${FSMNT}/.fetch-${INSFILE}" fi + DIRS="base catpages dict doc games info manpages proflibs kernels src" + if [ "${FBSD_ARCH}" = "amd64" ] + then + DIRS="${DIRS} lib32" + fi + + for d in ${DIRS} + do + mkdir -p "${OUTFILE}/${d}" + done + + NETRC="${OUTFILE}/.netrc" cat<<EOF>"${NETRC}" machine ${FTPHOST} @@ -238,22 +252,16 @@ bin prompt EOF - DIRS="base catpages dict doc games info manpages proflibs kernels src" - if [ "${FBSD_ARCH}" = "amd64" ] - then - DIRS="${DIRS} lib32" - fi - for d in ${DIRS} do - cat<<EOF>>"${NETRC}" + cat<<EOF>>"${NETRC}" cd ${FTPDIR}/${d} lcd ${OUTFILE}/${d} mreget * EOF done - cat<<EOF>>"${NETRC}" + cat<<EOF>>"${NETRC}" bye @@ -335,19 +343,19 @@ init_extraction() if [ "$INSTALLTYPE" = "FreeBSD" ] then case $PACKAGETYPE in - uzip) INSFILE="${FBSD_UZIP_FILE}" ;; - tar) INSFILE="${FBSD_TAR_FILE}" ;; - split) - INSDIR="${FBSD_BRANCH_DIR}" - - # This is to trick opt_mount into not failing - INSFILE="${INSDIR}" - ;; + uzip) INSFILE="${FBSD_UZIP_FILE}" ;; + tar) INSFILE="${FBSD_TAR_FILE}" ;; + split) + INSDIR="${FBSD_BRANCH_DIR}" + + # This is to trick opt_mount into not failing + INSFILE="${INSDIR}" + ;; esac else case $PACKAGETYPE in - uzip) INSFILE="${UZIP_FILE}" ;; - tar) INSFILE="${TAR_FILE}" ;; + uzip) INSFILE="${UZIP_FILE}" ;; + tar) INSFILE="${TAR_FILE}" ;; esac fi export INSFILE @@ -355,33 +363,37 @@ init_extraction() # Lets start by figuring out what medium we are using case ${INSTALLMEDIUM} in - dvd|usb) # Lets start by mounting the disk - opt_mount - if [ ! -z "${INSDIR}" ] - then - INSDIR="${CDMNT}/${INSDIR}" ; export INSDIR - start_extract_split - - else - INSFILE="${CDMNT}/${INSFILE}" ; export INSFILE - start_extract_uzip_tar - fi - ;; - ftp) - if [ "$PACKAGETYPE" = "split" ] - then - fetch_split_files - - INSDIR="${INSFILE}" ; export INSDIR - start_extract_split - else - fetch_install_file - start_extract_uzip_tar - fi - ;; - rsync) start_rsync_copy - ;; - *) exit_err "ERROR: Unknown install medium" ;; + dvd|usb) + # Lets start by mounting the disk + opt_mount + if [ ! -z "${INSDIR}" ] + then + INSDIR="${CDMNT}/${INSDIR}" ; export INSDIR + start_extract_split + + else + INSFILE="${CDMNT}/${INSFILE}" ; export INSFILE + start_extract_uzip_tar + fi + ;; + + ftp|sftp) + if [ "$PACKAGETYPE" = "split" ] + then + fetch_split_files + + INSDIR="${INSFILE}" ; export INSDIR + start_extract_split + else + fetch_install_file + start_extract_uzip_tar + fi + ;; + + rsync) start_rsync_copy ;; + img) + ;; + *) exit_err "ERROR: Unknown install medium" ;; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008240611.o7O6Bkpi065153>