mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-19 02:29:40 +00:00
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)
This commit is contained in:
parent
f3ae23b34b
commit
c49e3f837c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=225657
@ -90,7 +90,7 @@ if [ $? -eq 0 -a "${SLICENUM}" = "1" ] ; then
|
||||
fi
|
||||
|
||||
# If we have a starting block, use it
|
||||
if [ -z "$STARTBLOCK" ] ; then
|
||||
if [ -n "$STARTBLOCK" ] ; then
|
||||
sBLOCK="-b $STARTBLOCK"
|
||||
fi
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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 installType installMedium packageType"
|
||||
# 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"
|
||||
|
@ -184,7 +184,7 @@ the listing of any additional diskX= directives.
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user