From 10ed0103b33e984b1c645f256de709706ab60e9f Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 3 Mar 2011 18:25:40 +0100 Subject: apply indentation with tabs everywhere --- src/core/libs/lib-network.sh | 98 +++++++++++----------- src/core/libs/lib-software.sh | 80 +++++++++--------- src/core/procedures/automatic | 22 ++--- src/core/procedures/base | 18 ++-- src/core/procedures/interactive | 22 ++--- src/core/procedures/partial-disks | 18 ++-- tests/runtime/automatic-reuse-fs-sda/profile | 26 +++--- unofficial/dieter-desktop-a7n8x.automaticprofile | 6 +- .../modules/dieter/procedures/dieter-automatic | 2 +- 9 files changed, 146 insertions(+), 146 deletions(-) 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-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/procedures/automatic b/src/core/procedures/automatic index ba533fa..a37803e 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 () @@ -96,8 +96,8 @@ worker_package_list () worker_install_packages () { - target_prepare_pacman core extra community - installpkg + target_prepare_pacman core extra community + installpkg } @@ -110,11 +110,11 @@ worker_set_clock () worker_install_bootloader () { - get_grub_map + 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) + # 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 } diff --git a/src/core/procedures/base b/src/core/procedures/base index 3ff66b4..27080c9 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -98,15 +98,15 @@ worker_runtime_packages () 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 + [ "$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 } diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 5155e81..40021ef 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 } @@ -106,15 +106,15 @@ 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 + [ "$ANSWER_OPTION" = 1 ] && execute worker runtime_network && default=2 + [ "$ANSWER_OPTION" = 2 ] && interactive_select_mirror && default=3 + [ "$ANSWER_OPTION" = 3 ] && break + 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 } -- cgit v1.2.2