summaryrefslogtreecommitdiff
path: root/src/core/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/libs')
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh167
-rw-r--r--src/core/libs/lib-misc.sh17
-rw-r--r--src/core/libs/lib-network.sh98
-rw-r--r--src/core/libs/lib-pacman.sh14
-rw-r--r--src/core/libs/lib-software.sh80
-rw-r--r--src/core/libs/lib-ui-interactive.sh80
6 files changed, 253 insertions, 203 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index ac749a3..5b078a7 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -91,8 +91,10 @@ get_possible_fs () {
do
which ${filesystem_programs[$fs]} &>/dev/null && possible_fs=("${possible_fs[@]}" $fs)
done
+ true
}
+supported_bootloaders=('grub')
# procedural code from quickinst functionized and fixed.
# there were functions like this in the setup script too, with some subtle differences. see below
@@ -206,99 +208,106 @@ getlabel() {
# find partitionable blockdevices
# $1 extra things to echo for each device (optional) (backslash escapes will get interpreted)
finddisks() {
- workdir="$PWD"
- if cd /sys/block 2>/dev/null
- then
- # ide devices
- for dev in $(ls | egrep '^hd')
- do
- if [ "$(cat $dev/device/media)" = "disk" ]
- then
- echo -ne "/dev/$dev $1"
- fi
- done
- #scsi/sata devices, and virtio blockdevices (/dev/vd*)
- for dev in $(ls | egrep '^[sv]d')
- do
- # TODO: what is the significance of 5? ASKDEV
- if [ "$(cat $dev/device/type)" != "5" ]
- then
- echo -ne "/dev/$dev $1"
+ shopt -s nullglob
+
+ # Block Devices
+ for dev in /sys/block/*; do
+ if [[ -f $dev/device/type ]]; then
+ local type
+ read type < /sys/block/${dev##*/}/device/type
+ # Block Devices with size =< 0 may be an empty card reader
+ read size < /sys/block/${dev##*/}/size
+ # Type 5 is a ROM Device - Optical Drives
+ if [[ $type != 5 ]] && (( $size > 0 )); then
+ source "$dev/uevent"
+ echo -ne "/dev/$DEVNAME $1"
+ unset DEVNAME
fi
- done
- fi
+ fi
+ done
+
# cciss controllers
- if cd /dev/cciss 2>/dev/null
- then
- for dev in $(ls | egrep -v 'p')
- do
- echo -ne "/dev/cciss/$dev $1"
- done
- fi
- # Smart 2 controllers
- if cd /dev/ida 2>/dev/null
- then
- for dev in $(ls | egrep -v 'p')
- do
- echo -ne "/dev/ida/$dev $1"
- done
- fi
- cd "$workdir"
+ for dev in /dev/cciss/*; do
+ if [[ $dev != *[[:digit:]]p[[:digit:]]* ]]; then
+ echo "$dev $1"
+ fi
+ done
+
+ # Smart 2 Controller
+ for dev in /dev/ida/*; do
+ if [[ $dev != *[[:digit:]]p[[:digit:]]* ]]; then
+ echo "$dev $1"
+ fi
+ done
+
+ shopt -u nullglob
}
-# find block devices, both partionable or not (i.e. partitions themselves)
+
+# find usable blockdevices, both partionable or not (i.e. partitions themselves)
# $1 extra things to echo for each partition (optional) (backslash escapes will get interpreted)
-findblockdevices() {
- workdir="$PWD"
- for devpath in $(finddisks)
- do
- disk=$(basename $devpath)
- echo -ne "/dev/$disk $1"
- cd /sys/block/$disk
- shopt -s nullglob
- for part in $disk*
- do
- # check if not already assembled to a raid device. TODO: what is the significance of the 5? ASKDEV
- if [ -n "$part" ] && ! grep -q $part /proc/mdstat 2>/dev/null && ! fstype 2>/dev/null </dev/$part | grep -q lvm2 && ! sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk##g") 2>/dev/null | grep -q '5'
- then
- if [ -d $part ]
- then
- echo -ne "/dev/$part $1"
- fi
+find_usable_blockdevices() {
+ shopt -s nullglob
+
+ local parts
+
+ # Cycle through all root block devices (sda, sdb, etc...)
+ # Look for partitions and include them only if they are not part of a
+ # RAID or LVM configuration. Also, exclude extended partitions
+ for devpath in $(finddisks); do
+ hidebldev=
+ unset parts
+
+ # Glob allows for following matches:
+ # /dev/sda -> /dev/sda1
+ # /dev/cciss/c0d1 -> /dev/cciss/c0d1p1
+ for dev in ${devpath}*[[:digit:]]*; do
+ local disk="${dev%%[[:digit:]]*}"
+ local partnum="${dev##*[[:alpha:]]}"
+
+ # Don't display extended partition (not logical parts)
+ [ "$(sfdisk -c "$disk" "$partnum" 2>/dev/null)" = 5 ] && continue;
+
+ # Don't list parts that are part of RAID or LVM volumes
+ # Although we strongly encourage users to setup LVM in AIF, we want to make
+ # life a bit easier for those who have setup LVM/softraid before running AIF
+ if grep -qsw "${dev##*/}" /proc/mdstat || { pvscan -s 2>/dev/null | grep -q "$dev"; }; then
+ hidebldev="True"
+ else
+ parts+=("$dev")
fi
done
- shopt -u nullglob
+
+ # If hidebldev is not set and we have no partitions then
+ # Echo root block device if root block device is not part of a LVM or RAID configuration
+ # Otherwise echo the partitions
+ if [[ -z $hidebldev ]] && (( ! ${#parts[@]} )); then
+ if ! grep -qsw "${devpath##*/}" /proc/mdstat && ! pvscan -s 2>/dev/null | grep -q "$devpath"; then
+ echo -ne "$devpath $1"
+ fi
+ elif (( ${#parts[@]} )); then
+ for part in ${parts[@]}; do
+ echo -ne "$part $1"
+ done
+ fi
done
+
# mapped devices
- for devpath in $(ls /dev/mapper 2>/dev/null | grep -v control)
- do
- echo -ne "/dev/mapper/$devpath $1"
+ for devpath in /dev/mapper/*; do
+ # Exclude /control directory and other non-block files (such as??)
+ if [[ -b $devpath ]]; then
+ echo -ne "$devpath $1"
+ fi
done
+
# raid md devices
- for devpath in $(ls -d /dev/md* | grep '[0-9]' 2>/dev/null)
- do
- if grep -qw $(echo $devpath /proc/mdstat | sed -e 's|/dev/||g')
- then
+ for devpath in /dev/md[0-9]*; do
+ if grep -qw "${devpath//\/dev\//}" /proc/mdstat; then
echo -ne "$devpath $1"
fi
done
- # cciss controllers
- if cd /dev/cciss 2>/dev/null
- then
- for dev in $(ls | egrep 'p')
- do
- echo -ne "/dev/cciss/$dev $1"
- done
- fi
- # Smart 2 controllers
- if cd /dev/ida 2>/dev/null
- then
- for dev in $(ls | egrep 'p')
- do
- echo -ne "/dev/ida/$dev $1"
- done
- fi
- cd "$workdir"
+
+ shopt -u nullglob
}
diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh
index 13379a2..2dee841 100644
--- a/src/core/libs/lib-misc.sh
+++ b/src/core/libs/lib-misc.sh
@@ -122,17 +122,26 @@ cleanup_runtime ()
dohwclock() {
# TODO: we probably only need to do this once and then actually use adjtime on next invocations
inform "Resetting hardware clock adjustment file"
- [ ! -d /var/lib/hwclock ] && mkdir -p /var/lib/hwclock
+ [ -d /var/lib/hwclock ] || mkdir -p /var/lib/hwclock || return 1
if [ ! -f /var/lib/hwclock/adjtime ]; then
- echo "0.0 0 0.0" > /var/lib/hwclock/adjtime
+ echo "0.0 0 0.0" > /var/lib/hwclock/adjtime || return 1
fi
inform "Syncing clocks ($2), hc being $1 ..."
if [ "$1" = "UTC" ]; then
- hwclock --$2 --utc
+ if ! hwclock --$2 --utc
+ then
+ show_warning 'Hwclock failure' "Could not hwclock --$2 --utc"
+ return 1
+ fi
else
- hwclock --$2 --localtime
+ if ! hwclock --$2 --localtime
+ then
+ show_warning 'Hwclock failure' "Could not hwclock --$2 --localtime"
+ return 1
+ fi
fi
+ return 0
}
target_configure_initial_keymap_font ()
diff --git a/src/core/libs/lib-network.sh b/src/core/libs/lib-network.sh
index 41eb27f..03d5361 100644
--- a/src/core/libs/lib-network.sh
+++ b/src/core/libs/lib-network.sh
@@ -10,53 +10,53 @@ target_configure_network()
# so check if the settings file was created to be sure
if [ -f $RUNTIME_DIR/aif-network-settings ]; then
- debug NETWORK "Configuring network settings on target system according to installer settings"
-
- source $RUNTIME_DIR/aif-network-settings 2>/dev/null || return 1
-
- IFO=${INTERFACE_PREV:-eth0} # old iface: a previously entered one, or the arch default
- IFN=${INTERFACE:-eth0} # new iface: a specified one, or the arch default
-
- # comment out any existing uncommented entries, whether specified by us, or arch defaults.
- for var in eth0 $IFO INTERFACES gateway ROUTES
- do
- sed -i "s/^$var=/#$var=/" ${var_TARGET_DIR}/etc/rc.conf || return 1
- done
- sed -i "s/^nameserver/#nameserver/" ${var_TARGET_DIR}/etc/resolv.conf || return 1
- if [ -f ${var_TARGET_DIR}/etc/profile.d/proxy.sh ]
- then
- sed -i "s/^export/#export/" ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- fi
-
- if [ "$DHCP" = 0 ] ; then
- local line="$IFN=\"$IFN ${IPADDR:-192.168.0.2} netmask ${SUBNET:-255.255.255.0} broadcast ${BROADCAST:-192.168.0.255}\""
- append_after_last "/$IFO\|eth0/" "$line" ${var_TARGET_DIR}/etc/rc.conf || return 1
-
- if [ -n "$GW" ]; then
- append_after_last "/gateway/" "gateway=\"default gw $GW\"" ${var_TARGET_DIR}/etc/rc.conf || return 1
- append_after_last "/ROUTES/" "ROUTES=(gateway)" ${var_TARGET_DIR}/etc/rc.conf || return 1
- fi
- if [ -n "$DNS" ]
- then
- echo "nameserver $DNS" >> ${var_TARGET_DIR}/etc/resolv.conf || return 1
- fi
- else
- append_after_last "/$IFO\|eth0/" "$IFN=\"dhcp\"" ${var_TARGET_DIR}/etc/rc.conf || return 1
- fi
-
- append_after_last "/$IFO\|eth0/" "INTERFACES=($IFN)" ${var_TARGET_DIR}/etc/rc.conf || return 1
-
- if [ -n "$PROXY_HTTP" ]; then
- echo "export http_proxy=$PROXY_HTTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- fi
-
- if [ -n "$PROXY_FTP" ]; then
- echo "export ftp_proxy=$PROXY_FTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- fi
- else
- debug NETWORK "Skipping Host Network Configuration - aif-network-settings not found"
- fi
- return 0
+ debug NETWORK "Configuring network settings on target system according to installer settings"
+
+ source $RUNTIME_DIR/aif-network-settings 2>/dev/null || return 1
+
+ IFO=${INTERFACE_PREV:-eth0} # old iface: a previously entered one, or the arch default
+ IFN=${INTERFACE:-eth0} # new iface: a specified one, or the arch default
+
+ # comment out any existing uncommented entries, whether specified by us, or arch defaults.
+ for var in eth0 $IFO INTERFACES gateway ROUTES
+ do
+ sed -i "s/^$var=/#$var=/" ${var_TARGET_DIR}/etc/rc.conf || return 1
+ done
+ sed -i "s/^nameserver/#nameserver/" ${var_TARGET_DIR}/etc/resolv.conf || return 1
+ if [ -f ${var_TARGET_DIR}/etc/profile.d/proxy.sh ]
+ then
+ sed -i "s/^export/#export/" ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ fi
+
+ if [ "$DHCP" = 0 ] ; then
+ local line="$IFN=\"$IFN ${IPADDR:-192.168.0.2} netmask ${SUBNET:-255.255.255.0} broadcast ${BROADCAST:-192.168.0.255}\""
+ append_after_last "/$IFO\|eth0/" "$line" ${var_TARGET_DIR}/etc/rc.conf || return 1
+
+ if [ -n "$GW" ]; then
+ append_after_last "/gateway/" "gateway=\"default gw $GW\"" ${var_TARGET_DIR}/etc/rc.conf || return 1
+ append_after_last "/ROUTES/" "ROUTES=(gateway)" ${var_TARGET_DIR}/etc/rc.conf || return 1
+ fi
+ if [ -n "$DNS" ]
+ then
+ echo "nameserver $DNS" >> ${var_TARGET_DIR}/etc/resolv.conf || return 1
+ fi
+ else
+ append_after_last "/$IFO\|eth0/" "$IFN=\"dhcp\"" ${var_TARGET_DIR}/etc/rc.conf || return 1
+ fi
+
+ append_after_last "/$IFO\|eth0/" "INTERFACES=($IFN)" ${var_TARGET_DIR}/etc/rc.conf || return 1
+
+ if [ -n "$PROXY_HTTP" ]; then
+ echo "export http_proxy=$PROXY_HTTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ fi
+
+ if [ -n "$PROXY_FTP" ]; then
+ echo "export ftp_proxy=$PROXY_FTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ fi
+ else
+ debug NETWORK "Skipping Host Network Configuration - aif-network-settings not found"
+ fi
+ return 0
}
diff --git a/src/core/libs/lib-pacman.sh b/src/core/libs/lib-pacman.sh
index 78e800e..bfd307c 100644
--- a/src/core/libs/lib-pacman.sh
+++ b/src/core/libs/lib-pacman.sh
@@ -47,14 +47,20 @@ do
#TODO: this is a VERY, VERY dirty hack. we fall back to net for any non-core repo because we only have core on the CD. also user maybe didn't pick a mirror yet
if [ "$repo" != core ]
then
- add_pacman_repo target ${repo} "Include = $var_MIRRORLIST"
+ add_pacman_repo target ${repo} "Include = $var_MIRRORLIST" || return 1
else
- add_pacman_repo target ${repo} "Server = ${serverurl/\$repo/$repo}" # replace literal '$repo' in the serverurl string by "$repo" where $repo is our variable.
+ # replace literal '$repo' in the serverurl string by "$repo" where $repo is our variable.
+ add_pacman_repo target ${repo} "Server = ${serverurl/\$repo/$repo}" || return 1
fi
done
# Set up the necessary directories for pacman use
- [ ! -d "${var_TARGET_DIR}/var/cache/pacman/pkg" ] && mkdir -m 755 -p "${var_TARGET_DIR}/var/cache/pacman/pkg"
- [ ! -d "${var_TARGET_DIR}/var/lib/pacman" ] && mkdir -m 755 -p "${var_TARGET_DIR}/var/lib/pacman"
+ for dir in var/cache/pacman/pkg var/lib/pacman
+ do
+ if [ ! -d "${var_TARGET_DIR}/$dir" ]
+ then
+ mkdir -m 755 -p "${var_TARGET_DIR}/$dir" || return 1
+ fi
+ done
inform "Refreshing package database..."
$PACMAN_TARGET -Sy >$LOG 2>&1 || return 1
diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh
index aecbb39..bb84621 100644
--- a/src/core/libs/lib-software.sh
+++ b/src/core/libs/lib-software.sh
@@ -66,10 +66,10 @@ installpkg() {
# enable glibc locales from rc.conf and build initial locale DB
target_configure_initial_locale()
{
- for i in $(grep "^LOCALE" ${var_TARGET_DIR}/etc/rc.conf | sed -e 's/.*="//g' -e's/\..*//g'); do
- sed -i -e "s/^#$i/$i/g" ${var_TARGET_DIR}/etc/locale.gen
- done
- target_locale-gen
+ for i in $(grep "^LOCALE" ${var_TARGET_DIR}/etc/rc.conf | sed -e 's/.*="//g' -e's/\..*//g'); do
+ sed -i -e "s/^#$i/$i/g" ${var_TARGET_DIR}/etc/locale.gen
+ done
+ target_locale-gen
}
@@ -81,41 +81,41 @@ target_locale-gen ()
target_configure_initcpio () {
local ret=0
- # Give initcpio the encrypt hook when / depends on an encrypted volume
- # (other encrypted volumes, not related to / don't need the encrypt hook, afaik)
- # If / also depends on lvm, this way the lvm2 hook will also be included in the right place
- if get_anchestors_mount ';/;'
- then
- hooks=`echo "$ANSWER_DEVICES" | cut -d ' ' -f2 | egrep 'lvm-lv|dm_crypt' | sed -e 's/lvm-lv/lvm2/' -e 's/dm_crypt/encrypt/' | tac`
- hooks=`echo $hooks` # $hooks is now a space separated, correctly ordered list of needed hooks
- if [ -n "$hooks" ]
- then
- # for each hook we're about to add, remove it first if it's already in
- for hook in $hooks
- do
- sed -i "/^HOOKS/ s/$hook //" ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
- done
- # now add the correctly ordered string
- sed -i "/^HOOKS/ s/filesystems/$hooks filesystems/" ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
- fi
- fi
- # The lvm2 hook however is needed for any lvm LV, no matter the involved mountpoints, so include it if we still need to
- if grep -q lvm-lv $TMP_BLOCKDEVICES && ! grep -q '^HOOKS.*lvm2' ${var_TARGET_DIR}/etc/mkinitcpio.conf
- then
- sed -i "/^HOOKS/ s/filesystems/lvm2 filesystems/" ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
- fi
-
- # if keymap/usbinput are not in mkinitcpio.conf, but encrypt is, we should probably add it
- if line=`grep '^HOOKS.*encrypt' ${var_TARGET_DIR}/etc/mkinitcpio.conf`
- then
- if ! echo "$line" | grep -q keymap
- then
- sed -i '/^HOOKS/ s/encrypt/keymap encrypt/' ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
- fi
- if ! echo "$line" | grep -q usbinput
- then
- sed -i '/^HOOKS/ s/keymap/usbinput keymap/' ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
- fi
- fi
+ # Give initcpio the encrypt hook when / depends on an encrypted volume
+ # (other encrypted volumes, not related to / don't need the encrypt hook, afaik)
+ # If / also depends on lvm, this way the lvm2 hook will also be included in the right place
+ if get_anchestors_mount ';/;'
+ then
+ hooks=`echo "$ANSWER_DEVICES" | cut -d ' ' -f2 | egrep 'lvm-lv|dm_crypt' | sed -e 's/lvm-lv/lvm2/' -e 's/dm_crypt/encrypt/' | tac`
+ hooks=`echo $hooks` # $hooks is now a space separated, correctly ordered list of needed hooks
+ if [ -n "$hooks" ]
+ then
+ # for each hook we're about to add, remove it first if it's already in
+ for hook in $hooks
+ do
+ sed -i "/^HOOKS/ s/$hook //" ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ done
+ # now add the correctly ordered string
+ sed -i "/^HOOKS/ s/filesystems/$hooks filesystems/" ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ fi
+ fi
+ # The lvm2 hook however is needed for any lvm LV, no matter the involved mountpoints, so include it if we still need to
+ if grep -q lvm-lv $TMP_BLOCKDEVICES && ! grep -q '^HOOKS.*lvm2' ${var_TARGET_DIR}/etc/mkinitcpio.conf
+ then
+ sed -i "/^HOOKS/ s/filesystems/lvm2 filesystems/" ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ fi
+
+ # if keymap/usbinput are not in mkinitcpio.conf, but encrypt is, we should probably add it
+ if line=`grep '^HOOKS.*encrypt' ${var_TARGET_DIR}/etc/mkinitcpio.conf`
+ then
+ if ! echo "$line" | grep -q keymap
+ then
+ sed -i '/^HOOKS/ s/encrypt/keymap encrypt/' ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ fi
+ if ! echo "$line" | grep -q usbinput
+ then
+ sed -i '/^HOOKS/ s/keymap/usbinput keymap/' ${var_TARGET_DIR}/etc/mkinitcpio.conf || ret=$?
+ fi
+ fi
return $ret
}
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"