From 5d6f5473645fd4e842d26ca52d308bbdb70830e2 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Sun, 26 Apr 2009 11:11:31 +0200 Subject: [PATCH] 'added syslinux support' --- lib/initcpio/install/arch_pacman | 2 +- lib/initcpio/install/arch_pacman_lowmem | 2 +- usr/bin/archboot-svn.sh | 2 +- usr/share/archboot/installer/setup | 67 ++++++++++++++++++++++++- 4 files changed, 69 insertions(+), 4 deletions(-) diff --git a/lib/initcpio/install/arch_pacman b/lib/initcpio/install/arch_pacman index 17e71ceef..8cd53c556 100644 --- a/lib/initcpio/install/arch_pacman +++ b/lib/initcpio/install/arch_pacman @@ -20,7 +20,7 @@ pcre cpio archboot fuse klibc libusb vi lzo2 libsasl libldap libevent gpm sdparm rt2x00-rt61-fw rt2x00-rt71w-fw rt2500 ndiswrapper ndiswrapper-utils \ zd1211-firmware ipw2100-fw ipw2200-fw iwlwifi-3945-ucode iwlwifi-4965-ucode iwlwifi-5000-ucode \ smbclient tdb tiacx tiacx-firmware dmraid linux-atm netcfg tiacx tiacx-firmware parted tzdata ntp \ -v86d wlan-ng26-utils iw crda wireless-regdb libnl iproute2 dhclient" +v86d wlan-ng26-utils iw crda wireless-regdb libnl iproute2 dhclient syslinux" for i in $DEPENDS; do for k in $(echo /var/lib/pacman/local/$i-[0-9]*-[0-9]*); do diff --git a/lib/initcpio/install/arch_pacman_lowmem b/lib/initcpio/install/arch_pacman_lowmem index c2db949d1..f80b1bf15 100644 --- a/lib/initcpio/install/arch_pacman_lowmem +++ b/lib/initcpio/install/arch_pacman_lowmem @@ -13,7 +13,7 @@ ncurses procps psmisc reiserfsprogs sed \ syslog-ng sysvinit tar util-linux-ng which xfsprogs hdparm memtest86+ \ grub hwdetect shadow dosfstools udev initscripts filesystem kernel26 glibc kernel-headers pacman pacman-mirrorlist pam \ bzip2 gcc-libs openssl zlib libelf gpm sysfsutils libgcrypt libgpg-error popt libpcap lilo grub gzip libarchive \ -libdownload device-mapper cracklib readline acl attr archboot klibc libevent sdparm licenses dmraid parted" +libdownload device-mapper cracklib readline acl attr archboot klibc libevent sdparm licenses dmraid parted syslinux" for i in $DEPENDS; do for k in $(echo /var/lib/pacman/local/$i-[0-9]*-[0-9]*); do diff --git a/usr/bin/archboot-svn.sh b/usr/bin/archboot-svn.sh index a972cdf40..1384ad9ab 100644 --- a/usr/bin/archboot-svn.sh +++ b/usr/bin/archboot-svn.sh @@ -13,7 +13,7 @@ for i in $(pacman -Sg base-devel | sed -e "s/base-devel//g"); do DEVEL="$DEVEL $(echo $i)" done # generate support, ntfs-3g is added additionally! -SUPPORT="$(echo -n $(pacman -Ss | grep -e ^core | grep -v '(' | sed -e 's/\ .*/ /g' -e 's#core/##g')) ntfs-3g" +SUPPORT="$(echo -n $(pacman -Ss | grep -e ^core | grep -v '(' | sed -e 's/\ .*/ /g' -e 's#core/##g')) ntfs-3g syslinux" for i in base devel support; do mkdir $i svn co -N ${SVNSETUP} $i diff --git a/usr/share/archboot/installer/setup b/usr/share/archboot/installer/setup index 69504c470..b5956e56a 100755 --- a/usr/share/archboot/installer/setup +++ b/usr/share/archboot/installer/setup @@ -2076,6 +2076,69 @@ getcryptsetup() { fi } +dosyslinux() { + getrootfs + getraidarrays + getcryptsetup + if [ ! -e $DESTDIR/usr/bin/syslinux ]; then + DIALOG --msgbox "Error: Couldn't find syslinux binary. Is SYSLINUX installed?" 0 0 + return 1 + fi + # look for a separately-mounted /boot partition + bootdev=$(mount | grep $DESTDIR/boot | cut -d' ' -f 1) + if [ "$bootdev" = "" ]; then + DIALOG --msgbox "Error: Couldn't find separate /boot partition." 0 0 + return 1 + fi + FSTYPE="$(blkid -c /dev/null $bootdev -o value -s TYPE)" + if ! [ "$FSTYPE" = "vfat" ]; then + DIALOG --msgbox "Error: Couldn't find vfat boot partition." 0 0 + return 1 + fi + DEVS="$(findbootloaderdisks _)" + DEVS="$DEVS $(findbootloaderpartitions _)" + if [ "$DEVS" = "" ]; then + DIALOG --msgbox "No hard drives were found" 0 0 + return 1 + fi + DIALOG --menu "Select the boot device where the SYSLINUX bootloader will be installed (usually the MBR)" 14 55 7 $DEVS 2>$ANSWER || return 1 + ROOTDEV=$(cat $ANSWER) + # generate syslinux.cfg + TEMPDIR=/tmp + MBR=${DESTDIR}/usr/lib/syslinux/mbr.bin + [ -e ${TEMPDIR}/syslinux.cfg ] && rm ${TEMPDIR}/syslinux.cfg + echo "prompt 1" >> ${TEMPDIR}/syslinux.cfg + echo "timeout 300" >> ${TEMPDIR}/syslinux.cfg + echo "default arch" >> ${TEMPDIR}/syslinux.cfg + echo "label arch" >> ${TEMPDIR}/syslinux.cfg + echo "kernel vmlinuz26" >> ${TEMPDIR}/syslinux.cfg + if [ "$UUIDPARAMETER" = "yes" ]; then + local _rootpart="${PART_ROOT}" + local _uuid="$(getuuid ${PART_ROOT})" + if [ -n "${_uuid}" ]; then + _rootpart="/dev/disk/by-uuid/${_uuid}" + fi + echo "append initrd=kernel26.img root=${_rootpart} rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP" >> ${TEMPDIR}/syslinux.cfg + else + echo "append initrd=kernel26.img root=${PART_ROOT} rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP" >> ${TEMPDIR}/syslinux.cfg + fi + DIALOG --msgbox "Before installing SYSLINUX, you must review the configuration file. You will now be put into the editor. After you save your changes and exit the editor, SYSLINUX will be installed." 0 0 + [ "$EDITOR" ] || geteditor + $EDITOR ${TEMPDIR}/syslinux.cfg + DIALOG --infobox "Installing the SYSLINUX bootloader..." 0 0 + cp ${TEMPDIR}/syslinux.cfg ${DESTDIR}/boot/syslinux.cfg + cat ${MBR} > ${ROOTDEV} + chroot_mount + chroot /usr/bin/syslinux -o offset $bootdev >$LOG 2>&1 + if [ $? -gt 0 ]; then + chroot_umount + DIALOG --msgbox "Error installing SYSLINUX. (see $LOG for output)" 0 0 + return 1 + fi + chroot_umount + DIALOG --msgbox "SYSLINUX was successfully installed." 0 0 +} + dolilo() { getrootfs getraidarrays @@ -2880,10 +2943,12 @@ install_bootloader() DIALOG --menu "Which bootloader would you like to use? Grub is the Arch default.\n\n" \ 10 55 2 \ "GRUB" "Use the GRUB bootloader (default)" \ - "LILO" "Use the LILO bootloader" 2>$ANSWER || CANCEL=1 + "LILO" "Use the LILO bootloader" \ + "SYSLINUX" "Use the SYSLINUX bootloader" 2>$ANSWER || CANCEL=1 case $(cat $ANSWER) in "GRUB") dogrub ;; "LILO") dolilo ;; + "SYSLINUX") dosyslinux ;; esac if [ "$CANCEL" = "1" ]; then NEXTITEM="7"