diff options
Diffstat (limited to 'src/core/libs/lib-ui-interactive.sh')
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 86 |
1 files changed, 3 insertions, 83 deletions
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index a639214..032f57e 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -209,95 +209,15 @@ interactive_autoprepare() || return 1 DEVICE=$DISC + # TODO: why do we define a $DEFAULTFS variable someplace else if we hardcode it's attributes here to be able to replace them with custom values? Can't we just construct the custom thing? FSSPECS=$(echo $DEFAULTFS | sed -e "s|/:7500:ext3|/:$ROOT_PART_SIZE:$FSTYPE|g" -e "s|/home:\*:ext3|/home:\*:$FSTYPE|g" -e "s|swap:256|swap:$SWAP_PART_SIZE|g" -e "s|/boot:32|/boot:$BOOT_PART_SIZE|g") sfdisk_input="" # we assume a /dev/hdX format (or /dev/sdX) PART_ROOT="${DEVICE}3" - # validate DEVICE - if [ ! -b "$DEVICE" ]; then - notify "Device '$DEVICE' is not valid" - return 1 - fi - - # validate DEST - if [ ! -d "$var_TARGET_DIR" ]; then - notify "Destination directory '$var_TARGET_DIR' is not valid" - return 1 - fi - - # / required - if [ $(echo $FSSPECS | grep '/:' | wc -l) -ne 1 ]; then - notify "Need exactly one root partition" - return 1 - fi - - rm -f $TMP_FSTAB - - target_umountall - - # setup input var for sfdisk - for fsspec in $FSSPECS; do - fssize=$(echo $fsspec | tr -d ' ' | cut -f2 -d:) - if [ "$fssize" = "*" ]; then - fssize_spec=';' - else - fssize_spec=",$fssize" - fi - fstype=$(echo $fsspec | tr -d ' ' | cut -f3 -d:) - if [ "$fstype" = "swap" ]; then - fstype_spec=",S" - else - fstype_spec="," - fi - bootflag=$(echo $fsspec | tr -d ' ' | cut -f4 -d:) - if [ "$bootflag" = "+" ]; then - bootflag_spec=",*" - else - bootflag_spec="" - fi - sfdisk_input="${sfdisk_input}${fssize_spec}${fstype_spec}${bootflag_spec}\n" - done - sfdisk_input=$(printf "$sfdisk_input") - - # invoke sfdisk - printk off - infofy "Partitioning $DEVICE" - sfdisk $DEVICE -uM >$LOG 2>&1 <<EOF -$sfdisk_input -EOF - if [ $? -gt 0 ]; then - notify "Error partitioning $DEVICE (see $LOG for details)" - printk on - return 1 - fi - printk on - - # need to mount root first, then do it again for the others - part=1 - for fsspec in $FSSPECS; do - mountpoint=$(echo $fsspec | tr -d ' ' | cut -f1 -d:) - fstype=$(echo $fsspec | tr -d ' ' | cut -f3 -d:) - if echo $mountpoint | tr -d ' ' | grep '^/$' 2>&1 > /dev/null; then - _mkfs yes ${DEVICE}${part} "$fstype" "$var_TARGET_DIR" "$mountpoint" || return 1 - fi - part=$(($part + 1)) - done - - # make other filesystems - part=1 - for fsspec in $FSSPECS; do - mountpoint=$(echo $fsspec | tr -d ' ' | cut -f1 -d:) - fstype=$(echo $fsspec | tr -d ' ' | cut -f3 -d:) - if [ $(echo $mountpoint | tr -d ' ' | grep '^/$' | wc -l) -eq 0 ]; then - _mkfs yes ${DEVICE}${part} "$fstype" "$var_TARGET_DIR" "$mountpoint" || return 1 - fi - part=$(($part + 1)) - done - - notify "Auto-prepare was successful" - return 0 + partition "$FSSPECS" && notify "Auto-prepare was successful" && return 0 + return 1 } |