summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-11-03 20:35:36 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-11-03 20:35:36 +0100
commit148d75ff647feae64c563dfb73f4d650a9b14c4b (patch)
treea746dd59da4a3b7c190292ca54154ff8a62fb12c /src
parente064295974659027d021d01237292025068dfc10 (diff)
fixes for broken interactive_configure_system, interactive_get_editor, _dia_ask_option, configure_system and worker_install_bootloader
Diffstat (limited to 'src')
-rw-r--r--src/core/libs/lib-ui-interactive.sh82
-rw-r--r--src/core/libs/lib-ui.sh17
-rw-r--r--src/core/procedures/interactive8
3 files changed, 52 insertions, 55 deletions
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 87c271c..3f7a0cd 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -29,41 +29,38 @@ interactive_partition() {
interactive_configure_system()
{
- [ "$EDITOR" ] || geteditor
- FILE=""
-
- # main menu loop
- while true; do
- if [ -n "$FILE" ]; then
- DEFAULT="--default-item $FILE"
- else
- DEFAULT=""
- fi
-
- _dia_DIALOG $DEFAULT --menu "Configuration" 17 70 10 \
- "/etc/rc.conf" "System Config" \
- "/etc/fstab" "Filesystem Mountpoints" \
- "/etc/mkinitcpio.conf" "Initramfs Config" \
- "/etc/modprobe.conf" "Kernel Modules" \
- "/etc/resolv.conf" "DNS Servers" \
- "/etc/hosts" "Network Hosts" \
- "/etc/hosts.deny" "Denied Network Services" \
- "/etc/hosts.allow" "Allowed Network Services" \
- "/etc/locale.gen" "Glibc Locales" \
- "/etc/pacman.d/mirrorlist" "Pacman Mirror List" \
- "Root-Password" "Set the root password" \
- "Return" "Return to Main Menu" 2>$ANSWER || FILE="Return"
- FILE="$(cat $ANSWER)"
- if [ "$FILE" = "Return" -o -z "$FILE" ]; then # exit
- break
- elif [ "$FILE" = "Root-Password" ]; then # non-file
- while true; do
- chroot ${TARGET_DIR} passwd root && break
- done
- else #regular file
- $EDITOR ${TARGET_DIR}${FILE}
- fi
- done
+ [ "$EDITOR" ] || interactive_get_editor
+ FILE=""
+
+ # main menu loop
+ while true; do
+ DEFAULT=no
+ [ -n "$FILE" ] && DEFAULT="$FILE"
+ ask_option $DEFAULT "Configuration" \
+ "/etc/rc.conf" "System Config" \
+ "/etc/fstab" "Filesystem Mountpoints" \
+ "/etc/mkinitcpio.conf" "Initramfs Config" \
+ "/etc/modprobe.conf" "Kernel Modules" \
+ "/etc/resolv.conf" "DNS Servers" \
+ "/etc/hosts" "Network Hosts" \
+ "/etc/hosts.deny" "Denied Network Services" \
+ "/etc/hosts.allow" "Allowed Network Services" \
+ "/etc/locale.gen" "Glibc Locales" \
+ "/etc/pacman.d/mirrorlist" "Pacman Mirror List" \
+ "Root-Password" "Set the root password" \
+ "Return" "Return to Main Menu" || FILE="Return"
+ FILE=$ANSWER_OPTION
+
+ if [ "$FILE" = "Return" -o -z "$FILE" ]; then # exit
+ break
+ elif [ "$FILE" = "Root-Password" ]; then # non-file
+ while true; do
+ chroot ${var_TARGET_DIR} passwd root && break
+ done
+ else #regular file
+ $EDITOR ${var_TARGET_DIR}/${FILE}
+ fi
+ done
}
@@ -701,3 +698,18 @@ interactive_select_mirror() {
fi
echo "Using mirror: $var_SYNC_URL" >$LOG
}
+
+# geteditor(). taken from original setup code.
+# prompts the user to choose an editor
+# sets EDITOR global variable
+#
+interactive_get_editor() {
+ _dia_DIALOG --menu "Select a Text Editor to Use" 10 35 3 \
+ "1" "nano (easier)" \
+ "2" "vi" 2>$ANSWER
+ case $(cat $ANSWER) in
+ "1") EDITOR="nano" ;;
+ "2") EDITOR="vi" ;;
+ *) EDITOR="nano" ;;
+ esac
+}
diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh
index 91cfca9..c3c0dcb 100644
--- a/src/core/libs/lib-ui.sh
+++ b/src/core/libs/lib-ui.sh
@@ -185,8 +185,10 @@ _dia_ask_option ()
DIA_MENU_TITLE=$2
shift 2
_dia_DIALOG $DEFAULT --colors --title " $DIA_MENU_TITLE " --menu "$DIA_MENU_TEXT" 16 55 8 "$@" 2>$ANSWER
+ ret=$?
ANSWER_OPTION=`cat $ANSWER`
echo $ANSWER_OPTION
+ return $ret
}
@@ -215,21 +217,6 @@ _cli_ask_option ()
}
-# geteditor(). taken from original setup code. prepended dia_ because power users just export $EDITOR on the cmdline.
-# prompts the user to choose an editor
-# sets EDITOR global variable
-#
-# TODO: clean this up
-_dia_get_editor() {
- _dia_DIALOG --menu "Select a Text Editor to Use" 10 35 3 \
- "1" "nano (easier)" \
- "2" "vi" 2>$ANSWER
- case $(cat $ANSWER) in
- "1") EDITOR="nano" ;;
- "2") EDITOR="vi" ;;
- *) EDITOR="nano" ;;
- esac
-}
# TODO: pass disks as argument to decouple backend logic
# Get a list of available disks for use in the "Available disks" dialogs. This
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index 70ca0de..8357fe4 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -133,11 +133,8 @@ configure_system()
fi
- interactive_configure_system
-
- run_mkinitcpio
- target_locale-gen
-
+ interactive_configure_system && run_mkinitcpio && target_locale-gen && return 0
+ return 1
}
@@ -253,6 +250,7 @@ worker_select_mirror ()
# $1 which one
worker_install_bootloader ()
{
+ bl=`tr '[:upper:]' '[:lower:]' <<< "$1"`
[ "$1" = grub ] && interactive_install_grub && S_BOOT=grub
[ "$1" != grub ] && S_BOOT="$1"
}