[arch-general] patch for syslinux install script

Matthew Gyurgyik pyther at pyther.net
Sat Jul 6 09:05:01 EDT 2013


There is a slight change in behaviour. When preforming an update, all
c32 modules in /usr/lib/syslinux/bios/ will get copied/symlinked.
Previously we only updated/copied modules that were already in
/boot/syslinux.

Patches can also be found here: 
http://pyther.net/archlinux/syslinux/6/20130706/

Matthew Gyurgyik

PKGBUILD:
--- /tmp/syslinux/PKGBUILD  2013-07-06 08:55:21.000000000 -0400
+++ syslinux/PKGBUILD   2013-07-06 07:45:18.811510802 -0400
@@ -4,7 +4,7 @@

  pkgname="syslinux"
  pkgver="6.01"
-pkgrel="2"
+pkgrel="3"
  arch=('x86_64' 'i686')
  pkgdesc="Collection of boot loaders that boot from FAT, ext2/3/4 and 
btrfs filesystems, from CDs and via PXE"
  url="http://syslinux.zytor.com/"
@@ -29,62 +29,62 @@ source=("https://www.kernel.org/pub/linu

  sha1sums=('d7bc1b188677f77ac2d7060d25491dc29877a9c4'
            'b0f174bcc0386fdf699e03d0090e3ac841098010'
-          'b1d915045fe3094f5359df043c53e73a4dc32745')
+          '2a7c1abe9816f6f702f425499a10582eebf94632')

  _build_syslinux_bios() {
-
+
      rm -rf "${srcdir}/${pkgname}-${pkgver}-bios/" || true
      cp -r "${srcdir}/${pkgname}-${pkgver}" 
"${srcdir}/${pkgname}-${pkgver}-bios"
      cd "${srcdir}/${pkgname}-${pkgver}-bios/"
-
+
      ## Do not try to build syslinux with our default LDFLAGS, it will fail
      unset LDFLAGS
-
+
      make PYTHON="python2" bios
      make PYTHON="python2" bios installer
-
+
  }

  _build_syslinux_efi64() {
-
+
      rm -rf "${srcdir}/${pkgname}-${pkgver}-efi64/" || true
      cp -r "${srcdir}/${pkgname}-${pkgver}" 
"${srcdir}/${pkgname}-${pkgver}-efi64"
      cd "${srcdir}/${pkgname}-${pkgver}-efi64/"
-
+
      ## Unset all compiler FLAGS for efi64 build
      unset CFLAGS
      unset CPPFLAGS
      unset CXXFLAGS
      unset LDFLAGS
      unset MAKEFLAGS
-
+
      make PYTHON="python2" efi64
      make PYTHON="python2" efi64 installer
-
+
  }

  _build_syslinux_efi32() {
-
+
      rm -rf "${srcdir}/${pkgname}-${pkgver}-efi32/" || true
      cp -r "${srcdir}/${pkgname}-${pkgver}" 
"${srcdir}/${pkgname}-${pkgver}-efi32"
      cd "${srcdir}/${pkgname}-${pkgver}-efi32/"
-
+
      ## Unset all compiler FLAGS for efi32 build
      unset CFLAGS
      unset CPPFLAGS
      unset CXXFLAGS
      unset LDFLAGS
      unset MAKEFLAGS
-
+
      make PYTHON="python2" efi32
      make PYTHON="python2" efi32 installer
-
+
  }

  build() {
-
+
      cd "${srcdir}/${pkgname}-${pkgver}/"
-
+
      ## Do not try to build the Windows or DOS installers and DIAG files
      sed 's|diag libinstaller dos win32 win64 dosutil txt|libinstaller 
txt|g' -i "${srcdir}/${pkgname}-${pkgver}/Makefile" || true
      sed 's|win32/syslinux.exe win64/syslinux64.exe||g' -i 
"${srcdir}/${pkgname}-${pkgver}/Makefile" || true
@@ -92,73 +92,73 @@ build() {
      sed 's|dos/syslinux.com||g' -i 
"${srcdir}/${pkgname}-${pkgver}/Makefile" || true
      sed 's|INSTALLSUBDIRS = com32 utils dosutil|INSTALLSUBDIRS = com32 
utils|g' -i "${srcdir}/${pkgname}-${pkgver}/Makefile" || true
      sed 's|install -m 644 -c $(INSTALL_DIAG) 
$(INSTALLROOT)$(DIAGDIR)|# install -m 644 -c $(INSTALL_DIAG) 
$(INSTALLROOT)$(DIAGDIR)|g' -i "${srcdir}/${pkgname}-${pkgver}/Makefile" 
|| true
-
+
      ## Fix FHS manpage path
      sed 's|/usr/man|/usr/share/man|g' -i 
"${srcdir}/${pkgname}-${pkgver}/mk/syslinux.mk" || true
-
+
      ## Build syslinux-efi
      if [[ "${CARCH}" == "x86_64" ]]; then
          _build_syslinux_efi64
      fi
-
+
      if [[ "${CARCH}" == "i686" ]]; then
          _build_syslinux_efi32
      fi
-
+
      ## Build syslinux-bios
      _build_syslinux_bios
-
+
  }

  _package_syslinux_bios() {
-
+
      cd "${srcdir}/${pkgname}-${pkgver}-bios/"
-
+
      ## Install Syslinux bios
      make INSTALLROOT="${pkgdir}/" AUXDIR="/usr/lib/syslinux/bios/" 
bios install
-
+
      ## Remove syslinux.exe,syslinux64.exe,syslinux.com and dosutil dir
      rm "${pkgdir}/usr/lib/syslinux/bios"/syslinux.{com,exe} || true
      rm "${pkgdir}/usr/lib/syslinux/bios/syslinux64.exe" || true
      rm -rf "${pkgdir}/usr/lib/syslinux/bios/dosutil/" || true
-
+
      ## Remove com32 and diag dirs
      rm -rf "${pkgdir}/usr/lib/syslinux/bios/diag/" || true
      rm -rf "${pkgdir}/usr/lib/syslinux/bios/com32/" || true
-
+
      ## Move extlinux binary to /usr/bin
      install -d "${pkgdir}/usr/bin"
      mv "${pkgdir}/sbin/extlinux" "${pkgdir}/usr/bin/extlinux"
      rm -rf "${pkgdir}/sbin/"
-
+
      ## Install docs
      install -d "${pkgdir}/usr/share/doc"
      cp -ar "${srcdir}/${pkgname}-${pkgver}/doc" 
"${pkgdir}/usr/share/doc/syslinux"
-
+
      ## Install the default configuration
      install -D -m0644 "${srcdir}/syslinux.cfg" 
"${pkgdir}/boot/syslinux/syslinux.cfg"
-
+
      ## Install the installation and update script
      ## This script is maintained at git://gist.github.com/772138.git
      ## Script not yet updated for syslinux-efi
      install -D -m0755 "${srcdir}/syslinux-install_update" 
"${pkgdir}/usr/bin/syslinux-install_update"
-
+
  }

  package() {
-
+
      cd "${srcdir}/${pkgname}-${pkgver}/"
-
+
      if [[ "${CARCH}" == "x86_64" ]]; then
          cd "${srcdir}/${pkgname}-${pkgver}-efi64/"
          make INSTALLROOT="${pkgdir}/" AUXDIR="/usr/lib/syslinux/" 
efi64 install
      fi
-
+
      if [[ "${CARCH}" == "i686" ]]; then
          cd "${srcdir}/${pkgname}-${pkgver}-efi32/"
          make INSTALLROOT="${pkgdir}/" AUXDIR="/usr/lib/syslinux/" 
efi32 install
      fi
-
+
      _package_syslinux_bios
-
+
  }

syslinux-install_update:
--- /tmp/syslinux/syslinux-install_update   2013-07-06 
08:55:11.000000000 -0400
+++ syslinux/syslinux-install_update    2013-07-06 07:42:58.931760621 -0400
@@ -1,7 +1,7 @@
  #!/bin/bash
  #
  # Sylinux Installer / Updater Scripts
-# Copyright (C) 2011  Matthew Gyurgyik <pyther at pyther.net>
+# Copyright (C) 2013  Matthew Gyurgyik <pyther at pyther.net>
  #
  # This program is free software; you can redistribute it and/or
  # modify it under the terms of the GNU General Public License
@@ -293,13 +293,13 @@ install_mbr() {
      return 0
  }

-_install() {
+install_modules() {
      # Copy all com32 files to /boot
      for file in "${libpath}"/*.c32; do
          file=${file##*/}
          # Symlink files if /boot resides on the same partition as root
          if [[ "$boot" = root ]]; then
-            ln -s "${libpath#$CHROOT}/$file" "$bootpath/$file" &> /dev/null
+            ln -sf "${libpath#$CHROOT}/$file" "$bootpath/$file" &> 
/dev/null
          elif [[ "$boot" = boot ]]; then
              cp "$libpath/$file" "$bootpath/$file"
          fi
@@ -313,59 +313,43 @@ _install() {
              cp "$pciids_file" "$bootpath/pci.ids" &> /dev/null
          fi
      fi
+}
+
+_install() {
+    install_modules

      if device_is_raid "$bootpart"; then
-        echo "Detected RAID on /boot - installing Syslinux with --raid"
+        echo "Detected RAID on /boot"
          "$extlinux" --install "$bootpath" -r > /dev/null 2>&1
      else
          "$extlinux" --install "$bootpath" > /dev/null 2>&1
      fi

      if (( $? )); then
-        echo "Syslinux install failed"
+        echo "syslinux install failed"
          exit 2
      else
-        echo "Syslinux install successful"
+        echo "syslinux install successful"
      fi

      touch "$CHROOT/$autoupdate_file"
  }

  update() {
-    # Update c32 files in /boot, if /boot is not on same fs
-    if [[ "$boot" = boot ]]; then
-        for file in "$bootpath"/*.c32; do
-            file=${file##*/}
-            cp "$libpath/$file" "$bootpath/$file" &> /dev/null
-        done
-        if [[ -f "$bootpath/pci.ids" ]]; then
-            cp "$pciids_file" "$bootpath/pci.ids" &> /dev/null
-        fi
-    fi
-
-    # Ensure core modules exist and if not install them
-    for file in "${core_modules[@]}"; do
-        if [[ ! -f $bootpath/$file ]]; then
-            if [[  "$boot" = root ]]; then
-                ln -s "${libpath#$CHROOT}/$file" "$bootpath/$file" &> 
/dev/null
-            elif [[ "$boot" = boot ]]; then
-                cp "$libpath/$file" "$bootpath/$file"
-            fi
-        fi
-    done
+    install_modules

      if device_is_raid $bootpart; then
-        echo "Detected RAID on /boot - installing Syslinux with --raid"
+        echo "Detected RAID on /boot"
          "$extlinux" --update "$bootpath" -r &> /dev/null
      else
          "$extlinux" --update "$bootpath" &> /dev/null
      fi

      if (($?)); then
-        echo "Syslinux update failed"
+        echo "syslinux update failed"
          exit 2
      else
-        echo "Syslinux update successful"
+        echo "syslinux update successful"
      fi
  }




More information about the arch-general mailing list