installer: support for separate /boot partition (which is required for LVM support)

This commit is contained in:
Silvan Calarco 2014-06-25 19:18:28 +02:00
parent af01e050d4
commit 27e3ed99f7
2 changed files with 759 additions and 416 deletions

File diff suppressed because it is too large Load Diff

View File

@ -170,6 +170,26 @@ if [ "$INSTALL_HOME_DEVICE" ]; then
esac
fi
if [ "$INSTALL_BOOT_DEVICE" ]; then
case "$INSTALL_BOOT_FSTYPE" in
ext2|ext3|ext4) FORMAT_BOOT_CMD="/sbin/mkfs.$INSTALL_BOOT_FSTYPE"
FORMAT_BOOT_APPEND="$FORMAT_APPEND -L boot"
;;
reiserfs|reiser4) FORMAT_BOOT_CMD="/sbin/mkfs.$INSTALL_BOOT_FSTYPE"
FORMAT_BOOT_APPEND="$FORMAT_APPEND -ff -l home"
;;
*) FORMAT_BOOT_CMD="/sbin/mkfs.$INSTALL_BOOT_FSTYPE"
[ -e "$FORMAT_BOOT_CMD" ] || {
echo $"Error: $INSTALL_BOOT_FSTYPE is not a supported filesystem type; aborting." >&2
abort
}
;;
"") echo $"Error: filesystem type non specified; aborting." >&2
abort
;;
esac
fi
[ $INSTALL_DEVICE ] || {
echo $"Error: installation device is not defined in $INPUT_FILE; aborting." >&2
abort
@ -216,6 +236,7 @@ mapfile=`tempfile 2>/dev/null`
set -- $line
[ "$1" = "${INSTALL_DEVICE:0:8}" ] && REMAPPED_INSTALL_DEVICE="${INSTALL_DEVICE:0:7}${LETTERS[CURR_DRIVE_LETTER]}${INSTALL_DEVICE:8:2}"
[ "$1" = "${INSTALL_HOME_DEVICE:0:8}" ] && REMAPPED_INSTALL_HOME_DEVICE="${INSTALL_HOME_DEVICE:0:7}${LETTERS[CURR_DRIVE_LETTER]}${INSTALL_HOME_DEVICE:8:2}"
[ "$1" = "${INSTALL_BOOT_DEVICE:0:8}" ] && REMAPPED_INSTALL_BOOT_DEVICE="${INSTALL_BOOT_DEVICE:0:7}${LETTERS[CURR_DRIVE_LETTER]}${INSTALL_BOOT_DEVICE:8:2}"
[ "$2" = "$INSTALL_DRIVER" ] && {
DEV_NAME_ORIG=(${DEV_NAME_ORIG[*]} $1)
DEV_NAME_DEST=(${DEV_NAME_DEST[*]} ${1:0:7}${LETTERS[CURR_DRIVE_LETTER]})
@ -227,6 +248,7 @@ mapfile=`tempfile 2>/dev/null`
done < $mapfile
[ "$REMAPPED_INSTALL_DEVICE" ] || REMAPPED_INSTALL_DEVICE=$INSTALL_DEVICE
[ "$REMAPPED_INSTALL_HOME_DEVICE" ] || REMAPPED_INSTALL_HOME_DEVICE=$INSTALL_HOME_DEVICE
[ "$REMAPPED_INSTALL_BOOT_DEVICE" ] || REMAPPED_INSTALL_BOOT_DEVICE=$INSTALL_BOOT_DEVICE
echo $"Install device $INSTALL_DEVICE will be known as $REMAPPED_INSTALL_DEVICE in the installed system"
# other drivers follow the root disk device driver
@ -259,6 +281,16 @@ if [ "$INSTALL_HOME_DEVICE" ]; then
}
fi
if [ "$INSTALL_BOOT_DEVICE" ]; then
mount | grep "$INSTALL_BOOT_DEVICE " && {
echo $"Info: device $INSTALL_BOOT_DEVICE already mounted; unmounting."
umount $INSTALL_BOOT_DEVICE || {
echo $"Error: could not unmount $INSTALL_BOOT_DEVICE; aborting." >&2
abort
}
}
fi
mount | grep "$INSTALL_DEVICE " && {
echo $"Info: device $INSTALL_DEVICE already mounted; unmounting."
[ -e $MOUNTPOINT/dev ] && umount $MOUNTPOINT/dev
@ -319,7 +351,7 @@ if [ "$INSTALL_HOME_DEVICE" ]; then
echo $"Formatting device $INSTALL_HOME_DEVICE"
$FORMAT_HOME_CMD $INSTALL_HOME_DEVICE $FORMAT_HOME_APPEND
[ $? -ne 0 ] && {
echo $"Error: could not format device $INSTALL_DEVICE; aborting." >&2
echo $"Error: could not format device $INSTALL_HOME_DEVICE; aborting." >&2
abort
}
fi
@ -333,6 +365,26 @@ if [ "$INSTALL_HOME_DEVICE" ]; then
}
fi
if [ "$INSTALL_BOOT_DEVICE" ]; then
if [ "$INSTALL_BOOT_FORMAT" == "1" ]; then
dcop_write $"Formatting device $INSTALL_BOOT_DEVICE..." 10
echo $"Formatting device $INSTALL_BOOT_DEVICE"
$FORMAT_BOOT_CMD $INSTALL_BOOT_DEVICE $FORMAT_BOOT_APPEND
[ $? -ne 0 ] && {
echo $"Error: could not format device $INSTALL_BOOT_DEVICE; aborting." >&2
abort
}
fi
dcop_write $"Mounting boot filesystem..." 10
echo $"Mounting boot filesystem"
mkdir -p $MOUNTPOINT/boot
mount $INSTALL_BOOT_DEVICE $MOUNTPOINT/boot || {
echo $"Error: could not mount boot filesystem; aborting." >&2
abort
}
fi
echo -n $"Copying files..."
dcop_write $"Copying files..." 15
prog=15
@ -422,6 +474,18 @@ if [ "$INSTALL_HOME_DEVICE" ]; then
echo "$REMAPPED_INSTALL_HOME_DEVICE /home $INSTALL_HOME_FSTYPE defaults,noatime 2 2" >> $MOUNTPOINT/etc/fstab.new
fi
fi
if [ "$INSTALL_BOOT_DEVICE" ]; then
eval `blkid $INSTALL_BOOT_DEVICE -o udev`
[ "$ID_FS_UUID" ] && INSTALL_BOOT_DEVICE_UUID=$ID_FS_UUID || unset INSTALL_BOOT_DEVICE_UUID
[ "$INSTALL_BOOT_FORMAT" == "1" ] || INSTALL_BOOT_FSTYPE="auto"
if [ "$INSTALL_BOOT_DEVICE_UUID" ]; then
echo "UUID=$INSTALL_BOOT_DEVICE_UUID /boot $INSTALL_BOOT_FSTYPE defaults 1 1" >> $MOUNTPOINT/etc/fstab.new
else
echo "$REMAPPED_INSTALL_BOOT_DEVICE /boot $INSTALL_BOOT_FSTYPE defaults 1 1" >> $MOUNTPOINT/etc/fstab.new
fi
fi
mv $MOUNTPOINT/etc/fstab.new $MOUNTPOINT/etc/fstab
if [ "$INSTALL_DRIVER" ]; then
@ -635,6 +699,7 @@ umount $MOUNTPOINT/proc
umount $MOUNTPOINT/run
umount $MOUNTPOINT/sys
[ "$INSTALL_HOME_DEVICE" ] && umount $MOUNTPOINT/home
[ "$INSTALL_BOOT_DEVICE" ] && umount $MOUNTPOINT/boot
# NOTE: move INPUT_FILE instead of copying to prevent mambawelcome from starting from
# bootusb after an installation