diff options
-rw-r--r-- | doc/official_installation_guide_en | 56 | ||||
-rwxr-xr-x | src/aif.sh | 2 | ||||
-rw-r--r-- | src/core/libs/lib-blockdevices-filesystems.sh | 13 | ||||
-rwxr-xr-x | src/core/libs/lib-flowcontrol.sh | 14 | ||||
-rw-r--r-- | src/core/libs/lib-misc.sh | 8 | ||||
-rw-r--r-- | src/core/libs/lib-software.sh | 3 | ||||
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 151 | ||||
-rw-r--r-- | src/core/procedures/automatic | 4 | ||||
-rw-r--r-- | src/core/procedures/base | 5 |
9 files changed, 196 insertions, 60 deletions
diff --git a/doc/official_installation_guide_en b/doc/official_installation_guide_en index d73ed8e..3e34bfc 100644 --- a/doc/official_installation_guide_en +++ b/doc/official_installation_guide_en @@ -177,14 +177,11 @@ so make sure you don't have any important files on it before doing this. ### Pre-boot Make sure your BIOS is set in a way to allow booting from your CD-ROM or USB -device. -Reboot your computer with the Arch Linux Installation CD in the drive -or the USB stick plugged in the port. Once the installation medium has started -booting you will see the Arch Linux logo and a grub menu waiting for your -selection. -Most likely you can just hit enter at this point. -If Grub hangs, you're one of the unlucky few whose CD-rom drive doesn't work -with grub and you should try the isolinux image. +device. Reboot your computer with the Arch Linux Installation CD in the drive or +the USB stick plugged in the port. Once the installation medium has started +booting, you will see the Arch Linux logo and an Isolinux menu waiting for your +selection. Most likely you can just hit enter at this point. + ### Post-boot At the end of the boot procedure, you should be at a login prompt with some @@ -460,13 +457,14 @@ hard disk preparations need to be undone. #### Select Packages Select Packages will let you select the packages you wish to install from the -CD, USB or your NET mirror. You have the opportunity to specify whole package -groups from which you'd generally like to install packages, then fine-tune -your coarse selection by (de)selecting individual packages from the groups you -have chosen using the space bar. It is recommended that you install all the -"base" packages, but not anything else at this point. The only exception to -this rule is installing any packages you need for setting up Internet -connectivity. +CD, USB or your NET mirror. First, you are prompted to select a bootloader +package (the bootloader will be configured later on in the "Install Bootloader" +stage). After this, you can select package groups from which you'd generally +like to install packages, then fine-tune your coarse selection by (de)selecting +individual packages from the groups you have chosen using the space bar. It is +recommended that you install all the "base" packages, but not anything else at +this point. The only exception to this rule is installing any packages you need +for setting up Internet connectivity. Once you're done selecting the packages you need, leave the selection screen and continue to the next step. @@ -771,25 +769,25 @@ changes you made in mkinitcpio.conf. #### Install Bootloader -Install Bootloader will install a bootloader on your hard drive, either GRUB -or NONE in case you have a bootloader already installed and want to use that -one instead. If you choose to install GRUB, the setup script will want you to -examine the appropriate configuration file to confirm the proper settings. - +Install Bootloader will install and help you configure the bootloader that you +selected in the "Select Packages" stage. **/boot/grub/menu.lst** +**/boot/syslinux/syslinux.cfg** + +An editor will open, allowing you to edit the appropriate bootloader +configuration file which the installer has pre-populated. You should check and +modify this file, if needed, to accommodate your boot setup. + +Syslinux: +After checking your bootloader configuration for correctness, you'll be asked to +allow the installer to Set the Boot Flag and install the Syslinux MBR. -You should check and modify this file to accommodate your boot setup if you -want to use GRUB, otherwise you will have to modify your existing bootloader's -configuration file. The installer will have pre-populated this file using UUID -entries which you may have to change in the same cases you'd need to change -them in your fstab. +Grub: After checking your bootloader configuration for correctness, you'll be -prompted for a partition to install the loader to. Unless you're using yet -another boot loader, you should install GRUB to the MBR of the installation -disk, which is usually represented by the appropriate device name without a -number suffix. +prompted for a disk to install the loader to. You should install GRUB to the MBR +of the installation disk. #### Exit Install @@ -146,4 +146,4 @@ start_installer start_process -stop_installer +stop_installer $? diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index 5b078a7..7d7a826 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -73,7 +73,7 @@ fs_on[lvm-pv]=${fs_on_lvm_pv[@]} fs_on[lvm-vg]=${fs_on_lvm_vg[@]} fs_on[dm_crypt]=${fs_on_dm_crypt[@]} -fs_mountable=(ext2 ext3 ext4 nilfs2 xfs jfs vfat reiserfs) +fs_mountable=(btrfs ext2 ext3 ext4 nilfs2 xfs jfs vfat reiserfs) fs_label_mandatory=('lvm-vg' 'lvm-lv' 'dm_crypt') fs_label_optional=('swap' 'ext2' 'ext3' 'ext4' 'reiserfs' 'nilfs2' 'xfs' 'jfs' 'vfat') @@ -94,7 +94,8 @@ get_possible_fs () { true } -supported_bootloaders=('grub') +syslinux_supported_fs=('ext2' 'ext3' 'ext4' 'btrfs' 'vfat') +supported_bootloaders=('syslinux' 'grub') # procedural code from quickinst functionized and fixed. # there were functions like this in the setup script too, with some subtle differences. see below @@ -244,8 +245,10 @@ finddisks() { } -# 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) +# find usable blockdevices: RAID + LVM volumes, partitioned and unpartitioned devices +# Exclude devices/partitions that are part of a RAID or LVM volume +# Exclude root block devices (ex. sda) that are partitioned +# $1 extra things to echo for each device (optional) (backslash escapes will get interpreted) find_usable_blockdevices() { shopt -s nullglob @@ -573,7 +576,7 @@ process_filesystems () done < $TMP_FILESYSTEMS [ $open_items -eq 0 ] && break done - [ $open_items -eq 1 ] && show_warning "Filesystem/blockdevice processor problem" "Warning: Could not create all needed filesystems. Either the underlying blockdevices didn't became available in 10 iterations, or process_filesystem failed" && returncode=1 + [ $open_items -eq 1 ] && show_warning "Filesystem/blockdevice processor problem" "Warning: Could not create all needed filesystems. Either the underlying blockdevices didn't appear in 10 iterations, or process_filesystem failed" && returncode=1 diff --git a/src/core/libs/lib-flowcontrol.sh b/src/core/libs/lib-flowcontrol.sh index 4f3bbfa..0e336f4 100755 --- a/src/core/libs/lib-flowcontrol.sh +++ b/src/core/libs/lib-flowcontrol.sh @@ -170,10 +170,12 @@ depend_procedure () start_process () { - execute phase preparation - execute phase basics - execute phase system - execute phase finish + ret=0 + execute phase preparation || ret=$? + execute phase basics || ret=$? + execute phase system || ret=$? + execute phase finish || ret=$? + return $ret } @@ -212,11 +214,11 @@ start_installer () # use this function to stop the installation procedure. -# $1 exit code (optional) +# $1 exit code (optional, defaults to 0) stop_installer () { log "-------------- STOPPING INSTALLATION ----------" cleanup_runtime [ "$var_UI_TYPE" = dia ] && clear - exit $1 + exit ${1:-0} } diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index 2dee841..f9fd06a 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -165,6 +165,14 @@ target_configure_time () { ${var_TARGET_DIR}/etc/rc.conf } +target_localtime () { + if [ -f /etc/localtime ] + then + cp /etc/localtime ${var_TARGET_DIR}/etc/localtime || return 1 + fi + return 0 +} + # apped string after last line matching regex in a file. # $1 regex # $2 string (can contain "\n", "\t" etc) diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh index d93cfad..17102bb 100644 --- a/src/core/libs/lib-software.sh +++ b/src/core/libs/lib-software.sh @@ -18,8 +18,7 @@ target_run_mkinitcpio() } -# installpkg(). taken from setup. modified bigtime -# performs package installation to the target system +# perform package installation to the target system installpkg() { ALL_PACKAGES= [ -n "$var_TARGET_GROUPS" ] && ALL_PACKAGES=`list_packages group "$var_TARGET_GROUPS" | awk '{print $2}'` diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 93f89d6..1ae4d6f 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -2,7 +2,9 @@ # A library which allows you to do backend stuff by using user interfaces # Global Variables -grubmenu="/boot/grub/menu.lst" # be sure to override this if you have it somewhere else +# Be sure to override these if you have the configuration file elsewhere +grubmenu="/boot/grub/menu.lst" +syslinuxmenu="/boot/syslinux/syslinux.cfg" # check if a worker has completed successfully. if not -> tell user he must do it + return 1 # if ok -> don't warn anything and return 0 @@ -42,7 +44,7 @@ postconfigure_target () { local failed=() target_run_mkinitcpio || failed+=('mkinitcpio creation') target_locale-gen || failed+=('locale generation') - cp /etc/localtime ${var_TARGET_DIR}/etc/localtime || failed+=('localtime copying') + target_localtime || failed+=('localtime copying') [ ${#failed[@]} -gt 0 ] && warn_failed 'Postconfigure' "${failed[@]}" && return 1 return 0 } @@ -120,14 +122,23 @@ interactive_configure_system() interactive_timezone () { ask_timezone || return 1 TIMEZONE=$ANSWER_TIMEZONE - inform "Setting Timezone to $TIMEZONE" - if [ -n "$TIMEZONE" -a -e "/usr/share/zoneinfo/$TIMEZONE" ] + return 0 +} + +# this should be executed, whether the user changed $TIMEZONE or not +copy_timezone_file () { + if [ -z "$TIMEZONE" ] then - # This changes probably also the systemtime (UTC->$TIMEZONE)! - # localtime users will have a false time after that! - /bin/rm -f /etc/localtime || return 1 - /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime || return 1 + debug UI-INTERACTIVE "\$TIMEZONE is empty, not creating/updating /etc/localtime" + return 0 fi + debug UI-INTERACTIVE "Setting Timezone to $TIMEZONE" + local file="/usr/share/zoneinfo/$TIMEZONE" + [ -e "$file" ] || die_error "No such timezone file: $file, did you choose a non-existing timezone?" + # This changes probably also the systemtime (UTC->$TIMEZONE)! + # localtime users will have a false time after that! + /bin/rm -f /etc/localtime || return 1 + /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime || return 1 return 0 } @@ -737,7 +748,8 @@ If any previous configuration you've done until now (like fancy filesystems) req done ask_option no "Choose bootloader" "Which bootloader would you like to use?" optional \ - "grub" "GRUB bootloader" + "grub" "GRUB bootloader" \ + "syslinux" "Syslinux bootloader (${syslinux_supported_fs[*]})" bootloader=$ANSWER_OPTION @@ -753,7 +765,7 @@ If any previous configuration you've done until now (like fancy filesystems) req # build the list of options, sorted primarily by group, then by packagename (this is already). marking where appropriate local pkglist=() - needed_pkgs=("${needed_pkgs_fs[@]}") + needed_pkgs+=("${needed_pkgs_fs[@]}") while read pkgname pkgver pkggroup pkgdesc; do mark=OFF if check_is_in "$pkggroup" "${grouplist[@]}" || check_is_in $pkgname "${needed_pkgs[@]}"; then @@ -867,6 +879,8 @@ interactive_install_bootloader () { if [[ $bootloader = grub ]]; then GRUB_OK=0 interactive_grub || return 1 + elif [[ $bootloader = syslinux ]]; then + interactive_syslinux || return 1 else show_warning 'No Bootloader' 'You did not select a bootloader. No bootloader will be installed.' fi @@ -893,9 +907,9 @@ interactive_grub() { # the partition with seperate /boot or to $PART_ROOT. # So that bootdev is always our real partition with /boot.... bootdev=$(mount | grep $var_TARGET_DIR/boot | cut -d' ' -f 1) - # check if bootdev or PART_ROOT is on a md raid array + # check if PART_ROOT (or bootdev, if it is a blockdevice) is on a md raid array # This dialog is only shown when we detect / or /boot on a raid device. - if device_is_raid $bootdev || device_is_raid $PART_ROOT; then + if device_is_raid $PART_ROOT || ( [ -n "$bootdev" ] && device_is_raid "$bootdev" ); then ask_yesno "Do you have your system installed on software raid?\nAnswer 'YES' to install grub to another hard disk." no if [ $? -eq 0 ]; then onraid=true @@ -905,7 +919,7 @@ interactive_grub() { # Create and edit the grub menu.lst interactive_bootloader_menu "grub" $grubmenu - DEVS="$(find_usable_blockdevices '_ ')" + DEVS="$(finddisks '_ ')" if [ "$DEVS" = " " ]; then notify "No hard drives were found" return 1 @@ -1131,11 +1145,120 @@ EOF fi } +interactive_syslinux() { + debug FS "starting interactive_syslinux" + + # Find and Store the device that has the root filesystem + get_device_with_mount '/' || return 1 + PART_ROOT="$ANSWER_DEVICE" + + # Gets boot device + get_device_with_mount '/boot' + bootdev="$ANSWER_DEVICE" + + # Check to see if /boot or / (root) has a valid FS type and set bootpart + # bootpart == device with /boot dir + if [[ $bootdev ]]; then + filesystem="$(awk '/ \/boot /{print $4}' $TMP_FILESYSTEMS)" + debug FS "$bootdev - FS type: $filesystem" + + local bootpart="$bootdev" + else + filesystem="$(awk '/ \/ /{print $4}' $TMP_FILESYSTEMS)" + debug FS "$PART_ROOT - FS type: $filesystem" + + local bootpart="$PART_ROOT" + fi + + if ! check_is_in "$filesystem" "${syslinux_supported_fs[@]}"; then + show_warning "Invalid FS" "Error: Syslinux does not support $filesystem.\n\nThe following filesystems are supported:\n ${syslinux_supported_fs[@]}" + return 1 + fi + + # remove default entries by truncating file at our little tag (#-*) + sed -i -e '/#-\*/q' "$syslinuxmenu" + + # Generate menu and prompt user to edit it + interactive_bootloader_menu "syslinux" "$syslinuxmenu" + + if device_is_raid "$bootpart"; then + debug FS "Software RAID detected" + local onraid=true + fi + + debug FS "Installing Syslinux ($var_TARGET_DIR/usr/sbin/syslinux-install_update -i -c /mnt)" + inform "Installing Syslinux..." + if ! "$var_TARGET_DIR/usr/sbin/syslinux-install_update" -i -c /mnt >$LOG 2>&1; then + debug FS "FAILED: syslinux-install_update -i -c /mnt failed" + show_warning "FAILED" "syslinux-install_update -i -c /mnt failed" + return 1 + fi + + if ask_yesno "Set boot flag(s) and install the Syslinux MBR?" yes; then + inform "Setting Boot Flag(s)...\nThis could take a while. Please be patient.\n\n" syslinuxprog + if "$var_TARGET_DIR/usr/sbin/syslinux-install_update" -a -c /mnt >$LOG 2>&1; then + debug FS "Successfully set boot flag(s)" + else + debug FS "Failde to set boot flag(s). syslinux-install_update -a failed with Error Code - $?" + show_warning "FAILED" "Failed to set boot flag(s). MBR not installed" && return 1 + fi + + inform "Installing Syslinux MBR..." syslinuxprog + if "$var_TARGET_DIR/usr/sbin/syslinux-install_update" -m -c /mnt >$LOG 2>&1; then + debug FS "Successfully installed MBR(s)" + else + debug FS "Failed to install MBR. syslinux-install_update -m failed with Error Code - $?" + show_warning "FAILED" "Failed to install the MBR!" && return 1 + fi + fi + notify "Syslinux Installation Successful" +} + +generate_syslinux_menu () { + get_kernel_parameters || return + + cat >>$syslinuxmenu <<EOF + +# (0) Arch Linux +LABEL arch + MENU LABEL Arch Linux + LINUX ../vmlinuz26 + APPEND $kernel_parameters + INITRD ../kernel26.img + +# (1) Arch Linux Fallback +LABEL archfallback + MENU LABEL Arch Linux Fallback + LINUX ../vmlinuz26 + APPEND $kernel_parameters + INITRD ../kernel26-fallback.img + +# (2) Windows +#LABEL windows +#COM32 chain.c32 +#APPEND hd0 0 + +LABEL hdt + MENU LABEL HDT (Hardware Detection Tool) + COM32 hdt.c32 + +LABEL reboot + MENU LABEL Reboot + COM32 reboot.c32 + +LABEL off + MENU LABEL Power Off + COMBOOT poweroff.com +EOF +} + # $1 - Bootloader Name # $2 - Bootloader Configuration Files interactive_bootloader_menu() { if [[ $1 = grub ]]; then - generate_grub_menulst + generate_grub_menulst || return + elif [[ $1 = syslinux ]]; then + generate_syslinux_menu || return fi grep -q '^/dev/mapper' $TMP_FSTAB && local helptext=" /dev/mapper/ users: Pay attention to the kernel line!" diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index 407a35b..ce773e1 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -102,8 +102,8 @@ worker_install_packages () worker_set_clock () { - #TODO implement this - true + # uses $TIMEZONE, clock itself remains untouched. + copy_timezone_file } diff --git a/src/core/procedures/base b/src/core/procedures/base index ec38f51..dba70d1 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -11,6 +11,7 @@ var_UI_TYPE="cli" # set to cli or dia for dialog var_ARCH=`uname -m` #i686 or x86_64. NOTE: this assumes you want to install the same arch as the installation environment you're using. maybe we could decouple those someday.. [ -z "$var_ARCH" ] && die_error "Could not determine your architecture" grubmenu="$var_TARGET_DIR$grubmenu" +syslinuxmenu="$var_TARGET_DIR$syslinuxmenu" ###### Phases ( can be overridden by more specific procedures) ###### phase_preparation=(\ @@ -104,13 +105,14 @@ worker_runtime_packages () worker_set_clock () { local default=no + local timezone_file_copied=0 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 ;; + "1") execute worker interactive_timezone && copy_timezone_file && timezone_file_copied=1 && default=2 || return 1 ;; "2") if check_depend worker interactive_timezone then execute worker interactive_time && default=3 || return 1 @@ -118,6 +120,7 @@ worker_set_clock () "3") break ;; esac done + [ $timezone_file_copied -eq 1 ] || copy_timezone_file || return 1 return 0 } |