diff options
Diffstat (limited to 'src/core/libs/lib-ui-interactive.sh')
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 80 |
1 files changed, 53 insertions, 27 deletions
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index d8d1796..19ddd10 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -125,9 +125,10 @@ interactive_timezone () { then # This changes probably also the systemtime (UTC->$TIMEZONE)! # localtime users will have a false time after that! - /bin/rm -f /etc/localtime - /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime + /bin/rm -f /etc/localtime || return 1 + /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime || return 1 fi + return 0 } @@ -138,8 +139,12 @@ interactive_time () { # To avoid a false time for localtime users after above # we must re-read the hwclock value again, but now into the # correct timezone. - [ "$HARDWARECLOCK" == "localtime" ] && dohwclock $HARDWARECLOCK hctosys + if [ "$HARDWARECLOCK" == "localtime" ] + then + dohwclock $HARDWARECLOCK hctosys || return $? + fi + timeset= local default=no while true; do current=$(date) @@ -153,21 +158,27 @@ interactive_time () { inform "Syncing clock with internet pool ..." if ntpdate pool.ntp.org >/dev/null; then notify "Synced clock with internet pool successfully." - dohwclock $HARDWARECLOCK systohc && default=3 + dohwclock $HARDWARECLOCK systohc && default=3 || return $? + timeset=1 else show_warning 'Ntp failure' "An error has occured, time was not changed!" + timeset=0 fi fi if [ "$ANSWER_OPTION" = manual ]; then ask_datetime || continue if date -s "$ANSWER_DATETIME"; then - dohwclock $HARDWARECLOCK systohc && default=3 + dohwclock $HARDWARECLOCK systohc && default=3 || return $? + timeset=1 else show_warning "Date/time setting failed" "Something went wrong when doing date -s $ANSWER_DATETIME" + timeset=0 fi fi - [ "$ANSWER_OPTION" = return ] && break + [ "$ANSWER_OPTION" = return ] && timeset=1 && break done + [ "$timeset" = '0' ] && return 1 + return 0 } @@ -557,7 +568,7 @@ interactive_filesystems() { if [ ! -f $TMP_BLOCKDEVICES ] || ! ask_yesno "Previous blockdevice definitions found:\n`cat $TMP_BLOCKDEVICES`\n\ Use these as a starting point? Make sure your disk(s) are partitioned correctly so your definitions can be applied. Pick 'no' when in doubt to start from scratch" no then - findblockdevices 'raw no_label no_fs\n' > $TMP_BLOCKDEVICES + find_usable_blockdevices 'raw no_label no_fs\n' > $TMP_BLOCKDEVICES fi [ -z "$PART_ACCESS" ] && PART_ACCESS=dev @@ -709,12 +720,13 @@ device type label size type create? mountpoint options label params" required "$ # params: none # returns: 1 on error interactive_select_packages() { + local needed_pkgs=() # set up our install location if necessary and sync up so we can get package lists target_prepare_pacman || { show_warning 'Pacman preparation failure' "Pacman preparation failed! Check $LOG for errors."; return 1; } repos=`list_pacman_repos target` - notify "Package selection is split into two stages. First you will select package groups that contain packages you may be interested in. Then you will be presented with a full list of packages for each group, allowing you to fine-tune.\n\n + notify "Package selection is split into three stages. First, you will select a bootloader. Then, you will select package groups that contain packages that you may be interested in. Lastly, you will be presented with a full list of packages for each group, allowing you to fine-tune.\n\n Note that right now the packages (and groups) selection is limited to the repos available at this time ($repos). Once you have your Arch system up and running, you have access to more repositories and packages.\n\n If any previous configuration you've done until now (like fancy filesystems) require extra packages, we've already preselected them for your convenience" @@ -724,6 +736,14 @@ If any previous configuration you've done until now (like fancy filesystems) req grouplist+=(${i} - OFF) done + ask_option no "Choose bootloader" "Which bootloader would you like to use?" optional \ + "grub" "GRUB bootloader" + + bootloader=$ANSWER_OPTION + + # Make sure selected bootloader is a supported_bootloader and mark bootloader for installation + check_is_in $bootloader "${supported_bootloaders[@]}" && needed_pkgs+=("$bootloader") + ask_checklist "Select Package groups\nDo not deselect base unless you know what you're doing!" 0 "${grouplist[@]}" || return 1 grouplist=("${ANSWER_CHECKLIST[@]}") @@ -842,15 +862,15 @@ interactive_runtime_network() { return 0 } +# bootloader is global variable that gets set in interactive_select_packages interactive_install_bootloader () { - ask_option Grub "Choose bootloader" "Which bootloader would you like to use? Grub is the Arch default." required \ - "Grub" "Use the GRUB bootloader (default)" \ - "None" "\Zb\Z1Warning\Z0\ZB: you must install your own bootloader!" || return 1 - - bl=`tr '[:upper:]' '[:lower:]' <<< "$ANSWER_OPTION"` - [ "$bl" != grub ] && return 0 - GRUB_OK=0 - interactive_grub + if [[ $bootloader = grub ]]; then + GRUB_OK=0 + interactive_grub || return 1 + else + show_warning 'No Bootloader' 'You did not select a bootloader. No bootloader will be installed.' + fi + return 0 } interactive_grub() { @@ -883,9 +903,9 @@ interactive_grub() { fi fi # Create and edit the grub menu.lst - interactive_grub_menulst + interactive_bootloader_menu "grub" $grubmenu - DEVS="$(findblockdevices '_ ')" + DEVS="$(find_usable_blockdevices '_ ')" if [ "$DEVS" = " " ]; then notify "No hard drives were found" return 1 @@ -1065,15 +1085,6 @@ initrd $subdir/kernel26-fallback.img EOF } -interactive_grub_menulst () { - generate_grub_menulst - local 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" - seteditor || return 1 - $EDITOR $grubmenu -} - interactive_grub_install () { debug FS "interactive_grub_install called. P1 = $1, P2 = $2, P3 = $3" # $1 = bootpart @@ -1115,6 +1126,21 @@ EOF fi } +# $1 - Bootloader Name +# $2 - Bootloader Configuration Files +interactive_bootloader_menu() { + if [[ $1 = grub ]]; then + generate_grub_menulst + fi + + grep -q '^/dev/mapper' $TMP_FSTAB && local helptext=" /dev/mapper/ users: Pay attention to the kernel line!" + notify "Before installing $1, 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 $1.$helptext" + + seteditor || return 1 + + $EDITOR $2 +} + get_kernel_parameters() { get_device_with_mount '/' || return 1 local rootpart="$ANSWER_DEVICE" |