summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2010-12-17 19:19:31 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2010-12-17 19:36:53 +0100
commita773620cca0122cf9dae166636ded643dddbb53c (patch)
treee2e4d3c5d2bd334eef74176f1e2a08363166ef0c /src
parent20c3bc4eb1dc968cf40a35c4f4cd00a225c072f3 (diff)
centralize interactive rollback code, ask for rollback when needed when aborting interactive install
Diffstat (limited to 'src')
-rw-r--r--src/core/libs/lib-ui-interactive.sh39
-rw-r--r--src/core/procedures/interactive11
2 files changed, 35 insertions, 15 deletions
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 00592b7..a77a873 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -220,20 +220,7 @@ interactive_prepare_disks ()
interactive_filesystems && ret=0 && NEXTITEM=5 && DISK_CONFIG_TYPE=manual
;;
"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
- then
- inform "Rollback succeeded"
- else
- show_warning "Rollback failed" "Rollback failed"
- fi
- fi
- ;;
+ interactive_rollback_filesystems;;
"5")
DONE=1 ;;
esac
@@ -241,7 +228,31 @@ interactive_prepare_disks ()
return $ret
}
+maybe_interactive_rollback_filesystems ()
+{
+ [ "$BLOCK_ROLLBACK_USELESS" = "1" ] && return 0
+ if ask_yesno "Do you want to rollback your filesystem changes?"
+ then
+ interactive_rollback_filesystems || return $?
+ fi
+ return 0
+}
+# it's up to the caller to decide if it's needed to call this function, so we warn user when he wants to do a useless rollback
+interactive_rollback_filesystems ()
+{
+ if [ "$BLOCK_ROLLBACK_USELESS" = "1" ]
+ then
+ ask_yesno "It seems like there is nothing rollback right now. This operation is useless, but it shouldn't harm. Do you want to continue?" || return
+ fi
+ if rollback_filesystems
+ then
+ inform "Rollback succeeded"
+ else
+ show_warning "Rollback failed" "Rollback failed"
+ return 1
+ fi
+}
interactive_autoprepare()
{
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index 2f90563..0223763 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -87,7 +87,7 @@ mainmenu()
"8")
notify "If the install finished successfully, you can now type 'reboot' to restart the system." && stop_installer ;;
*)
- ask_yesno "Abort Installation?" && stop_installer ;;
+ execute worker abort_installer;;
esac
}
@@ -188,3 +188,12 @@ worker_auto_network ()
return 1
fi
}
+
+worker_abort_installer ()
+{
+ ret=0
+ ask_yesno "Abort Installation?" || return
+ maybe_interactive_rollback_filesystems || ret=$?
+ stop_installer || ret=$?
+ return $ret
+}