summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-11-03 16:22:59 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-11-03 16:22:59 +0100
commit127d05e56fa08ca40b4301db2df99ea92d3fd218 (patch)
tree4b6d4d093f14db2dfd7df4fccf70ca6df9250d7e /src/core
parent4e23ce966b8e6697784518ab75cb35517bba23d0 (diff)
main menu uses new lib-based menu
Diffstat (limited to 'src/core')
-rw-r--r--src/core/procedures/interactive30
-rw-r--r--src/core/procedures/interactive~277
2 files changed, 290 insertions, 17 deletions
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index b8d1cb9..52a6dbf 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -62,23 +62,19 @@ start_process ()
mainmenu()
{
- if [ -n "$NEXTITEM" ]; then
- DEFAULT="--default-item $NEXTITEM"
- else
- DEFAULT=""
- fi
- _dia_DIALOG $DEFAULT --title " MAIN MENU " \
- --menu "Use the UP and DOWN arrows to navigate menus. Use TAB to switch between buttons and ENTER to select." 16 55 8 \
- "0" "Select Source" \
- "1" "Set Clock" \
- "2" "Prepare Hard Drive" \
- "3" "Select Packages" \
- "4" "Install Packages" \
- "5" "Configure System" \
- "6" "Install Bootloader" \
- "7" "Exit Install" 2>$ANSWER
- NEXTITEM="$(cat $ANSWER)"
- case $(cat $ANSWER) in
+ default=no
+ [ -n "$NEXTITEM" ] && default="$NEXTITEM"
+ ask_option $default "MAIN MENU" \
+ "0" "Select Source" \
+ "1" "Set Clock" \
+ "2" "Prepare Hard Drive" \
+ "3" "Select Packages" \
+ "4" "Install Packages" \
+ "5" "Configure System" \
+ "6" "Install Bootloader" \
+ "7" "Exit Install"
+ NEXTITEM="$(cat $ANSWER)"
+ case $(cat $ANSWER) in
"0")
execute worker select_source; ret=$?
if [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = "ftp" ]; then
diff --git a/src/core/procedures/interactive~ b/src/core/procedures/interactive~
new file mode 100644
index 0000000..683233e
--- /dev/null
+++ b/src/core/procedures/interactive~
@@ -0,0 +1,277 @@
+#!/bin/sh
+depend_procedure core base # esp for auto_{network,locale,fstab} workers
+
+
+# This is a port of the original /arch/setup script. It doesn't use fifa phases but uses it's own menu-based flow (phase) control
+
+
+TARGET_DIR="/mnt"
+EDITOR=
+
+
+# clock
+HARDWARECLOCK=
+TIMEZONE=
+
+# partitions
+PART_ROOT=
+
+# default filesystem specs (the + is bootable flag)
+# <mountpoint>:<partsize>:<fstype>[:+]
+DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3"
+
+
+
+start_process ()
+{
+ #####################
+ ## begin execution ##
+
+ # install stages
+ S_SRC=0 # choose install medium
+ S_NET=0 # network configuration
+ S_CLOCK=0 # clock and timezone
+ S_PART=0 # partitioning
+ S_MKFS=0 # formatting
+ S_MKFSAUTO=0 # auto fs part/formatting TODO: kill this
+ S_SELECT=0 # package selection
+ S_INSTALL=0 # package installation
+ S_CONFIG=0 # configuration editing
+ S_GRUB=0 # TODO: kill this - if using grub
+ S_BOOT="" # bootloader installed (set to loader name instead of 1)
+
+ var_UI_TYPE=dia
+
+ notify "Welcome to the Arch Linux Installation program. The install \
+ process is fairly straightforward, and you should run through the options in \
+ the order they are presented. If you are unfamiliar with partitioning/making \
+ filesystems, you may want to consult some documentation before continuing. \
+ You can view all output from commands by viewing your VC7 console (ALT-F7). \
+ ALT-F1 will bring you back here."
+
+ # menu item tracker- autoselect the next item
+ NEXTITEM=""
+
+ while true
+ do
+ mainmenu
+ done
+
+}
+
+
+mainmenu()
+{
+ default=no
+ [ -n "$NEXTITEM" ] && default="$NEXTITEM"
+ ask_option $default "MAIN MENU" \
+ "0" "Select Source" \
+ "1" "Set Clock" \
+ "2" "Prepare Hard Drive" \
+ "3" "Select Packages" \
+ "4" "Install Packages" \
+ "5" "Configure System" \
+ "6" "Install Bootloader" \
+ "7" "Exit Install"
+ NEXTITEM="$(cat $ANSWER)"
+ case $(cat $ANSWER) in
+ "0")
+ execute worker select_source; ret=$?
+ if [ $ret -eq 0 -a "$var_PKG_SOURCE_TYPE" = "ftp" ]; then
+ while true; do
+ _dia_DIALOG --menu "FTP Installation" 10 35 3 \
+ "0" "Setup Network (Make sure the network is ok before continuing" \
+ "1" "Choose Mirror" \
+ "2" "Return to Main Menu" 2>$ANSWER
+ case "$(cat $ANSWER)" in
+ "0")
+ execute worker runtime_network && S_NET=1;;
+ "1")
+ execute worker select_mirror ;;
+ *)
+ break ;;
+ esac
+ done
+ fi
+ [ $ret -eq 0 ] && S_SRC=1 && execute worker runtime_packages ;;
+ "1")
+ execute worker set_clock && S_CLOCK=1 ;;
+ "2")
+ execute worker prepare_disks ;; # stage set vars set in the worker
+ "3")
+ execute worker package_list && S_SELECT=1 ;;
+ "4")
+ execute worker install_packages && S_INSTALL=1 && { execute worker auto_fstab; execute worker auto_network; execute worker auto_locale; } ;;
+ "5")
+ execute worker configure_system && S_CONFIG=1 && { execute worker mkinitcpio; execute worker locales; } ;;
+ "6")
+ _dia_DIALOG --colors --menu "Which bootloader would you like to use? Grub is the Arch default.\n\n" 10 65 2 \
+ "GRUB" "Use the GRUB bootloader (default)" \
+ "None" "\Zb\Z1Warning\Z0\ZB: you must install your own bootloader!" 2>$ANSWER
+ execute worker install_bootloader "`cat $ANSWER`";;
+ "7")
+ echo ""
+ echo "If the install finished successfully, you can now type 'reboot'"
+ echo "to restart the system."
+ echo ""
+ exit 0 ;;
+ *)
+ ask_yesno "Abort Installation?" && exit 0
+ ;;
+ esac
+}
+
+
+configure_system()
+{
+ ## PREPROCESSING ##
+ # only done on first invocation of configure_system
+ if [ $S_CONFIG -eq 0 ]; then
+
+ # /etc/pacman.d/mirrorlist
+ # add installer-selected mirror to the top of the mirrorlist
+ if [ "$MODE" = "ftp" -a "${SYNC_URL}" != "" ]; then
+ awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${SYNC_URL}"\n\n\") } 1 " "${var_TARGET_DIR}/etc/pacman.d/mirrorlist"
+ fi
+
+ # /etc/rc.conf
+ # insert timezone and utc info
+ sed -i -e "s/^TIMEZONE=.*/TIMEZONE=\"$TIMEZONE\"/g" \
+ -e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$HARDWARECLOCK\"/g" \
+ ${var_TARGET_DIR}/etc/rc.conf
+ fi
+
+
+ interactive_configure_system
+
+ run_mkinitcpio
+ target_locale-gen
+
+}
+
+
+worker_prepare_disks()
+{
+ S_MKFSAUTO=0
+ S_MKFS=0
+ DONE=0
+ NEXTITEM=""
+ while [ "$DONE" = "0" ]; do
+ if [ -n "$NEXTITEM" ]; then
+ DEFAULT="--default-item $NEXTITEM"
+ else
+ DEFAULT=""
+ fi
+ _dia_DIALOG $DEFAULT --menu "Prepare Hard Drive" 12 60 5 \
+ "1" "Auto-Prepare (erases the ENTIRE hard drive)" \
+ "2" "Partition Hard Drives" \
+ "3" "Set Filesystem Mountpoints" \
+ "4" "Return to Main Menu" 2>$ANSWER
+ NEXTITEM="$(cat $ANSWER)"
+ case $(cat $ANSWER) in
+ "1")
+ interactive_autoprepare && S_MKFSAUTO=1 ;;
+ "2")
+ if [ "$S_MKFSAUTO" = "1" ]; then
+ notify "You have already prepared your filesystems with Auto-prepare"
+ else
+ interactive_partition && S_PART=1
+ fi
+ ;;
+ "3")
+ PARTFINISH=""
+ if [ "$S_MKFSAUTO" = "1" ]; then
+ notify "You have already prepared your filesystems with Auto-prepare"
+ else
+ interactive_mountpoints && S_MKFS=1
+ fi
+ ;;
+ *)
+ DONE=1 ;;
+ esac
+ done
+ NEXTITEM="1"
+}
+
+
+# set_clock()
+# prompts user to set hardware clock and timezone
+#
+# params: none
+set_clock()
+{
+ interactive_set_clock
+}
+
+
+worker_select_source ()
+{
+ #TODO: how to handle user going here again? discard previous settings, warn him that he already done it?
+ interactive_select_source && return 0
+ return 1
+}
+
+
+
+# select_packages()
+# prompts the user to select packages to install
+worker_package_list() {
+ # step dependencies
+ if [ $S_SRC -eq 0 ]; then
+ _dia_DIALOG --msgbox "You must select an installation source!" 0 0
+ return 1
+ fi
+
+ # if selection has been done before, warn about loss of input
+ # and let the user exit gracefully
+ if [ $S_SELECT -ne 0 ]; then
+ _dia_DIALOG --yesno "WARNING: Running this stage again will result in the loss of previous package selections.\n\nDo you wish to continue?" 10 50 || return 1
+ fi
+
+ interactive_select_packages
+}
+
+
+worker_install_packages ()
+{
+ if [ $S_SELECT -eq 0 ]; then
+ notify "You must select packages first."
+ return 1
+ fi
+ installpkg && return 0
+ return 1
+}
+
+
+# Hand-hold through setting up networking
+worker_runtime_network() {
+ interactive_runtime_network
+}
+
+
+dogrub() {
+ interactive_dogrub && S_GRUB=1
+}
+
+
+worker_select_mirror ()
+{
+ interactive_select_mirror
+}
+
+# $1 which one
+worker_install_bootloader ()
+{
+ [ "$1" = grub ] && interactive_install_grub && S_BOOT=grub
+ [ "$1" != grub ] && S_BOOT="$1"
+}
+
+worker_auto_network ()
+{
+ [ $S_NET -eq 0 ] && return 1
+
+ ask_yesno "Do you want to use the network settings from the installer in rc.conf and resolv.conf?\n\nIf you used Proxy settings, they will be written to /etc/profile.d/proxy.sh" || return 1
+
+ [ "$S_DHCP" = 1 ] && target_configure_network dhcp "$PROXY_HTTP" "$PROXY_FTP"
+ [ "$S_DHCP" != 1 ] && target_configure_network fixed "$PROXY_HTTP" "$PROXY_FTP"
+}