summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-12-14 19:02:47 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-12-14 19:02:47 +0100
commitc2666130a6170b7f2c4d5bd5dde64fb4035275e0 (patch)
treef5f986b201043ad23f6ad83f495b8d5a36a85f3a
parent801b3d4a7f925e7b9ad63f795f7a7bdc92fd75a7 (diff)
make rollback more accessible, assist user more when he needs it and when not + some output cleanup
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh9
-rw-r--r--src/core/procedures/interactive26
2 files changed, 28 insertions, 7 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index 26389d1..0fdcb03 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -385,7 +385,7 @@ process_filesystems ()
# phase 1: create all blockdevices and filesystems in the correct order (for each fs, the underlying block/lvm/devicemapper device must be available so dependencies must be resolved. for lvm:first pv's, then vg's, then lv's etc)
# don't let them mount yet. we take care of all that ourselves in the next phase
- infofy "Phase 1: Creating blockdevices" disks
+ infofy "Phase 1: Creating filesystems & blockdevices" disks
done_filesystems=
for i in `seq 1 10`
do
@@ -435,7 +435,7 @@ process_filesystems ()
do
if [ "$fs_mountpoint" != no_mountpoint ]
then
- infofy "Mounting $part" disks
+ infofy "Mounting $part ($fs_type) on $fs_mountpoint" disks
process_filesystem $part $fs_type no $fs_mountpoint $fs_mount $fs_opts $fs_label $fs_params || returncode=1
elif [ "$fs_type" = swap ]
then
@@ -444,6 +444,7 @@ process_filesystems ()
fi
done
+ BLOCK_ROLLBACK_USELESS=0
[ $returncode -eq 0 ] && infofy "Done processing filesystems/blockdevices" disks 1 && return 0
return $returncode
}
@@ -455,6 +456,7 @@ rollback_filesystems ()
infofy "Rolling back filesystems..." disks
generate_filesystem_list
local warnings=
+ rm -f $TMP_FSTAB
# phase 1: destruct all mounts in the vfs and swapoff swap volumes who are listed in $BLOCK_DATA
# re-order list so that we umount in the correct order. eg first umount /a/b/c, then /a/b. we sort alphabetically, which has the side-effect of sorting by stringlength, hence by vfs dependencies.
@@ -599,6 +601,7 @@ rollback_filesystems ()
fi
[ -n "$warnings" ] && show_warning "Rollback problems" "Some problems occurred while rolling back: $warnings.\n Thisk needs to be fixed before retrying disk/filesystem creation or restarting the installer" && return 1
infofy "Rollback succeeded" disks
+ BLOCK_ROLLBACK_USELESS=1
return 0
}
@@ -662,6 +665,7 @@ process_filesystem ()
lvm-lv) # $fs_params = size string (eg '5G')
lvcreate -L $fs_params $fs_opts -n $fs_label `sed 's#/dev/mapper/##' <<< $part` >$LOG 2>&1; ret=$? ;; #$opts is usually something like -L 10G # Strip '/dev/mapper/' part because device file may not exist. TODO: do i need to activate them?
# don't handle anything else here, we will error later
+ BLOCK_ROLLBACK_USELESS=0
esac
[ "$ret" -gt 0 ] && ( show_warning "process_filesystem error" "Error creating filesystem $fs_type on $part." ; return 1 )
sleep 2
@@ -670,6 +674,7 @@ process_filesystem ()
# Mount it, if requested. Note that it's your responsability to figure out if you want this or not before calling me. This will only work for 'raw' filesystems (ext,reiser,xfs, swap etc. not lvm stuff,dm_crypt etc)
if [ "$fs_mount" = runtime -o "$fs_mount" = target ]
then
+ BLOCK_ROLLBACK_USELESS=0
if [ "$fs_type" = swap ]
then
debug "swaponning $part"
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index d4edfc6..4e90854 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -7,7 +7,7 @@ depend_procedure core base # esp for auto_{network,locale,fstab}, intro and set_
var_TARGET_DIR="/mnt"
EDITOR=
-
+BLOCK_ROLLBACK_USELESS=1
# clock
HARDWARECLOCK=
@@ -136,7 +136,8 @@ worker_prepare_disks()
ret=1 # 1 means unsuccessful. 0 for ok
NEXTITEM=
DISK_CONFIG_TYPE=
-
+ rollbackstr=" (you don't need to do this)"
+ ended_ok worker prepare_disks && rollbackstr=" (looks like you need to do this)" && show_warning "Rollback may be needed" "It seems you already went here. You should probably rollback previous changes before reformatting, otherwise stuff will probably fail"
while [ "$DONE" = "0" ]
do
default=no
@@ -146,11 +147,12 @@ worker_prepare_disks()
"1" "Auto-Prepare (erases the ENTIRE hard drive and sets up partitions and filesystems)" \
"2" "Partition Hard Drives" \
"3" "Configure block devices, filesystems and mountpoints" \
- "4" "Return to Main Menu"
+ "4" "Rollback last changes$rollbackstr" \
+ "5" "Return to Main Menu"
case $ANSWER_OPTION in
"1")
- interactive_autoprepare && NEXTITEM=4 && ret=0 && DISK_CONFIG_TYPE=auto;; #TODO: for some reason. if this completes $?=0, next item will be 1 :/
+ interactive_autoprepare && NEXTITEM=5 && ret=0 && DISK_CONFIG_TYPE=auto;; #TODO: for some reason. if this completes $?=0, next item will be 1 :/
"2")
if [ "$DISK_CONFIG_TYPE" = "auto" ]; then
notify "You have already prepared your filesystems with Auto-prepare" #TODO: allow user to do this anyway. he can change his mind.
@@ -163,9 +165,23 @@ worker_prepare_disks()
if [ "$DISK_CONFIG_TYPE" = "auto" ]; then
notify "You have already prepared your filesystems with Auto-prepare" #TODO: allow user to do this anyway. he can change his mind.
else
- interactive_filesystems && ret=0 && NEXTITEM=4 && DISK_CONFIG_TYPE=manual
+ interactive_filesystems && ret=0 && NEXTITEM=5 && DISK_CONFIG_TYPE=manual
fi
;;
+ "4"
+ if [ "$BLOCK_ROLLBACK_USELESS" = "1" ]
+ then
+ ask_yesno "It seems like you haven't partitioned/formatted/mounted anything yet (or rolled back already). This operation is useless (unless the installer is buggy), but it doesn't harm. Do you want to continue?" || NEXTITEM=5
+ fi
+ if [ $? -eq 0 -o "$BLOCK_ROLLBACK_USELESS" = "0" ]
+ then
+ if rollback_filesystems #TODO: this part doesn't belong here. move it to ui-interactive. (interactive_rollback)
+ then
+ infofy "Rollback succeeded"
+ else
+ show_warning "Rollback failed" "Rollback failed"
+ fi
+ fi
*)
DONE=1 ;;
esac