summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2010-12-28 15:10:37 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2010-12-28 15:15:58 +0100
commitd2dfddb854d66977f8b30d9fa118a704dd8dfc12 (patch)
tree35bc2b6dbbe3f30750c5547fffee27935a49fc1c
parente079b88505229fe79bd03a3c542f277ffaa4c30e (diff)
manage $EDITOR more properly
since 3cee8e663a4da69456b493acccbda27064209a35 libui-sh can manage the $EDITOR preference, so we can simplify and cleanup our code. we now also explicitly enable the user to change $EDITOR in the interactive procedure even when it is already set correctly, so there is a new menu entry for that.
-rw-r--r--doc/official_installation_guide_en11
-rw-r--r--src/core/libs/lib-ui-interactive.sh31
-rw-r--r--src/core/procedures/interactive43
3 files changed, 37 insertions, 48 deletions
diff --git a/doc/official_installation_guide_en b/doc/official_installation_guide_en
index 40147e1..5d4c0e7 100644
--- a/doc/official_installation_guide_en
+++ b/doc/official_installation_guide_en
@@ -303,9 +303,16 @@ These menu entries are only available when choosing FTP Installation, for
rather obvious reasons. After successful preparation, choose Return to Main
Menu.
+### Set Editor
+
+Allows you to change your editor preference.
+You'll have the choice between nano and vi (and pico/joe/vim if you install those
+in a separate console). You can skip this menu, but you will be asked again when
+needed.
+
#### Set Clock
-Set Clock will allow you to set up your system clock and date.
+Set Clock will allow you to set up your system clock and date.
First you have to say if your hardwareclock is (or should be) in UTC or
localtime.
UTC is preferred, but if you have an OS installed which cannot handle UTC
@@ -471,8 +478,6 @@ Configure System does multiple things:
mkinitcpio.conf's HOOKS, keymap settings in rc.conf, pacman mirror etc)
* preseed some configuration files after you agreed. (eg network settings)
* allow you to manually change important config files for your target system.
- You'll be asked which text editor you want to use.
- You have the choice between nano, joe and vi
* allow you to set the root password for the target.
**Configuration Files**
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 4412af2..c15c3a9 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -65,10 +65,7 @@ prefill_configs () {
interactive_configure_system()
{
- if [ -z "$EDITOR" ]
- then
- interactive_get_editor || return 1
- fi
+ seteditor || return 1
FILE=""
prefill_configs
@@ -1150,12 +1147,9 @@ interactive_grub_menulst () {
generate_grub_menulst
helptext=
grep -q '^/dev/mapper' $TMP_FSTAB && helptext=" /dev/mapper/ users: Pay attention to the kernel line!"
- notify "Before installing GRUB, you must review the configuration file. You will now be put into the editor. After you save your changes and exit the editor, you can install GRUB.$helptext"
- if [ -z "$EDITOR" ]
- then
- interactive_get_editor || return 1
- fi
- $EDITOR $grubmenu
+ notify "Before installing GRUB, you must review the configuration file. You will now be put into the editor. After you save your changes and exit the editor, you can install GRUB.$helptext"
+ seteditor || return 1
+ $EDITOR $grubmenu
}
interactive_grub_install () {
@@ -1261,23 +1255,6 @@ interactive_select_mirror() {
echo "Using mirror: $var_SYNC_URL" >$LOG
}
-# geteditor().
-# prompts the user to choose an editor
-# sets EDITOR global variable
-#
-interactive_get_editor() {
- unset EDITOR_OPTS
- declare -A editors=(["nano"]="nano (easier)" ["joe"]="joe (bit more powerful)" ["vi"]="vi (advanced)")
- for editor in ${!editors[@]}
- do
- which $editor &>/dev/null && EDITOR_OPTS+=($editor "${editors[$editor]}")
- done
- ask_option nano "Text editor selection" "Select a Text Editor to Use" required "${EDITOR_OPTS[@]}" || return 1
- EDITOR=nano
- check_is_in "$ANSWER_OPTION" "${!editors[@]}" && EDITOR=$ANSWER_OPTION
-}
-
-
select_source_extras_menu ()
{
while true; do
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index 0223763..d638e1c 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -4,7 +4,6 @@ depend_procedure core base # esp for auto_{network,locale,fstab}, intro and set_
# This is a port of the original /arch/setup script. It doesn't use aif phases but uses it's own menu-based flow (phase) control
-EDITOR=
BLOCK_ROLLBACK_USELESS=1
# clock
@@ -16,6 +15,7 @@ TIMEZONE=
DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3"
worker_select_source_title='Select Source'
+worker_set_editor_title='Set Editor'
worker_runtime_network_title='Setup Network'
worker_select_mirror_title='Choose Mirror'
worker_set_clock_title='Set clock'
@@ -51,40 +51,43 @@ mainmenu()
ask_option $default "MAIN MENU" '' required \
"1" "$worker_select_source_title" \
- "2" "$worker_set_clock_title" \
- "3" "$worker_prepare_disks_title" \
- "4" "$worker_package_list_title" \
- "5" "$worker_install_packages_title" \
- "6" "$worker_configure_system_title" \
- "7" "$worker_install_bootloader_title" \
- "8" "Exit Install"
+ "2" "$worker_set_editor_title" \
+ "3" "$worker_set_clock_title" \
+ "4" "$worker_prepare_disks_title" \
+ "5" "$worker_package_list_title" \
+ "6" "$worker_install_packages_title" \
+ "7" "$worker_configure_system_title" \
+ "8" "$worker_install_bootloader_title" \
+ "9" "Exit Install"
case $ANSWER_OPTION in
"1")
execute worker select_source; local ret=$?; [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = net ] && execute worker select_source_extras_menu
[ $ret -eq 0 ] && execute worker runtime_packages && NEXTITEM=2 ;;
- "2")
- execute worker set_clock && NEXTITEM=3 ;;
+ "2")
+ execute worker set_editor && NEXTITEM=3 ;;
"3")
- execute worker prepare_disks && NEXTITEM=4 ;;
+ execute worker set_clock && NEXTITEM=4 ;;
"4")
- check_depend worker prepare_disks && \
- check_depend worker select_source && execute worker package_list && NEXTITEM=5 ;;
+ execute worker prepare_disks && NEXTITEM=5 ;;
"5")
+ check_depend worker prepare_disks && \
+ check_depend worker select_source && execute worker package_list && NEXTITEM=6 ;;
+ "6")
check_depend worker package_list && \
check_depend worker select_source && execute worker install_packages && { execute worker auto_fstab ; \
execute worker auto_locale ; \
execute worker auto_keymap_font;
- true ; } && NEXTITEM=6 ;;
- "6")
+ true ; } && NEXTITEM=7 ;;
+ "7")
check_depend worker install_packages && execute worker auto_network && \
execute worker configure_system && { execute worker mkinitcpio ; \
execute worker locales ;
execute worker initialtime ;
- true ; } && NEXTITEM=7 ;;
- "7")
- check_depend worker configure_system && execute worker install_bootloader && NEXTITEM=8 ;;
+ true ; } && NEXTITEM=8 ;;
"8")
+ check_depend worker configure_system && execute worker install_bootloader && NEXTITEM=9 ;;
+ "9")
notify "If the install finished successfully, you can now type 'reboot' to restart the system." && stop_installer ;;
*)
execute worker abort_installer;;
@@ -112,6 +115,10 @@ worker_select_source ()
return 1
}
+worker_set_editor ()
+{
+ seteditor force
+}
worker_intro ()
{