summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2011-05-18 11:11:50 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2011-05-18 11:11:50 -0300
commitc91c0006e000f9951f0b80b92b8f00584c0317d6 (patch)
treed4c4e4341b99685d0fbd26fb0f2337e9edb9db4b
parent68d9ca947a2544bb76d550de2837d6e9548fe695 (diff)
parentf2348ba05300118b1475441e6f75be3995603c49 (diff)
Merge branch 'master' of https://projects.archlinux.org/git/aif
-rw-r--r--README5
-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
-rw-r--r--src/core/procedures/automatic27
-rw-r--r--src/core/procedures/base45
-rw-r--r--src/core/procedures/interactive27
-rw-r--r--src/core/procedures/partial-disks18
-rw-r--r--tests/runtime/automatic-reuse-fs-sda/profile26
-rw-r--r--unofficial/dieter-desktop-a7n8x.automaticprofile6
-rw-r--r--unofficial/modules/dieter/procedures/dieter-automatic2
14 files changed, 338 insertions, 274 deletions
diff --git a/README b/README
index 3e36df1..888645f 100644
--- a/README
+++ b/README
@@ -47,6 +47,11 @@ The goal of AIF is not (yet) to:
2) be more fancy then needed
+** Branches **
+-> master: "stable" tree, infrequent updates
+-> develop: unstable development tree, which may get rewritten at some points,
+ only when things have settled down (every x weeks/months), gets pushed to master
+-> optionally: more topic branches which are rewriteable and which come and go
** A bit of history **
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"
diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic
index ba533fa..407a35b 100644
--- a/src/core/procedures/automatic
+++ b/src/core/procedures/automatic
@@ -29,7 +29,7 @@ process_args ()
else
usage
exit 5
- fi
+ fi
}
@@ -61,9 +61,9 @@ worker_configure ()
worker_select_source ()
{
- var_PKG_SOURCE_TYPE=${SOURCE:-cd}
- var_FILE_URL=${FILE_URL:-file:///src/core/pkg}
- var_SYNC_URL=${SYNC_URL:-}
+ var_PKG_SOURCE_TYPE=${SOURCE:-cd}
+ var_FILE_URL=${FILE_URL:-file:///src/core/pkg}
+ var_SYNC_URL=${SYNC_URL:-}
}
worker_prepare_disks ()
@@ -82,7 +82,6 @@ worker_prepare_disks ()
inform "Partitions and filesystems made successfully"
# TODO: fstab? auto-add to fstab with libs? auto mkdir's on target_dir?
- true
}
worker_package_list ()
@@ -91,13 +90,13 @@ worker_package_list ()
var_TARGET_GROUPS=$TARGET_GROUPS
var_TARGET_PACKAGES_EXCLUDE=$TARGET_PACKAGES_EXCLUDE
[ -z "$var_TARGET_PACKAGES" -a -z "$var_TARGET_GROUPS" ] && var_TARGET_GROUPS=base
+ true
}
worker_install_packages ()
{
- target_prepare_pacman core extra community
- installpkg
+ target_prepare_pacman core extra community && installpkg
}
@@ -110,11 +109,11 @@ worker_set_clock ()
worker_install_bootloader ()
{
- get_grub_map
- grub-install $var_GRUB_DEVICE --root-directory=/mnt
- # check if we have a seperate bootdev (/boot)
- # ToDo: This is double-work, find a better place!
- # See comment in generate_grub_menulst and interactive_grub
- bootdev=$(mount | grep $var_TARGET_DIR/boot | cut -d' ' -f 1)
- generate_grub_menulst
+ get_grub_map || return 1
+ grub-install $var_GRUB_DEVICE --root-directory=/mnt || return 1
+ # check if we have a seperate bootdev (/boot)
+ # ToDo: This is double-work, find a better place!
+ # See comment in generate_grub_menulst and interactive_grub
+ bootdev=$(mount | grep $var_TARGET_DIR/boot | cut -d' ' -f 1)
+ generate_grub_menulst || return 1
}
diff --git a/src/core/procedures/base b/src/core/procedures/base
index 059930f..6f8ed0c 100644
--- a/src/core/procedures/base
+++ b/src/core/procedures/base
@@ -44,6 +44,7 @@ worker_intro ()
then
die_error "User aborted base profile execution"
fi
+ true
}
@@ -81,8 +82,12 @@ worker_runtime_repositories ()
do
repo=${var_RUNTIME_REPOSITORIES[$(($i*2))]}
location=${var_RUNTIME_REPOSITORIES[$(($i*2+1))]}
- list_pacman_repos runtime | grep -q $repo || add_pacman_repo runtime $repo "$location"
+ if ! list_pacman_repos runtime | grep -q $repo
+ then
+ add_pacman_repo runtime $repo "$location" || return 1
+ fi
done
+ return 0
}
@@ -90,23 +95,30 @@ worker_runtime_packages ()
{
for pkg in $var_RUNTIME_PACKAGES
do
- $PACMAN -Sy --noconfirm --needed $pkg
+ $PACMAN -Sy --noconfirm --needed $pkg || return 1
done
+ return 0
}
worker_set_clock ()
{
local default=no
- while true; do
- ask_option $default "Date/time configuration" '' required \
- "1" "Select region and timezone" \
- "2" "Set time and date" \
- "3" "Return to Main Menu" || return 1
- [ "$ANSWER_OPTION" = 1 ] && execute worker interactive_timezone && default=2
- [ "$ANSWER_OPTION" = 2 ] && check_depend worker interactive_timezone && execute worker interactive_time && default=3
- [ "$ANSWER_OPTION" = 3 ] && break
- done
+ while true; do
+ ask_option $default "Date/time configuration" '' required \
+ "1" "Select region and timezone" \
+ "2" "Set time and date" \
+ "3" "Return to Main Menu" || return 1
+ case $ANSWER_OPTION in
+ "1") execute worker interactive_timezone && default=2 || return 1 ;;
+ "2") if check_depend worker interactive_timezone
+ then
+ execute worker interactive_time && default=3 || return 1
+ fi ;;
+ "3") break ;;
+ esac
+ done
+ return 0
}
@@ -124,8 +136,7 @@ worker_interactive_time ()
worker_prepare_disks ()
{
- partition # use lib-archboot function by default
- get_possible_fs
+ partition && get_possible_fs
# in official installer: autoprepare or diy first partitions, then mountpoints
}
@@ -139,18 +150,16 @@ worker_package_list ()
worker_install_packages ()
{
- target_prepare_pacman core
- installpkg
+ target_prepare_pacman core && installpkg
}
worker_configure_system ()
{
- preconfigure_target
- postconfigure_target
+ preconfigure_target && postconfigure_target
}
-worker_install_bootlader ()
+worker_install_bootloader ()
{
true
}
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index ebcc1e1..5dc5322 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -42,7 +42,7 @@ start_process ()
default=1
while true
do
- mainmenu
+ mainmenu
done
}
@@ -74,7 +74,7 @@ mainmenu()
"8") check_depend worker configure_system && execute worker install_bootloader && default=9 ;;
"9") execute worker msg_report ;;
*) execute worker abort_installer;;
- esac
+ esac
}
@@ -86,8 +86,7 @@ worker_configure_system()
worker_prepare_disks()
{
- get_possible_fs
- interactive_prepare_disks
+ get_possible_fs && interactive_prepare_disks
}
@@ -106,15 +105,17 @@ worker_select_source ()
select_source_extras_menu ()
{
local default=no
- while true; do
- ask_option $default "NET (HTTP/FTP) Installation" "Make sure the network is ok and you've selected a mirror before continuing the installer" required \
- "1" "${workertitles['runtime_network']}" \
- "2" "Select mirror" \
- "3" "Return to Main Menu" || return 1
- [ "$ANSWER_OPTION" = 1 ] && execute worker runtime_network && default=2
- [ "$ANSWER_OPTION" = 2 ] && interactive_select_mirror && default=3
- [ "$ANSWER_OPTION" = 3 ] && break
- done
+ while true; do
+ ask_option $default "NET (HTTP/FTP) Installation" "Make sure the network is ok and you've selected a mirror before continuing the installer" required \
+ "1" "${workertitles['runtime_network']}" \
+ "2" "Select mirror" \
+ "3" "Return to Main Menu" || return 1
+ case $ANSWER_OPTION in
+ "1") execute worker runtime_network && default=2 || return 1 ;;
+ "2") interactive_select_mirror && default=3 || return 1 ;;
+ "3") break ;;
+ esac
+ done
return 0
}
diff --git a/src/core/procedures/partial-disks b/src/core/procedures/partial-disks
index 8f17e33..c79914b 100644
--- a/src/core/procedures/partial-disks
+++ b/src/core/procedures/partial-disks
@@ -6,14 +6,14 @@ var_ARGS_USAGE="-o process/rollback: Operation: process the blockdevice layer or
process_args ()
{
- if [ "$1" = '-o' ]
- then
- [ "$2" != process -a "$2" != rollback ] && die_error "You must specify 'process' or 'rollback'"
- OPERATION=$2
- else
- usage
- exit 5
- fi
+ if [ "$1" = '-o' ]
+ then
+ [ "$2" != process -a "$2" != rollback ] && die_error "You must specify 'process' or 'rollback'"
+ OPERATION=$2
+ else
+ usage
+ exit 5
+ fi
}
@@ -29,4 +29,4 @@ start_process ()
then
rollback_filesystems
fi
-} \ No newline at end of file
+}
diff --git a/tests/runtime/automatic-reuse-fs-sda/profile b/tests/runtime/automatic-reuse-fs-sda/profile
index c3eebd3..a6deda7 100644
--- a/tests/runtime/automatic-reuse-fs-sda/profile
+++ b/tests/runtime/automatic-reuse-fs-sda/profile
@@ -6,28 +6,28 @@ GRUB_DEVICE=/dev/sda
worker_prepare_disks ()
{
- echo "$var_BLOCKDATA" > $TMP_BLOCKDEVICES
- if process_filesystems
- then
+ echo "$var_BLOCKDATA" > $TMP_BLOCKDEVICES
+ if process_filesystems
+ then
inform "disk processing ok"
- else
+ else
show_warning 'disks processing' "PROCESSING FAILED"
return 1
- fi
- if rollback_filesystems
- then
+ fi
+ if rollback_filesystems
+ then
inform "rollback ok"
- else
+ else
show_warning 'disks rollback' "ROLLBACK FAILED"
return 1
- fi
- if process_filesystems
- then
+ fi
+ if process_filesystems
+ then
inform "disk processing ok"
- else
+ else
show_warning 'disk processing' "PROCESSING FAILED"
return 1
- fi
+ fi
}
PARTITIONS=this_wont_be_used
diff --git a/unofficial/dieter-desktop-a7n8x.automaticprofile b/unofficial/dieter-desktop-a7n8x.automaticprofile
index 4938339..ceb01e7 100644
--- a/unofficial/dieter-desktop-a7n8x.automaticprofile
+++ b/unofficial/dieter-desktop-a7n8x.automaticprofile
@@ -107,11 +107,11 @@ worker_configure_home ()
worker_set_clock ()
{
- #Not doing anything. hwclock is set already, configs are coming from svn anyway and we'll use ntp.
- true
+ #Not doing anything. hwclock is set already, configs are coming from svn anyway and we'll use ntp.
+ true
}
worker_runtime_yaourt ()
{
- _yaourt_replace_pacman
+ _yaourt_replace_pacman
}
diff --git a/unofficial/modules/dieter/procedures/dieter-automatic b/unofficial/modules/dieter/procedures/dieter-automatic
index 09e8972..17bdb83 100644
--- a/unofficial/modules/dieter/procedures/dieter-automatic
+++ b/unofficial/modules/dieter/procedures/dieter-automatic
@@ -23,5 +23,5 @@ worker_runtime_settings () #TODO: add to a phase
[ -z "$HOSTNAME" ] && ask_string "Hostname of target system?" &&
HOSTNAME=$ANSWER_STRING
- return 0
+ return 0
}