From e98b48021205f1cc21db96cdcabab909b6db5e86 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 29 Jul 2009 15:12:39 +0200 Subject: create a klibc hook script we may soon no longer need it, so move it out to its own, so it can be more easily played with. Signed-off-by: maximilian attems --- hooks/klibc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 hooks/klibc (limited to 'hooks/klibc') diff --git a/hooks/klibc b/hooks/klibc new file mode 100644 index 0000000..b563307 --- /dev/null +++ b/hooks/klibc @@ -0,0 +1,21 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# klibc +ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin +ln -s /lib/klibc-*.so ${DESTDIR}/lib +rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip -- cgit v1.2.3 From a71705c44cc48a31ad57443dbbdb1fdf8815f9fb Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 29 Jul 2009 16:51:59 +0200 Subject: klibc remove zcat and gunzip not really used in initramfs. Signed-off-by: maximilian attems --- hooks/klibc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 hooks/klibc (limited to 'hooks/klibc') diff --git a/hooks/klibc b/hooks/klibc old mode 100644 new mode 100755 index b563307..c6bb75e --- a/hooks/klibc +++ b/hooks/klibc @@ -18,4 +18,4 @@ esac # klibc ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin ln -s /lib/klibc-*.so ${DESTDIR}/lib -rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip +rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip ${DESTDIR}/bin/zcat ${DESTDIR}/bin/gunzip -- cgit v1.2.3 From eea7e5df69e993feeb39e664105016b89e0e09e6 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 29 Jul 2009 16:57:15 +0200 Subject: move busybox addition to a hook script thus export the 2 needed busybox variables, be sure to have the klibc shell for now around. Signed-off-by: maximilian attems --- hooks/busybox | 31 +++++++++++++++++++++++++++++++ hooks/klibc | 3 +++ mkinitramfs | 18 ++---------------- 3 files changed, 36 insertions(+), 16 deletions(-) create mode 100755 hooks/busybox (limited to 'hooks/klibc') diff --git a/hooks/busybox b/hooks/busybox new file mode 100755 index 0000000..7845f58 --- /dev/null +++ b/hooks/busybox @@ -0,0 +1,31 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# busybox +if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then + # those root need busybox + eval "$(mount | awk '/ \/ / {print "r_dev=" $1; exit}')" + if [ "${r_dev#/dev/mapper/}" != "${r_dev}" ]; then + echo "Warning: Busybox is required for successful boot!" + fi +else + . /usr/share/initramfs-tools/hook-functions + rm -f ${DESTDIR}/bin/sh + rm -f ${DESTDIR}/bin/busybox + copy_exec ${BUSYBOXDIR}/busybox /bin/busybox + ln -s ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/sh +fi diff --git a/hooks/klibc b/hooks/klibc index c6bb75e..56f49ef 100755 --- a/hooks/klibc +++ b/hooks/klibc @@ -19,3 +19,6 @@ esac ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin ln -s /lib/klibc-*.so ${DESTDIR}/lib rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip ${DESTDIR}/bin/zcat ${DESTDIR}/bin/gunzip +if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then + mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh +fi diff --git a/mkinitramfs b/mkinitramfs index 11f44f8..f4f122c 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -9,7 +9,7 @@ CONFDIR="/etc/initramfs-tools" verbose="n" errors_to="2>/dev/null" # BUSYBOXDIR="/usr/lib/initramfs-tools/bin/" -BUSYBOXDIR="/bin" +export BUSYBOXDIR="/bin" OPTIONS=`getopt -o d:ko:r:v -n "$0" -- "$@"` @@ -153,6 +153,7 @@ export DPKG_ARCH export verbose export KEYMAP export MODULES +export BUSYBOX # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ @@ -231,21 +232,6 @@ if [ -n "${ROOT}" ]; then echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root fi -# Busybox -if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then - mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh - # those root need busybox - eval "$(mount | awk '/ \/ / {print "r_dev=" $1; exit}')" - if [ "${r_dev#/dev/mapper/}" != "${r_dev}" ]; then - echo "Warning: Busybox is required for successful boot!" - fi -else - rm -f ${DESTDIR}/bin/sh - rm -f ${DESTDIR}/bin/busybox - copy_exec ${BUSYBOXDIR}/busybox /bin/busybox - ln -s ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/sh -fi - # Modutils copy_exec /sbin/modprobe /sbin copy_exec /sbin/depmod /sbin -- cgit v1.2.3 From 0830e97339add137d56d13cdbe07282f3cdba8f6 Mon Sep 17 00:00:00 2001 From: Maximilian Gass Date: Sat, 6 Feb 2010 21:01:14 +0100 Subject: mkinitramfs: KEYMAP option fails to work due to missing keymap I have attached a patch that makes the keymap hook consider /etc/console-setup/cached.kmap.gz. I have also added gunzip to the initramfs because otherwise loadkeys complained that it was missing and failed to load the keymap. (closes: #565416) Signed-off-by: maximilian attems --- hooks/keymap | 11 +++++++++-- hooks/klibc | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'hooks/klibc') diff --git a/hooks/keymap b/hooks/keymap index a2b1b08..fa97209 100755 --- a/hooks/keymap +++ b/hooks/keymap @@ -21,13 +21,20 @@ if [ "$KEYMAP" != "y" ] && [ "$KEYMAP" != "Y" ]; then fi # Step 1 - Basic tools -if [ ! -x /bin/loadkeys ] || [ ! -r /etc/console/boottime.kmap.gz ]; then +if [ ! -x /bin/loadkeys ] || +! ( [ -r /etc/console/boottime.kmap.gz ] \ + || [ -r /etc/console-setup/cached.kmap.gz ] ); then exit 0 fi . /usr/share/initramfs-tools/hook-functions copy_exec /bin/loadkeys /bin -cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc/ + +if [ -e /etc/console-setup/cached.kmap.gz ]; then + cp /etc/console-setup/cached.kmap.gz ${DESTDIR}/etc/boottime.kmap.gz +else + cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc/ +fi # Step 2 - Check for UTF8 console if [ ! -x /usr/bin/kbd_mode ]; then diff --git a/hooks/klibc b/hooks/klibc index 56f49ef..663e22c 100755 --- a/hooks/klibc +++ b/hooks/klibc @@ -18,7 +18,7 @@ esac # klibc ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin ln -s /lib/klibc-*.so ${DESTDIR}/lib -rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip ${DESTDIR}/bin/zcat ${DESTDIR}/bin/gunzip +rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip ${DESTDIR}/bin/zcat if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh fi -- cgit v1.2.3 From 6eb4c51793fd97b397760ab2336fdfb0c42e45a1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 5 Apr 2010 04:55:41 +0200 Subject: hooks/klibc: Keep gzip in initramfs merge from 0.92bubuntu1 Signed-off-by: maximilian attems --- hooks/klibc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hooks/klibc') diff --git a/hooks/klibc b/hooks/klibc index 663e22c..ad0a85d 100755 --- a/hooks/klibc +++ b/hooks/klibc @@ -18,7 +18,7 @@ esac # klibc ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin ln -s /lib/klibc-*.so ${DESTDIR}/lib -rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip ${DESTDIR}/bin/zcat +rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/zcat if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh fi -- cgit v1.2.3 From ab28c77261267a14cc7308e8c4d7a0b48a8ac2ab Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 14 Jun 2010 12:15:07 +0200 Subject: code cleanup: consequently replace spaces in indentions with tabs to unify coding stile Signed-off-by: Michael Prokop --- hook-functions | 18 +++++++++--------- hooks/busybox | 8 ++++---- hooks/klibc | 8 ++++---- mkinitramfs | 22 +++++++++++----------- update-initramfs | 16 ++++++++-------- 5 files changed, 36 insertions(+), 36 deletions(-) (limited to 'hooks/klibc') diff --git a/hook-functions b/hook-functions index 8b6a89c..c456c5d 100644 --- a/hook-functions +++ b/hook-functions @@ -72,7 +72,7 @@ manual_add_modules() # /proc/modules exists if [ ! -e /proc/modules ] ; then continue - fi + fi if grep -q "^$(basename "${kmod}" .ko)[[:space:]]" \ /proc/modules \ @@ -127,10 +127,10 @@ copy_exec() { # Copy the dependant libraries for x in $(ldd ${src} 2>/dev/null | sed -e ' - /\//!d; - /linux-gate/d; - /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; - s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do + /\//!d; + /linux-gate/d; + /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; + s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do # Try to use non-optimised libraries where possible. # We assume that all HWCAP libraries will be in tls, @@ -166,7 +166,7 @@ copy_modules_dir() if [ "${verbose}" = "y" ]; then echo "Copying module directory ${dir}" if [ $# -ge 1 ]; then - echo "(excluding $*)" + echo "(excluding $*)" fi fi while [ $# -ge 1 ]; do @@ -274,7 +274,7 @@ dep_add_modules() # lvm on md or luks on md if [ "${block#md}" != "${block}" ]; then block=$(grep "^${block}" /proc/mdstat | \ - awk "{gsub(/^${block} : .* (multipath|linear|raid[[:digit:]]+)\ /,\"\")};1") + awk "{gsub(/^${block} : .* (multipath|linear|raid[[:digit:]]+)\ /,\"\")};1") block="${block%%\[*}" fi # luks or lvm on cciss or ida @@ -531,8 +531,8 @@ check_minkver() fi set_initlist for cm_x in ${initlist:-}; do - # sed: keep last line starting with MINKVER=, - # remove MINKVER= and trailing space + # sed: keep last line starting with MINKVER=, + # remove MINKVER= and trailing space minver=$(sed '/^MINKVER=/!d;$!d;s/^MINKVER=//;s/[[:space:]]*$//' "${initdir}/${cm_x}") if [ -z "${tmp}" ]; then continue diff --git a/hooks/busybox b/hooks/busybox index 7845f58..a2e57ae 100755 --- a/hooks/busybox +++ b/hooks/busybox @@ -4,15 +4,15 @@ PREREQ="" prereqs() { - echo "$PREREQ" + echo "$PREREQ" } case $1 in # get pre-requisites prereqs) - prereqs - exit 0 - ;; + prereqs + exit 0 + ;; esac # busybox diff --git a/hooks/klibc b/hooks/klibc index ad0a85d..e41c631 100755 --- a/hooks/klibc +++ b/hooks/klibc @@ -4,15 +4,15 @@ PREREQ="" prereqs() { - echo "$PREREQ" + echo "$PREREQ" } case $1 in # get pre-requisites prereqs) - prereqs - exit 0 - ;; + prereqs + exit 0 + ;; esac # klibc diff --git a/mkinitramfs b/mkinitramfs index 70e5c13..a854f02 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -69,7 +69,7 @@ for i in /usr/share/initramfs-tools/conf.d/* ${CONFDIR}/conf.d/*; do | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -v '\.dpkg-.*$')"; done # FIXME: deprecated those settings on mkinitramfs run -# these conf dirs are for boot scripts and land on initramfs +# these conf dirs are for boot scripts and land on initramfs for i in ${EXTRA_CONF}; do if [ -e ${CONFDIR}/conf.d/${i} ]; then . ${CONFDIR}/conf.d/${i} @@ -198,7 +198,7 @@ done # Copy the modules.order file in if [ -f "${MODULESDIR}/modules.order" ]; then cp -p "${MODULESDIR}/modules.order" \ - "${DESTDIR}${MODULESDIR}/modules.order" + "${DESTDIR}${MODULESDIR}/modules.order" fi # MODULES=list case. Always honour. @@ -313,15 +313,15 @@ find "${DESTDIR}" -type l -printf '%p %Y\n' | sed -n 's/ [LN]$//p' \ # cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}" || exit 1 exec 3>&1 eval ` - # http://cfaj.freeshell.org/shell/cus-faq-2.html - exec 4>&1 >&3 3>&- - cd "${DESTDIR}" - { - find . 4>&-; echo "ec1=$?;" >&4 - } | { - cpio --quiet --dereference -o -H newc 4>&-; echo "ec2=$?;" >&4 - } | ${compress} >"${outfile}" - echo "ec3=$?;" >&4 + # http://cfaj.freeshell.org/shell/cus-faq-2.html + exec 4>&1 >&3 3>&- + cd "${DESTDIR}" + { + find . 4>&-; echo "ec1=$?;" >&4 + } | { + cpio --quiet --dereference -o -H newc 4>&-; echo "ec2=$?;" >&4 + } | ${compress} >"${outfile}" + echo "ec3=$?;" >&4 ` if [ "$ec1" -ne 0 ]; then exit "$ec1"; fi if [ "$ec2" -ne 0 ]; then exit "$ec2"; fi diff --git a/update-initramfs b/update-initramfs index 53ebed2..f4323b7 100755 --- a/update-initramfs +++ b/update-initramfs @@ -51,14 +51,14 @@ EOF # chroot check chrooted() { - # borrowed from udev's postinst - if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then - # the devicenumber/inode pair of / is the same as that of - # /sbin/init's root, so we're *not* in a chroot and hence - # return false. - return 1 - fi - return 0 + # borrowed from udev's postinst + if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then + # the devicenumber/inode pair of / is the same as that of + # /sbin/init's root, so we're *not* in a chroot and hence + # return false. + return 1 + fi +return 0 } mild_panic() -- cgit v1.2.3