2010-06-24 22:21:47 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#-
|
2010-06-27 16:46:11 +00:00
|
|
|
# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
|
2010-06-24 22:21:47 +00:00
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
# SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
# Functions which perform the final cleanup after an install
|
|
|
|
|
|
|
|
# Finishes up with ZFS setup before unmounting
|
|
|
|
zfs_cleanup_unmount()
|
|
|
|
{
|
|
|
|
# Loop through our FS and see if we have any ZFS partitions to cleanup
|
|
|
|
for PART in `ls ${PARTDIR}`
|
|
|
|
do
|
2011-04-21 06:25:12 +00:00
|
|
|
PARTDEV=`echo $PART | sed 's|-|/|g'`
|
2012-03-12 21:32:43 +00:00
|
|
|
PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`"
|
|
|
|
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`"
|
2011-04-21 06:25:12 +00:00
|
|
|
ZPOOLNAME=$(get_zpool_name "${PARTDEV}")
|
2010-06-24 22:21:47 +00:00
|
|
|
|
|
|
|
if [ "$PARTFS" = "ZFS" ]
|
|
|
|
then
|
|
|
|
# Check if we have multiple zfs mounts specified
|
|
|
|
for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'`
|
|
|
|
do
|
|
|
|
if [ "${ZMNT}" = "/" ]
|
|
|
|
then
|
|
|
|
# Make sure we haven't already added the zfs boot line when
|
|
|
|
# Creating a dedicated "/boot" partition
|
2011-03-27 16:57:54 +00:00
|
|
|
cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q "vfs.root.mountfrom=" 2>/dev/null
|
|
|
|
if [ $? -ne 0 ] ; then
|
2012-09-06 14:59:53 +00:00
|
|
|
echo "vfs.root.mountfrom=\"zfs:${ZPOOLNAME}/ROOT/default\"" >> ${FSMNT}/boot/loader.conf
|
2010-06-24 22:21:47 +00:00
|
|
|
fi
|
2011-03-27 16:57:54 +00:00
|
|
|
export FOUNDZFSROOT="${ZPOOLNAME}"
|
2010-06-24 22:21:47 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
FOUNDZFS="1"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ -n "${FOUNDZFS}" ]
|
2010-06-24 22:21:47 +00:00
|
|
|
then
|
|
|
|
# Check if we need to add our ZFS flags to rc.conf, src.conf and loader.conf
|
2011-03-27 16:57:54 +00:00
|
|
|
cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q 'zfs_load="YES"' 2>/dev/null
|
|
|
|
if [ $? -ne 0 ]
|
2010-06-24 22:21:47 +00:00
|
|
|
then
|
|
|
|
echo 'zfs_load="YES"' >>${FSMNT}/boot/loader.conf
|
|
|
|
fi
|
2011-03-27 16:57:54 +00:00
|
|
|
cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep -q 'zfs_enable="YES"' 2>/dev/null
|
|
|
|
if [ $? -ne 0 ]
|
2010-06-24 22:21:47 +00:00
|
|
|
then
|
|
|
|
echo 'zfs_enable="YES"' >>${FSMNT}/etc/rc.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
sleep 2
|
|
|
|
# Copy over any ZFS cache data
|
|
|
|
cp /boot/zfs/* ${FSMNT}/boot/zfs/
|
|
|
|
|
|
|
|
# Copy the hostid so that our zfs cache works
|
|
|
|
cp /etc/hostid ${FSMNT}/etc/hostid
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Loop through our FS and see if we have any ZFS partitions to cleanup
|
|
|
|
for PART in `ls ${PARTDIR}`
|
|
|
|
do
|
2011-04-21 06:25:12 +00:00
|
|
|
PARTDEV=`echo $PART | sed 's|-|/|g'`
|
2012-03-12 21:32:43 +00:00
|
|
|
PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`"
|
|
|
|
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`"
|
|
|
|
PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`"
|
2011-04-21 06:25:12 +00:00
|
|
|
ZPOOLNAME=$(get_zpool_name "${PARTDEV}")
|
2010-06-24 22:21:47 +00:00
|
|
|
|
|
|
|
if [ "$PARTFS" = "ZFS" ]
|
|
|
|
then
|
2011-04-21 06:25:12 +00:00
|
|
|
|
|
|
|
# Create a list of zpool names we can export
|
|
|
|
echo $ZPOOLEXPORTS | grep -q "$ZPOOLNAME "
|
|
|
|
if [ $? -ne 0 ] ; then
|
|
|
|
export ZPOOLEXPORTS="$ZPOOLNAME $ZPOOLEXPORTS"
|
|
|
|
fi
|
|
|
|
|
2010-06-24 22:21:47 +00:00
|
|
|
# Check if we have multiple zfs mounts specified
|
|
|
|
for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'`
|
|
|
|
do
|
2012-03-12 21:32:43 +00:00
|
|
|
ZMNT="`echo $ZMNT | cut -d '(' -f 1`"
|
2010-06-24 22:21:47 +00:00
|
|
|
PARTMNTREV="${ZMNT} ${PARTMNTREV}"
|
|
|
|
done
|
|
|
|
|
|
|
|
for ZMNT in ${PARTMNTREV}
|
|
|
|
do
|
2012-03-12 21:32:43 +00:00
|
|
|
if [ "${ZMNT}" = "/" ] ; then continue ; fi
|
|
|
|
# Some ZFS like /swap aren't mounted, and dont need unmounting
|
|
|
|
mount | grep -q "${FSMNT}${ZMNT}"
|
|
|
|
if [ $? -eq 0 ] ; then
|
2010-06-24 22:21:47 +00:00
|
|
|
rc_halt "zfs unmount ${ZPOOLNAME}${ZMNT}"
|
2012-03-12 21:32:43 +00:00
|
|
|
rc_halt "zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}"
|
2010-06-24 22:21:47 +00:00
|
|
|
fi
|
2012-03-12 21:32:43 +00:00
|
|
|
sleep 2
|
2010-06-24 22:21:47 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
# Function which performs the specific setup for using a /boot partition
|
|
|
|
setup_dedicated_boot_part()
|
|
|
|
{
|
|
|
|
ROOTFS="${1}"
|
|
|
|
ROOTFSTYPE="${2}"
|
|
|
|
BOOTFS="${3}"
|
|
|
|
BOOTMNT="${4}"
|
|
|
|
|
|
|
|
# Set the root mount in loader.conf
|
|
|
|
echo "vfs.root.mountfrom=\"${ROOTFSTYPE}:${ROOTFS}\"" >> ${FSMNT}/boot/loader.conf
|
|
|
|
rc_halt "mkdir -p ${FSMNT}/${BOOTMNT}/boot"
|
|
|
|
rc_halt "mv ${FSMNT}/boot/* ${FSMNT}${BOOTMNT}/boot/"
|
|
|
|
rc_halt "mv ${FSMNT}${BOOTMNT}/boot ${FSMNT}/boot/"
|
2011-04-21 06:25:12 +00:00
|
|
|
rc_halt "umount ${BOOTFS}"
|
|
|
|
rc_halt "mount ${BOOTFS} ${FSMNT}${BOOTMNT}"
|
2010-06-24 22:21:47 +00:00
|
|
|
rc_halt "rmdir ${FSMNT}/boot"
|
|
|
|
|
|
|
|
# Strip the '/' from BOOTMNT before making symlink
|
|
|
|
BOOTMNTNS="`echo ${BOOTMNT} | sed 's|/||g'`"
|
|
|
|
rc_halt "chroot ${FSMNT} ln -s ${BOOTMNTNS}/boot /boot"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
# Function which creates the /etc/fstab for the installed system
|
|
|
|
setup_fstab()
|
|
|
|
{
|
|
|
|
FSTAB="${FSMNT}/etc/fstab"
|
|
|
|
rm ${FSTAB} >/dev/null 2>/dev/null
|
|
|
|
|
|
|
|
# Create the header
|
|
|
|
echo "# Device Mountpoint FStype Options Dump Pass" >> ${FSTAB}
|
|
|
|
|
|
|
|
# Loop through the partitions, and start creating /etc/fstab
|
|
|
|
for PART in `ls ${PARTDIR}`
|
|
|
|
do
|
2011-04-21 06:25:12 +00:00
|
|
|
PARTDEV=`echo $PART | sed 's|-|/|g'`
|
2012-03-12 21:32:43 +00:00
|
|
|
PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`"
|
|
|
|
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`"
|
|
|
|
PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`"
|
|
|
|
PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d '#' -f 4`"
|
2010-06-24 22:21:47 +00:00
|
|
|
|
|
|
|
# Unset EXT
|
|
|
|
EXT=""
|
|
|
|
|
2010-07-31 19:25:51 +00:00
|
|
|
# Set mount options for file-systems
|
|
|
|
case $PARTFS in
|
|
|
|
UFS+J) MNTOPTS="rw,noatime,async" ;;
|
2010-08-24 06:11:46 +00:00
|
|
|
SWAP) MNTOPTS="sw" ;;
|
|
|
|
*) MNTOPTS="rw,noatime" ;;
|
2010-07-31 19:25:51 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
|
2010-06-24 22:21:47 +00:00
|
|
|
# Figure out if we are using a glabel, or the raw name for this entry
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ -n "${PARTLABEL}" ]
|
2010-06-24 22:21:47 +00:00
|
|
|
then
|
|
|
|
DEVICE="label/${PARTLABEL}"
|
|
|
|
else
|
|
|
|
# Check if using encryption
|
|
|
|
if [ "${PARTENC}" = "ON" ] ; then
|
|
|
|
EXT=".eli"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${PARTFS}" = "UFS+J" ] ; then
|
|
|
|
EXT="${EXT}.journal"
|
|
|
|
fi
|
2011-04-21 06:25:12 +00:00
|
|
|
DEVICE="${PARTDEV}${EXT}"
|
2010-06-24 22:21:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Set our ROOTFSTYPE for loader.conf if necessary
|
|
|
|
check_for_mount "${PARTMNT}" "/"
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ $? -eq 0 ] ; then
|
2010-06-24 22:21:47 +00:00
|
|
|
if [ "${PARTFS}" = "ZFS" ] ; then
|
|
|
|
ROOTFSTYPE="zfs"
|
2012-09-06 14:59:53 +00:00
|
|
|
ZPOOLNAME=$(get_zpool_name "${PARTDEV}")
|
|
|
|
ROOTFS="${ZPOOLNAME}/ROOT/default"
|
2010-06-24 22:21:47 +00:00
|
|
|
else
|
|
|
|
ROOTFS="${DEVICE}"
|
|
|
|
ROOTFSTYPE="ufs"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Only create non-zfs partitions
|
|
|
|
if [ "${PARTFS}" != "ZFS" ]
|
|
|
|
then
|
|
|
|
|
|
|
|
# Make sure geom_journal is loaded
|
|
|
|
if [ "${PARTFS}" = "UFS+J" ] ; then
|
|
|
|
setup_gjournal
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Save the BOOTFS for call at the end
|
|
|
|
if [ "${PARTMNT}" = "/boot" ] ; then
|
2011-04-21 06:25:12 +00:00
|
|
|
BOOTFS="${PARTDEV}${EXT}"
|
2010-06-24 22:21:47 +00:00
|
|
|
BOOTMNT="${BOOT_PART_MOUNT}"
|
|
|
|
PARTMNT="${BOOTMNT}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Echo out the fstab entry now
|
|
|
|
if [ "${PARTFS}" = "SWAP" ]
|
|
|
|
then
|
2011-05-27 16:17:35 +00:00
|
|
|
echo "/dev/${DEVICE} none swap ${MNTOPTS} 0 0" >> ${FSTAB}
|
2010-06-24 22:21:47 +00:00
|
|
|
else
|
2011-05-27 16:17:35 +00:00
|
|
|
echo "/dev/${DEVICE} ${PARTMNT} ufs ${MNTOPTS} 1 1" >> ${FSTAB}
|
2010-06-24 22:21:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
fi # End of ZFS Check
|
|
|
|
done
|
|
|
|
|
|
|
|
# Setup some specific PC-BSD fstab options
|
|
|
|
if [ "$INSTALLTYPE" != "FreeBSD" ]
|
|
|
|
then
|
|
|
|
echo "procfs /proc procfs rw 0 0" >> ${FSTAB}
|
|
|
|
echo "linprocfs /compat/linux/proc linprocfs rw 0 0" >> ${FSTAB}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If we have a dedicated /boot, run the post-install setup of it now
|
|
|
|
if [ ! -z "${BOOTMNT}" ] ; then
|
|
|
|
setup_dedicated_boot_part "${ROOTFS}" "${ROOTFSTYPE}" "${BOOTFS}" "${BOOTMNT}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
# Setup our disk mirroring with gmirror
|
|
|
|
setup_gmirror()
|
|
|
|
{
|
2011-03-27 16:57:54 +00:00
|
|
|
cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q 'geom_mirror_load="YES"' 2>/dev/null
|
|
|
|
if [ $? -ne 0 ]
|
2010-06-24 22:21:47 +00:00
|
|
|
then
|
|
|
|
echo 'geom_mirror_load="YES"' >>${FSMNT}/boot/loader.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
# Function which saves geli keys and sets up loading of them at boot
|
|
|
|
setup_geli_loading()
|
|
|
|
{
|
|
|
|
|
|
|
|
# Make our keys dir
|
|
|
|
mkdir -p ${FSMNT}/boot/keys >/dev/null 2>/dev/null
|
|
|
|
|
|
|
|
cd ${GELIKEYDIR}
|
2011-04-21 06:25:12 +00:00
|
|
|
for KEYFILE in `ls`
|
2010-06-24 22:21:47 +00:00
|
|
|
do
|
|
|
|
# Figure out the partition name based on keyfile name removing .key
|
|
|
|
PART="`echo ${KEYFILE} | cut -d '.' -f 1`"
|
2011-04-21 06:25:12 +00:00
|
|
|
PARTDEV="`echo ${PART} | sed 's|-|/|g'`"
|
|
|
|
PARTNAME="`echo ${PART} | sed 's|-dev-||g'`"
|
|
|
|
|
|
|
|
rc_halt "geli configure -b ${PARTDEV}"
|
2010-06-24 22:21:47 +00:00
|
|
|
|
2011-04-21 06:25:12 +00:00
|
|
|
# If no passphrase, setup key files
|
|
|
|
if [ ! -e "${PARTDIR}-enc/${PART}-encpass" ] ; then
|
|
|
|
echo "geli_${PARTNAME}_keyfile0_load=\"YES\"" >> ${FSMNT}/boot/loader.conf
|
|
|
|
echo "geli_${PARTNAME}_keyfile0_type=\"${PARTNAME}:geli_keyfile0\"" >> ${FSMNT}/boot/loader.conf
|
|
|
|
echo "geli_${PARTNAME}_keyfile0_name=\"/boot/keys/${PARTNAME}.key\"" >> ${FSMNT}/boot/loader.conf
|
2010-06-24 22:21:47 +00:00
|
|
|
|
2011-04-21 06:25:12 +00:00
|
|
|
# Copy the key to the disk
|
|
|
|
rc_halt "cp ${GELIKEYDIR}/${KEYFILE} ${FSMNT}/boot/keys/${PARTNAME}.key"
|
2010-06-24 22:21:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
# Make sure we have geom_eli set to load at boot
|
2011-03-27 16:57:54 +00:00
|
|
|
cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q 'geom_eli_load="YES"' 2>/dev/null
|
|
|
|
if [ $? -ne 0 ]
|
2010-06-24 22:21:47 +00:00
|
|
|
then
|
|
|
|
echo 'geom_eli_load="YES"' >>${FSMNT}/boot/loader.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
# Function to generate a random hostname if none was specified
|
|
|
|
gen_hostname()
|
|
|
|
{
|
|
|
|
RAND="`jot -r 1 1 9000`"
|
|
|
|
|
|
|
|
if [ "$INSTALLTYPE" = "FreeBSD" ]
|
|
|
|
then
|
|
|
|
VAL="freebsd-${RAND}"
|
|
|
|
else
|
|
|
|
VAL="pcbsd-${RAND}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
export VAL
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
# Function which sets up the hostname for the system
|
|
|
|
setup_hostname()
|
|
|
|
{
|
|
|
|
|
|
|
|
get_value_from_cfg hostname
|
|
|
|
HOSTNAME="${VAL}"
|
|
|
|
|
|
|
|
# If we don't have a hostname, make one up
|
|
|
|
if [ -z "${HOSTNAME}" ]
|
|
|
|
then
|
|
|
|
gen_hostname
|
|
|
|
HOSTNAME="${VAL}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Clean up any saved hostname
|
|
|
|
cat ${FSMNT}/etc/rc.conf | grep -v "hostname=" >${FSMNT}/etc/rc.conf.new
|
|
|
|
mv ${FSMNT}/etc/rc.conf.new ${FSMNT}/etc/rc.conf
|
|
|
|
|
|
|
|
# Set the hostname now
|
|
|
|
echo_log "Setting hostname: ${HOSTNAME}"
|
|
|
|
echo "hostname=\"${HOSTNAME}\"" >> ${FSMNT}/etc/rc.conf
|
|
|
|
sed -i -e "s|my.domain|${HOSTNAME} ${HOSTNAME}|g" ${FSMNT}/etc/hosts
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
# Check and make sure geom_journal is enabled on the system
|
|
|
|
setup_gjournal()
|
|
|
|
{
|
|
|
|
|
|
|
|
# Make sure we have geom_journal set to load at boot
|
2011-03-27 16:57:54 +00:00
|
|
|
cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep -q 'geom_journal_load="YES"' 2>/dev/null
|
|
|
|
if [ $? -ne 0 ]
|
2010-06-24 22:21:47 +00:00
|
|
|
then
|
|
|
|
echo 'geom_journal_load="YES"' >>${FSMNT}/boot/loader.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
# Function which sets the root password from the install config
|
|
|
|
set_root_pw()
|
|
|
|
{
|
2011-01-10 19:57:18 +00:00
|
|
|
# Get the plaintext string
|
2010-06-24 22:21:47 +00:00
|
|
|
get_value_from_cfg_with_spaces rootPass
|
2011-01-10 19:57:18 +00:00
|
|
|
local PW="${VAL}"
|
|
|
|
|
|
|
|
# Get the encrypted string
|
|
|
|
get_value_from_cfg_with_spaces rootEncPass
|
|
|
|
local ENCPW="${VAL}"
|
2010-06-24 22:21:47 +00:00
|
|
|
|
|
|
|
# If we don't have a root pass, return
|
2011-01-10 19:57:18 +00:00
|
|
|
if [ -z "${PW}" -a -z "${ENCPW}" ] ; then return 0 ; fi
|
2010-06-24 22:21:47 +00:00
|
|
|
|
|
|
|
echo_log "Setting root password"
|
2011-01-10 19:57:18 +00:00
|
|
|
|
|
|
|
# Check if setting plaintext password
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ -n "${PW}" ] ; then
|
2011-01-10 19:57:18 +00:00
|
|
|
echo "${PW}" > ${FSMNT}/.rootpw
|
|
|
|
run_chroot_cmd "cat /.rootpw | pw usermod root -h 0"
|
|
|
|
rc_halt "rm ${FSMNT}/.rootpw"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check if setting encrypted password
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ -n "${ENCPW}" ] ; then
|
2011-01-10 19:57:18 +00:00
|
|
|
echo "${ENCPW}" > ${FSMNT}/.rootpw
|
|
|
|
run_chroot_cmd "cat /.rootpw | pw usermod root -H 0"
|
|
|
|
rc_halt "rm ${FSMNT}/.rootpw"
|
|
|
|
fi
|
2010-06-24 22:21:47 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
run_final_cleanup()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
# Check if we need to run any gmirror setup
|
|
|
|
ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ $? -eq 0 ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
|
|
|
# Lets setup gmirror now
|
|
|
|
setup_gmirror
|
|
|
|
fi
|
2010-06-24 22:21:47 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
# Check if we need to save any geli keys
|
|
|
|
ls ${GELIKEYDIR}/* >/dev/null 2>/dev/null
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ $? -eq 0 ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
|
|
|
# Lets setup geli loading
|
|
|
|
setup_geli_loading
|
|
|
|
fi
|
2010-06-24 22:21:47 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
# Set a hostname on the install system
|
|
|
|
setup_hostname
|
2010-06-24 22:21:47 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
# Set the root_pw if it is specified
|
|
|
|
set_root_pw
|
2010-06-24 22:21:47 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
# Generate the fstab for the installed system
|
|
|
|
setup_fstab
|
2010-06-24 22:21:47 +00:00
|
|
|
};
|