[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

patch for building hdd image



hi
this a patch for building hdd image by using a binary hook
it moves the default vmlinuz-X.Y.Z and initrd-X.Y.Z files to respectively vmlinuz and initrd.img in binary/live directory
it moves isolinux.* to syslinux.* in binary/syslinux

sylvain
>From f7da03ae4e8f7f987e4d0aa1b317acb5a539ca01 Mon Sep 17 00:00:00 2001
From: ferriol <ferriol@gate.cnrs.fr>
Date: Tue, 25 Oct 2011 18:22:34 +0200
Subject: [PATCH 5/5] fix syslinux themes bug

---
 functions/defaults.sh                          |    1 +
 scripts/build/lb_binary_hooks                  |    9 ++-
 share/hooks/001-fix-syslinux-themes-bug.binary |   61 ++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 3 deletions(-)
 create mode 100755 share/hooks/001-fix-syslinux-themes-bug.binary

diff --git a/functions/defaults.sh b/functions/defaults.sh
index adfd172..c5e4858 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -633,6 +633,7 @@ Set_defaults ()
 				remove-openssh-server-host-keys \
 				remove-python-py \
 				remove-udev-persistent-rules}"
+			LB_BINARY_HOOKS="${LB_BINARY_HOOKS:-fix-syslinux-themes-bug}"
 			;;
 
 		kubuntu)
diff --git a/scripts/build/lb_binary_hooks b/scripts/build/lb_binary_hooks
index 32cf5a0..87cdfbd 100755
--- a/scripts/build/lb_binary_hooks
+++ b/scripts/build/lb_binary_hooks
@@ -41,14 +41,17 @@ Create_lockfile .lock
 ## Processing distribution hooks
 
 # Running hooks
-for _HOOK in ${LB_BINARY_HOOKS}
+for HOOK in $(ls "${LB_BASE}"/hooks/*.binary)
 do
-	if [ -e "${LB_BASE}/hooks/???-${_HOOK}.binary" ]
+    for _HOOK in "${LB_BINARY_HOOKS}"
+    do
+	if [ $(basename "${HOOK}" | cut -c 5- | sed s/\.binary//) = "${_HOOK}" ]
 	then
 		cd binary
-		./"${LB_BASE}/hooks/???-${_HOOK}.binary" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
+		"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
 		cd "${OLDPWD}"
 	fi
+    done
 done
 
 ## Processing local hooks
diff --git a/share/hooks/001-fix-syslinux-themes-bug.binary b/share/hooks/001-fix-syslinux-themes-bug.binary
new file mode 100755
index 0000000..31eb375
--- /dev/null
+++ b/share/hooks/001-fix-syslinux-themes-bug.binary
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+set -e
+
+# Including common functions
+. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
+
+# Reading configuration files
+Read_conffiles ../config/all ../config/common ../config/bootstrap ../config/chroot ../config/binary ../config/source
+Set_defaults
+
+if [ "${LB_BOOTLOADER}" != "syslinux" ]
+then
+	exit 0
+fi
+
+case "${LB_INITRAMFS}" in
+	casper)
+		DESTDIR="casper"
+		;;
+
+	live-boot)
+		DESTDIR="live"
+		;;
+
+	*)
+		DESTDIR="boot"
+		;;
+esac
+
+case "${LB_ARCHITECTURES}" in
+	powerpc)
+		LINUX="vmlinux"
+		;;
+
+	*)
+		LINUX="vmlinuz"
+		;;
+esac
+
+if [ "${LB_LINUX_PACKAGES}" != "none" ]
+then
+    DEFAULT_FLAVOUR="$(echo ${LB_LINUX_FLAVOURS} | awk '{ print $1 }')"
+    DEFAULT_KERNEL="$(basename ${DESTDIR}/${LINUX}-*${DEFAULT_FLAVOUR})"
+    DEFAULT_INITRD="$(basename ${DESTDIR}/initrd.img-*${DEFAULT_FLAVOUR})"
+    mv "${DESTDIR}/${DEFAULT_KERNEL}" "${DESTDIR}/${LINUX}"
+    mv "${DESTDIR}/${DEFAULT_INITRD}" "${DESTDIR}/initrd.img"
+fi
+
+
+# /usr/share/syslinux/themes/debian/syslinux-live contains isolinux.cfg,isolinux.bin instead of syslinux.cfg,syslinux.bin
+_SUFFIX="syslinux"
+if [ -e ${_SUFFIX}/isolinux.cfg ]
+then
+    mv "${_SUFFIX}/isolinux.cfg" "${_SUFFIX}/syslinux.cfg"
+fi
+if [ -e ${_SUFFIX}/isolinux.bin ]
+then
+    mv "${_SUFFIX}/isolinux.bin" "${_SUFFIX}/syslinux.bin"
+fi
+
-- 
1.7.7


Reply to: