From ac222142f849ed340c3b7a0300a57cc3153e0436 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 9 Jun 2005 17:23:35 +0000 Subject: Add hookscripts --- docs/example_script | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docs/example_script (limited to 'docs/example_script') diff --git a/docs/example_script b/docs/example_script new file mode 100644 index 0000000..111b0d8 --- /dev/null +++ b/docs/example_script @@ -0,0 +1,21 @@ +#!/bin/sh + +# List the soft prerequisites here. So if there's something you know +# should be run first iff it exists. +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# Do the work here. +echo "Got here!" -- cgit v1.2.3 From 2c72958bfc090b046e21e9eaad9134235095ad30 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 30 Jun 2005 00:05:01 +0000 Subject: * Use detailed logging now for debian/changelog. We have at least three people hacking now, and details would probably be useful. * debian/TODO: Update * debian/dirs: Sort and add usr/share/initramfs-tools/hooks * debian/initramfs-tools.examples: Add docs/example_hook and docs/example_hook_cpiogz * debian/initramfs-tools.install: Pretty Print. * debian/rules: Ensure that mkinitramfs is executable * docs/example_script: New file * init: Add concept of 'quiet', be verbose if not specified * mkinitramfs: Do not load script functions until needed Clear up comments / documentation Use DESTDIR instead of TMPDIR Add ability to link in extra hunks into the cpio file Cosmetic cleanups * scripts/functions: Add lsb stype log_FOO_msg functions * scripts/local: Add logging * scripts/nfs: Add logging --- debian/TODO | 2 + debian/changelog | 39 +++++++++++++++ debian/dirs | 9 ++-- debian/initramfs-tools.examples | 2 + debian/initramfs-tools.install | 8 +-- debian/rules | 2 +- docs/example_script | 73 ++++++++++++++++++++++++++- mkinitramfs | 106 +++++++++++++++++++++++----------------- scripts/functions | 39 ++++++++++++++- scripts/local | 8 +++ scripts/nfs | 10 +++- 11 files changed, 240 insertions(+), 58 deletions(-) (limited to 'docs/example_script') diff --git a/debian/TODO b/debian/TODO index bf7e07d..d080de3 100644 --- a/debian/TODO +++ b/debian/TODO @@ -1,6 +1,8 @@ TODO ==== + o Grep for TODO and FIXME and do those. =) + o Get udev compiled against klibc o Integrate hotplug-ng diff --git a/debian/changelog b/debian/changelog index 54d3fcd..6c37206 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,42 @@ +initramfs-tools (0.13) breezy; urgency=low + + "We live in age when unnecessary things are our only necessities." + - Oscar Wilde + + * Use detailed logging now for debian/changelog. We have at least + three people hacking now, and details would probably be useful. + + * debian/TODO: Update + + * debian/dirs: Sort and add usr/share/initramfs-tools/hooks + + * debian/initramfs-tools.examples: Add docs/example_hook and + docs/example_hook_cpiogz + + * debian/initramfs-tools.install: Pretty Print. + + * debian/rules: Ensure that mkinitramfs is executable + + * docs/example_script: New file + + * init: Add concept of 'quiet', be verbose if not specified + + * mkinitramfs: Do not load script functions until needed + Clear up comments / documentation + Use DESTDIR instead of TMPDIR + Add ability to link in extra hunks into the cpio file + Cosmetic cleanups + + * scripts/functions: Add lsb stype log_FOO_msg functions + + * scripts/local: Add logging + + * scripts/nfs: Add logging + + Thanks to Karl Hegbloom for most of these patches! + + -- Jeff Bailey Wed, 29 Jun 2005 23:50:56 +0000 + initramfs-tools (0.12) breezy; urgency=low "I am not young enough to know everything." - Oscar Wilde diff --git a/debian/dirs b/debian/dirs index 94484bb..ac6210e 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,9 +1,10 @@ etc/mkinitramfs/init-bottom etc/mkinitramfs/init-top -etc/mkinitramfs/local-top -etc/mkinitramfs/local-premount etc/mkinitramfs/local-bottom -etc/mkinitramfs/nfs-top -etc/mkinitramfs/nfs-premount +etc/mkinitramfs/local-premount +etc/mkinitramfs/local-top etc/mkinitramfs/nfs-bottom +etc/mkinitramfs/nfs-premount +etc/mkinitramfs/nfs-top +usr/share/initramfs-tools/hooks usr/share/initramfs-tools/modules.d diff --git a/debian/initramfs-tools.examples b/debian/initramfs-tools.examples index 0e8472b..9f67297 100644 --- a/debian/initramfs-tools.examples +++ b/debian/initramfs-tools.examples @@ -1,2 +1,4 @@ conf/modules docs/example_script +docs/example_hook +docs/example_hook_cpiogz diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index e76186f..a2a78f5 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -1,4 +1,4 @@ -mkinitramfs usr/sbin -init usr/share/initramfs-tools -scripts usr/share/initramfs-tools -conf/initramfs.conf etc/mkinitramfs +mkinitramfs usr/sbin +init usr/share/initramfs-tools +scripts usr/share/initramfs-tools +conf/initramfs.conf etc/mkinitramfs diff --git a/debian/rules b/debian/rules index 0a1575f..a1b8695 100644 --- a/debian/rules +++ b/debian/rules @@ -3,4 +3,4 @@ include /usr/share/cdbs/1/rules/debhelper.mk common-build-arch:: - chmod +x init + chmod +x init mkinitramfs diff --git a/docs/example_script b/docs/example_script index 111b0d8..221c888 100644 --- a/docs/example_script +++ b/docs/example_script @@ -1,7 +1,52 @@ #!/bin/sh -# List the soft prerequisites here. So if there's something you know -# should be run first iff it exists. +# +# This script is run inside of the initramfs environment during the +# system boot process. It is installed there by 'mkinitramfs'. The +# package that owns it may opt to install it in either an appropriate +# location under "/usr/share/initramfs-tools/scripts/", or a similar +# location under "/etc/mkinitramfs/scripts/", depending upon whether +# it should be considered to be a user modifiable conffile or not. +# +# TODO: How do we deal with the case where the package that installed +# this has been removed but not purged, if we always arbitrarily +# copy all of these scripts into the initramfs? +# +# * The available toolset is limited inside this environment... +# +# TODO: document that toolset in the man page. +# +# * /dev, /proc, and /sys are already mounted. / is a ?? ro/rw +# filesystem... etc. more documentation. +# +# * It is expected that /proc and /sys will be umounted before +# changing over to the real root file system, so you must not keep +# any files open on them beyond these scripts. +# +# * You may like to strip these documentation comments from this +# example if you take it for a template, to save a little space in +# the initramfs, since nobody will ever read it from inside of +# there anyhow. +# + +# +# The environment contains at least the following variables: +# +# TODO: Decide what environment variables are meaningful and defined +# in this context, then document them as part of the interface. +# +# Because this script will be run as a full separate process, rather +# than sourced inside the context of the driver script, if it needs to +# pass information to another script that may run after it, it must do +# so by writing data to a file location known to both scripts. Simply +# setting an environment variable will not work. +# + +# +# List the soft prerequisites here. This is a space separated list of +# names, of scripts that are in the same directory as this one, that +# must be run before this one can be. +# PREREQ="" prereqs() @@ -18,4 +63,28 @@ prereqs) esac # Do the work here. + echo "Got here!" + +# Handle an error: + +if [ -n "$an_error_occured" ]; +then + # + # TODO: Do we need 'warn()', 'error()', and/or 'fatal()' for this? + # I think we ultimately do, and that they need to be in their own + # well-documented location so that an overlay can override them. + # Think 'usplash' progress updates. + # + echo "An error occured in $0: $an_error_occured" >&2 + exit 1 + # + # TODO: Decide if different error codes are meaningful, what they + # mean, and what the semantics of them are wrt 'init' pass + # or panic. Consider naming the error values with mnemonic + # symbols rather than magic numbers. + # +fi + +exit 0 + diff --git a/mkinitramfs b/mkinitramfs index 4dabfce..c05fa47 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,12 +1,9 @@ #!/bin/sh -# For dependency ordered mkinitramfs hook scripts. -. /usr/share/initramfs-tools/scripts/functions - -# Takes a file containing a list of modules to be added as an argument -# Figures out dependancies and adds it in. +# Takes a file containing a list of modules to be added as an +# argument, figures out dependancies, and adds them. # -# File syntax: +# Input file syntax: # # # comment # modprobe_module_name [args ...] @@ -22,13 +19,13 @@ manual_add_modules() sed -e '/^#/d' ${1} | while read module rest; do for y in $(modprobe --set-version=${version} --show-depends ${module} | awk '{ print $2 }'); do # Prune duplicates - if [ -e ${TMPDIR}/${y} ]; then + if [ -e ${DESTDIR}/${y} ]; then continue fi - mkdir -p ${TMPDIR}/$(dirname ${y}) - ln -s ${y} ${TMPDIR}/$(dirname ${y}) - echo $(basename ${y} .ko) "${rest}" >>${TMPDIR}/conf/modules + mkdir -p ${DESTDIR}/$(dirname ${y}) + ln -s ${y} ${DESTDIR}/$(dirname ${y}) + echo $(basename ${y} .ko) "${rest}" >>${DESTDIR}/conf/modules done done } @@ -36,7 +33,7 @@ manual_add_modules() # Copy entire subtrees to the initramfs copy_modules_dir() { - tmpdir_modbase=${TMPDIR}/lib/modules/${version} + tmpdir_modbase=${DESTDIR}/lib/modules/${version} mkdir -p $(dirname ${tmpdir_modbase}/${1}) cp -a /lib/modules/${version}/${1} ${tmpdir_modbase}/${1} } @@ -64,13 +61,13 @@ auto_add_modules() for x in mbcache nfs af_packet raid1 ide-cd ide-disk ide-generic; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates - if [ -e ${TMPDIR}/${y} ]; then + if [ -e ${DESTDIR}/${y} ]; then continue fi - mkdir -p ${TMPDIR}/$(dirname ${y}) - ln -s ${y} ${TMPDIR}/$(dirname ${y}) - depmod -b ${TMPDIR} ${version} + mkdir -p ${DESTDIR}/$(dirname ${y}) + ln -s ${y} ${DESTDIR}/$(dirname ${y}) + depmod -b ${DESTDIR} ${version} done done } @@ -96,6 +93,8 @@ EOF # Defaults keep="n" CONFDIR="/etc/mkinitramfs" +verbose="n" +errors_to="2>/dev/null" while getopts "d:ko:r:" flag; do case $flag in @@ -117,6 +116,9 @@ done shift $((${OPTIND} - 1)) +# For dependency ordered mkinitramfs hook scripts. +. /usr/share/initramfs-tools/scripts/functions + . ${CONFDIR}/initramfs.conf if [ x${outfile} = x ]; then @@ -157,10 +159,21 @@ if [ ! -e /lib/modules/${version} ]; then exit 1 fi -TMPDIR=$(mktemp -d) || exit 1 -mkdir -p ${TMPDIR}/modules ${TMPDIR}/conf ${TMPDIR}/etc -mkdir -p ${TMPDIR}/bin ${TMPDIR}/lib ${TMPDIR}/scripts -mkdir -p ${TMPDIR}/sbin +DESTDIR=$(mktemp -t -d mkinitramfs_XXXXXX) || exit 1 +__TMPCPIOGZ=$(mktemp -t mkinitramfs-OL_XXXXXX) || exit 1 + +# Export environment for hook scripts. +# +export version +export CONFDIR +export DESTDIR + +# Private, used by 'catenate_cpiogz'. +export __TMPCPIOGZ + +for d in bin conf etc lib modules sbin scripts; do + mkdir -p ${DESTDIR}/${d} +done for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do manual_add_modules ${x} @@ -171,46 +184,51 @@ auto_add_modules # Have to do each file, because cpio --dereference doesn't recurse down # symlinks. -ln -s /usr/lib/klibc/bin/* ${TMPDIR}/bin -ln -s /usr/lib/klibc/lib/* ${TMPDIR}/lib -ln -s /usr/share/initramfs-tools/init ${TMPDIR}/init -cp -a /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts -ln -s ${CONFDIR}/initramfs.conf ${TMPDIR}/conf -ln -s /etc/udev ${TMPDIR}/etc +ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin +ln -s /usr/lib/klibc/lib/* ${DESTDIR}/lib +ln -s /usr/share/initramfs-tools/init ${DESTDIR}/init +cp -a /usr/share/initramfs-tools/scripts/* ${DESTDIR}/scripts +ln -s ${CONFDIR}/initramfs.conf ${DESTDIR}/conf +ln -s /etc/udev ${DESTDIR}/etc # Hack until udev is built with klibc -ln -s /sbin/udev ${TMPDIR}/bin -ln -s /sbin/udevstart ${TMPDIR}/bin -ln -s /lib/libc.so.* ${TMPDIR}/lib -ln -s /lib/ld*.so.* ${TMPDIR}/lib -rm ${TMPDIR}/lib/*lsb* +ln -s /sbin/udev ${DESTDIR}/bin +ln -s /sbin/udevstart ${DESTDIR}/bin +ln -s /lib/libc.so.* ${DESTDIR}/lib +ln -s /lib/ld*.so.* ${DESTDIR}/lib +rm ${DESTDIR}/lib/*lsb* # Busybox -rm ${TMPDIR}/bin/sh -ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/sh +rm ${DESTDIR}/bin/sh +ln -s /usr/lib/initramfs-tools/bin/busybox ${DESTDIR}/bin/sh # This is ugly, but needed atm to make the builtins work =( -ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/busybox +ln -s /usr/lib/initramfs-tools/bin/busybox ${DESTDIR}/bin/busybox # Modutils -ln -s /sbin/modprobe ${TMPDIR}/sbin -ln -s /sbin/depmod ${TMPDIR}/sbin -ln -s /sbin/rmmod ${TMPDIR}/sbin -mkdir -p ${TMPDIR}/etc/modprobe.d -ln -s /etc/modprobe.d/aliases ${TMPDIR}/etc/modprobe.d +ln -s /sbin/modprobe ${DESTDIR}/sbin +ln -s /sbin/depmod ${DESTDIR}/sbin +ln -s /sbin/rmmod ${DESTDIR}/sbin +mkdir -p ${DESTDIR}/etc/modprobe.d +ln -s /etc/modprobe.d/aliases ${DESTDIR}/etc/modprobe.d # Raid -ln -s /sbin/mdadm ${TMPDIR}/sbin -ln -s /sbin/mdrun ${TMPDIR}/sbin +ln -s /sbin/mdadm ${DESTDIR}/sbin +ln -s /sbin/mdrun ${DESTDIR}/sbin run_scripts /usr/share/initramfs-tools/hooks run_scripts /etc/mkinitramfs/hooks -# FIXME catenate extra cpio.gz here >>${outfile} +(cd ${DESTDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) -(cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) +if [ -s ${__TMPCPIOGZ} ]; then + cat ${__TMPCPIOGZ} >>${outfile} +fi if [ "${keep}" = "y" ]; then - echo "Working files in ${TMPDIR}" + echo "Working files in ${DESTDIR} and overlay in ${__TMPCPIOGZ}" else - rm -rf "${TMPDIR}" + rm -rf "${DESTDIR}" + rm -rf "${__TMPCPIOGZ}" fi + +exit 0 diff --git a/scripts/functions b/scripts/functions index 5fb8c04..1899a14 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1,9 +1,45 @@ # -*- shell-script -*- +_log_msg() +{ + if [ "$quiet" = "y" ]; then return; fi + echo "$@" +} + +log_success_msg() +{ + _log_msg "Success: $@" +} + +log_failure_msg() +{ + _log_msg "Failure: $@" +} + +log_warning_msg() +{ + _log_msg "Warning: $@" +} + +log_begin_msg() +{ + _log_msg "Begin: $@ ..." +} + +log_end_msg() +{ + _log_msg "Done." +} + +# update_progress() # ToDo: NOP placeholder... what else for usplash? +# { +# : +# } + panic() { echo $@ - FS1='(initramfs) ' exec /bin/sh + FS1='(initramfs) ' exec /bin/sh /dev/console 2>&1 } render() @@ -162,5 +198,4 @@ load_modules() done ide_boot_events - } diff --git a/scripts/local b/scripts/local index 4a17abb..bcc96ad 100644 --- a/scripts/local +++ b/scripts/local @@ -3,7 +3,9 @@ # Parameter: Where to mount the filesystem mountroot () { + log_begin_msg "Running /scripts/local-top" run_scripts /scripts/local-top + log_end_msg # Get the root filesystem type if [ ! -e ${ROOT} ]; then @@ -12,7 +14,9 @@ mountroot () eval $(fstype < ${ROOT}) + log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount + log_end_msg if [ ${readonly} = y ]; then roflag=-r @@ -20,10 +24,14 @@ mountroot () roflag=-w fi + # FIXME This has no error checking modprobe ${FSTYPE} + # FIXME This has no error checking # Mount root mount ${roflag} -t ${FSTYPE} ${ROOT} ${rootmnt} + log_begin_msg "Running /scripts/log-bottom" run_scripts /scripts/local-bottom + log_end_msg } diff --git a/scripts/nfs b/scripts/nfs index 1e2be2c..8149e86 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -1,9 +1,13 @@ -# NFS filesystem mounting *- shell-script -*- +# NFS filesystem mounting -*- shell-script -*- + +# FIXME This needs error checking # Paramter: Where the root should be mounted mountroot () { + log_begin_msg "Running /scripts/nfs-top" run_scripts /scripts/nfs-top + log_end_msg modprobe nfs # For DHCP @@ -15,7 +19,9 @@ mountroot () NFSROOT=${ROOTSERVER}:${ROOTPATH} fi + log_begin_msg "Running /scripts/nfs-premount" run_scripts /scripts/nfs-premount + log_end_msg if [ ${readonly} = y ]; then roflag="-o ro" @@ -25,6 +31,8 @@ mountroot () nfsmount ${roflag} ${NFSROOT} ${rootmnt} + log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom + log_end_msg } -- cgit v1.2.3 From 17d01b3434dac54ace5991029ed069b3d185ffd2 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 16 Jul 2006 21:54:14 +0200 Subject: massif whitespace cleanup --- break.txt | 2 +- debian/NEWS | 2 +- debian/changelog | 48 +++++++++++++++++++++++++------------------ debian/copyright | 2 +- docs/example_hook | 6 +++--- docs/example_hook_cpiogz | 2 +- docs/example_script | 4 ++-- hooks/lvm | 2 +- hooks/md | 2 +- init | 2 +- initramfs-tools.8 | 18 ++++++++-------- initramfs.conf.5 | 4 ++-- mkinitramfs | 20 +++++++++--------- mkinitramfs-kpkg | 16 +++++++-------- mkinitramfs-kpkg.8 | 6 +++--- mkinitramfs.8 | 30 +++++++++++++-------------- scripts/functions | 12 +++++------ scripts/local-top/udev_helper | 2 +- update-initramfs | 6 +++--- update-initramfs.8 | 26 +++++++++++------------ 20 files changed, 110 insertions(+), 102 deletions(-) (limited to 'docs/example_script') diff --git a/break.txt b/break.txt index ff26d5b..64ecf84 100644 --- a/break.txt +++ b/break.txt @@ -1,4 +1,4 @@ -if [ x${break} = xyes ]; then +if [ x${break} = xyes ]; then panic "Spawning shell within the initramfs" fi diff --git a/debian/NEWS b/debian/NEWS index d4647d4..a6ae4bc 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -15,7 +15,7 @@ initramfs-tools (0.10) breezy; urgency=low This means two things in particular that are important: 1) the resulting initramfs will be huge. Like 10 megs huge. - I will shrink it down once it's correct. If you're on an + I will shrink it down once it's correct. If you're on an arch that doesn't like >4mb initramfs', then this won't boot. 2) Your network drivers are loaded in the initramfs, so hotplug diff --git a/debian/changelog b/debian/changelog index 8a519b4..b48be87 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,12 +8,20 @@ initramfs-tools (0.70) unstable; urgency=low cleanup and add quoting. - scripts/local: Whitespace cleanup and add a comment. - update-initramfs: Add quoting + whitespace fix. - - changelog: for noise reduction add 0.69ubuntu{1,2,3}, all 0.40ubuntu*, + - changelog: for noise reduction add 0.69ubuntu{1,2,3}, all 0.40ubuntu*, 0.36ubuntu1 and missing 0.29 + 0.28 entries. - initramfs-tools.install, initramfs-tools.postinst and initramfs-tools.preinst merge 0.69ubuntu3. - -- maximilian attems Sun, 16 Jul 2006 20:23:41 +0200 + * break.txt, debian/NEWS, debian/changelog, debian/copyright, + docs/example_hook, docs/example_hook_cpiogz, docs/example_script, + hooks/lvm, hooks/md, init, initramfs-tools.8, initramfs.conf.5, + mkinitramfs, mkinitramfs-kpkg, mkinitramfs-kpkg.8, mkinitramfs.8, + scripts/functions, scripts/local-top/udev_helper, update-initramfs, + update-initramfs.8: Whitespace policy cleanup trailing whitespace and + non tabular indents. + + -- maximilian attems Sun, 16 Jul 2006 21:50:34 +0200 initramfs-tools (0.69b) unstable; urgency=high @@ -68,7 +76,7 @@ initramfs-tools (0.69) unstable; urgency=low * update-initramfs: Add option "-b directory" to override BOOTDIR. Allows the initramfs to be created in another dir without awkward - mkinitramfs invocation. Check that the passed arg is really a dir. + mkinitramfs invocation. Check that the passed arg is really a dir. (ubuntu: 37690) Thanks Colin Watson * update-initramfs.8: Document -b switch. @@ -312,7 +320,7 @@ initramfs-tools (0.60) unstable; urgency=low initramfs-tools (0.59b) unstable; urgency=low - * mkinitramfs-kpkg: Intialialize the variables. + * mkinitramfs-kpkg: Intialialize the variables. (closes: #359355, #359620, #359613, #359666, #359681) -- maximilian attems Tue, 28 Mar 2006 16:30:59 +0200 @@ -329,7 +337,7 @@ initramfs-tools (0.59) unstable; urgency=low - scripts/local-top/udev_helper: Leave the remaining ide-generic part there, should be taken over by udev itself. - make the md local-top scripts pre-requisite the udev one. - thanks Scott James Remnant + thanks Scott James Remnant -- maximilian attems Sun, 26 Mar 2006 22:35:15 +0200 @@ -768,7 +776,7 @@ initramfs-tools (0.40ubuntu17) dapper; urgency=low * Make auto_add_modules take an argument, so you can use it to add only some of the auto* modules (like "net" or "ide"), and create a "netboot" - option that only includes base and net (Closes launchpad.net/26426) + option that only includes base and net (Closes launchpad.net/26426) * Change the nfs script to use "mount -o nolock" instead of "nfsmount", to fix some timeouts for ltsp NFS roots (Closes launchpad.net/19196) @@ -854,7 +862,7 @@ initramfs-tools (0.40ubuntu8) dapper; urgency=low initramfs-tools (0.40ubuntu7) dapper; urgency=low * remove "sleep 3" from the nfs script before the nfsmount command, - its a leftover from debugging in breezy and slows down thin client + its a leftover from debugging in breezy and slows down thin client booting unnecessary -- Oliver Grawert Fri, 2 Dec 2005 11:45:05 +0100 @@ -887,7 +895,7 @@ initramfs-tools (0.40ubuntu4) dapper; urgency=low initramfs-tools (0.40ubuntu3) dapper; urgency=low "A true friend stabs you in the front." - - Oscar Wilde + - Oscar Wilde * hooks/acpid: Rename to ... * hooks/thermal: ... this. Add therm_pm72 for ppc64 systems. @@ -933,7 +941,7 @@ initramfs-tools (0.41) unstable; urgency=high * High urgency upload to cope with newer udev upstream - bonus: condition to test against when udev is ready. (Closes: #341014) - Thanks Marco d'Itri for guidance and + Thanks Marco d'Itri for guidance and Heikki Henriksen for double check. * Pump udev dep on 0.076-3. @@ -978,7 +986,7 @@ initramfs-tools (0.39) unstable; urgency=medium * Pump udev dependency. * init: Pump timeout as there is currently no way to check which udevd - processes are still running and why. + processes are still running and why. Cures hopefully breakage of missing devices on boot. * Sync with latest Ubuntu. @@ -1048,7 +1056,7 @@ initramfs-tools (0.37) unstable; urgency=low Exit if it doesn't exist before including current dir. Thanks to Jean Charles Delepine (Closes: #335505) - * hooks/lvm, hooks/md: Remove FIXME's at second thought. You better want + * hooks/lvm, hooks/md: Remove FIXME's at second thought. You better want to check against the binaries for your not yet created raid/lvm. -- maximilian attems Wed, 26 Oct 2005 09:22:58 +0200 @@ -1065,7 +1073,7 @@ initramfs-tools (0.36ubuntu1) dapper; urgency=low initramfs-tools (0.36) unstable; urgency=low "Sunny Autumn Release" - + * Minor cleanups in mkiniramfs. * Remove manpage section about return values. Needs to be rephrased. @@ -1149,7 +1157,7 @@ initramfs-tools (0.30) unstable; urgency=low [ maximilian Attems ] * Resynconise with latest upstream now we are in unstable. - + [ Jeff Bailey ] * debian/rules: Make sure hooks and scripts are chmod +x @@ -1197,7 +1205,7 @@ initramfs-tools (0.29) breezy; urgency=low initramfs-tools (0.28) breezy; urgency=low - * Run udevstart after loading block drivers - should fix resume from + * Run udevstart after loading block drivers - should fix resume from hibernate on non-LVM systems. -- Matthew Garrett Tue, 20 Sep 2005 01:13:31 +0100 @@ -1228,7 +1236,7 @@ initramfs-tools (0.27) unstable; urgency=low initramfs-tools (0.26) breezy; urgency=low "Experience is one thing you can't get for nothing." - - Oscar Wilde + - Oscar Wilde * scripts/local-top/lvm: Reduce -- to - in VG strings for feeding to vgchange. (Ubuntu: #13387) @@ -1264,7 +1272,7 @@ initramfs-tools (0.26) breezy; urgency=low * debian/dirs: Add etc/mkinitramfs/hooks, move all scripts subdirs into etc/mkinitramfs/scripts. - * mkinitramfs: Set the umask. Copy the scripts from + * mkinitramfs: Set the umask. Copy the scripts from /etc/mkinitramfs/scripts into the image. Make sure that modules file lists is actually a regular file. @@ -1441,9 +1449,9 @@ initramfs-tools (0.17) breezy; urgency=low genius." - Oscar Wilde - * debian/initramfs-tools.postinst: Get the name of the config file + * debian/initramfs-tools.postinst: Get the name of the config file right when seeding RESUME=. Also fix the sed expression. - Thanks to Matthew Garrett for noticing this! + Thanks to Matthew Garrett for noticing this! -- Jeff Bailey Wed, 10 Aug 2005 11:54:07 -0400 @@ -1459,7 +1467,7 @@ initramfs-tools (0.16) breezy; urgency=low * scripts/functions: Be silent when adding non-detected modules. * conf/mkinitramfs.conf: MODULES=most by default, BUSYBOX=y - (Non-busybox isn't supported now. It's not clear that it ever + (Non-busybox isn't supported now. It's not clear that it ever will be). Add RESUME line for resuming from suspend-to-disk. * scripts/local-premount/suspend: New script for suspend-to-disk. @@ -1568,7 +1576,7 @@ initramfs-tools (0.13) breezy; urgency=low Use DESTDIR instead of TMPDIR Add ability to link in extra hunks into the cpio file Cosmetic cleanups - + * scripts/functions: Add lsb stype log_FOO_msg functions * scripts/local: Add logging diff --git a/debian/copyright b/debian/copyright index 3a3bc5b..2c681c2 100644 --- a/debian/copyright +++ b/debian/copyright @@ -13,7 +13,7 @@ The Debian tree is maintained with "bzr" at: http://debian.stro.at/bzr-test/initramfs-tools/ Authors: Jeff Bailey , Adam Conrad , - Scott James Remnant , + Scott James Remnant , maximilian attems Copyright: 2005 Jeff Bailey diff --git a/docs/example_hook b/docs/example_hook index de5392d..a0d015a 100644 --- a/docs/example_hook +++ b/docs/example_hook @@ -12,7 +12,7 @@ # added to the initramfs, but the linux-image it relates to has # already been installed previously? Does this happen often # enough that it needs to be handled? How can it be handled? -# +# # * Think about the 'usplash'. The initramfs will need to be # updated if a theme change or update is desired. Maybe it # should not be totally automatic, but offered on upgrade @@ -96,9 +96,9 @@ fi # if [ -n "$an_error_occured" ]; then - # + # # TODO: Do we need 'warn()', 'error()', and/or 'fatal()' for this? - # + # echo "An error occured in $0: $an_error_occured" >&2 exit 1 # diff --git a/docs/example_hook_cpiogz b/docs/example_hook_cpiogz index dcd1416..f3e44d9 100644 --- a/docs/example_hook_cpiogz +++ b/docs/example_hook_cpiogz @@ -50,7 +50,7 @@ esac # corresponding 'linux-image' package? Can it declare that, in # the case where it's an add-on that the 'linux-image' is not # aware of? This might be an apt and dpkg issue. -# +# # * Eg. an optional usplash or suspend2ui_fbsplash package. # . /etc/default/mypackage-initramfs diff --git a/docs/example_script b/docs/example_script index 221c888..d7f407f 100644 --- a/docs/example_script +++ b/docs/example_script @@ -70,12 +70,12 @@ echo "Got here!" if [ -n "$an_error_occured" ]; then - # + # # TODO: Do we need 'warn()', 'error()', and/or 'fatal()' for this? # I think we ultimately do, and that they need to be in their own # well-documented location so that an overlay can override them. # Think 'usplash' progress updates. - # + # echo "An error occured in $0: $an_error_occured" >&2 exit 1 # diff --git a/hooks/lvm b/hooks/lvm index 98c0e0a..49a8887 100755 --- a/hooks/lvm +++ b/hooks/lvm @@ -23,5 +23,5 @@ fi copy_exec /lib/lvm-200/vgchange /sbin for x in dm_mod dm_snapshot dm_mirror; do - manual_add_modules ${x} + manual_add_modules ${x} done diff --git a/hooks/md b/hooks/md index becaba1..df2abc8 100755 --- a/hooks/md +++ b/hooks/md @@ -24,5 +24,5 @@ copy_exec /sbin/mdadm /sbin copy_exec /sbin/mdrun /sbin for x in md linear raid0 raid1 raid5 raid6 raid10; do - manual_add_modules ${x} + manual_add_modules ${x} done diff --git a/init b/init index f66281c..eb14326 100755 --- a/init +++ b/init @@ -18,7 +18,7 @@ fi mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev > /dev/.initramfs-tools mkdir /dev/.initramfs -mknod /dev/console c 5 1 +mknod /dev/console c 5 1 mknod /dev/null c 1 3 # Export the dpkg architecture diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 5d7c105..5712bdd 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -4,19 +4,19 @@ initramfs-tools \- an introduction to writing scripts for mkinitramfs .SH DESCRIPTION -initramfs-tools has one main script and two different sets of subscripts which +initramfs-tools has one main script and two different sets of subscripts which will be used during different phases of execution. Each of these will be discussed separately below with the help of an imaginary tool which performs a frobnication of a lvm partition prior to mounting the root partition. .SS Hook scripts -These are used when an initramfs image is created and not included in the +These are used when an initramfs image is created and not included in the image itself. They can however cause files to be included in the image. .SS Boot scripts -These are included in the initramfs image and normally executed during +These are included in the initramfs image and normally executed during kernel boot in the early user-space before the root partition has been -mounted. +mounted. initramfs-tools uses shell variable names for handling dependencies. Notice that `-' is not a valid shell variable name and thus should @@ -40,7 +40,7 @@ the device node to mount as the rootfs. .TP \fB \fI nfsroot can be either "auto" to try to get the relevant information from DHCP or a -string of the form NFSSERVER:NFSPATH +string of the form NFSSERVER:NFSPATH .TP \fB \fI boot @@ -79,7 +79,7 @@ Hooks can be found in two places: /usr/share/initramfs-tools/hooks and /etc/initramfs-tools/hooks. They are executed during generation of the initramfs-image and are responsible for including all the necessary components in the image itself. No guarantees are made as to the order in which the -different scripts are executed unless the prereqs are setup in the script. +different scripts are executed unless the prereqs are setup in the script. .SS Header In order to support prereqs, each script should begin with the following lines: @@ -113,7 +113,7 @@ the lvm hook script is run before your custom script. /usr/share/initramfs-tools/hook-functions contains a number of functions which deal with some common tasks in a hook script: .TP -\fB \fI +\fB \fI manual_add_modules adds a module (and any modules which it depends on) to the initramfs image. .RS @@ -389,7 +389,7 @@ if [ ! -e "/dev/mapper/frobb" ]; then panic "Frobnication device not found" fi -log_begin_msg "Starting frobnication" +log_begin_msg "Starting frobnication" /sbin/frobnicate "/dev/mapper/frobb" || panic "Frobnication failed" log_end_msg @@ -398,7 +398,7 @@ exit 0 .RE .SH DEBUG -It is easy to check the generated initramfs for its content. One may need +It is easy to check the generated initramfs for its content. One may need to double-check if it contains the relevant binaries, libs or modules: .RS .nf diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 2874fdb..afd799b 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -5,7 +5,7 @@ initramfs.conf \- configuration file for mkinitramfs .SH DESCRIPTION The behaviour of -.B mkinitramfs +.B mkinitramfs can be modified by its configuration file. Each line in the file can be a configuration variable, a blank line, @@ -35,7 +35,7 @@ The default setting is \fImost\fP. .SH NFS VARIABLES .TP \fB BOOT -Allows to use an nfs drive as the root of the drive. +Allows to use an nfs drive as the root of the drive. The default is to boot of an \fIlocal\fP media (harddrive, USB stick). Set to \fInfs\fP for an NFS root share. diff --git a/mkinitramfs b/mkinitramfs index 6c048df..81a859e 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -8,7 +8,7 @@ CONFDIR="/etc/initramfs-tools" verbose="n" errors_to="2>/dev/null" # BUSYBOXDIR="/usr/lib/initramfs-tools/bin/" -BUSYBOXDIR="/bin" +BUSYBOXDIR="/bin" OPTIONS=`getopt -o d:ko:r:v --long supported-host-version:,supported-target-version: -n "$0" -- "$@"` @@ -110,18 +110,18 @@ check_minkver ${version} ${CONFDIR}/hooks case "${version}" in /lib/modules/*/[!/]*) - ;; + ;; /lib/modules/[!/]*) - version="${version#/lib/modules/}" - version="${version%%/*}" - ;; + version="${version#/lib/modules/}" + version="${version%%/*}" + ;; esac case "${version}" in */*) - echo "$PROG: ${version} is not a valid kernel version" >&2 - exit 1 - ;; + echo "$PROG: ${version} is not a valid kernel version" >&2 + exit 1 + ;; esac if [ -d "${outfile}" ]; then @@ -157,7 +157,7 @@ export verbose export __TMPCPIOGZ for d in bin conf/conf.d etc lib modules sbin scripts; do - mkdir -p "${DESTDIR}/${d}" + mkdir -p "${DESTDIR}/${d}" done # MODULES=list case. Always honour. @@ -228,7 +228,7 @@ fi (cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip -9 >"${outfile}") || exit 1 if [ -s "${__TMPCPIOGZ}" ]; then - cat "${__TMPCPIOGZ}" >>"${outfile}" || exit 1 + cat "${__TMPCPIOGZ}" >>"${outfile}" || exit 1 fi if [ "${keep}" = "y" ]; then diff --git a/mkinitramfs-kpkg b/mkinitramfs-kpkg index 437b0ac..df3dc0c 100755 --- a/mkinitramfs-kpkg +++ b/mkinitramfs-kpkg @@ -79,20 +79,20 @@ version="${1}" case "${version}" in /lib/modules/*/[!/]*) - ;; + ;; /lib/modules/[!/]*) - version="${version#/lib/modules/}" - version="${version%%/*}" - ;; + version="${version#/lib/modules/}" + version="${version%%/*}" + ;; esac case "${version}" in */*) - echo "$PROG: ${version} is not a valid kernel version" >&2 - exit 1 - ;; + echo "$PROG: ${version} is not a valid kernel version" >&2 + exit 1 + ;; esac -# linux-image installs latest version +# linux-image installs latest version mkinitramfs -o ${outfile} ${version} sha1sum "${outfile}" | sed -e 's/\.new//' > "${STATEDIR}/${version}" diff --git a/mkinitramfs-kpkg.8 b/mkinitramfs-kpkg.8 index 0bdc1dc..871a0f4 100644 --- a/mkinitramfs-kpkg.8 +++ b/mkinitramfs-kpkg.8 @@ -5,8 +5,8 @@ mkinitramfs-kpkg \- generates an initramfs image for kernel-package .SH SYNOPSIS .B mkinitramfs -.RB [ \-o -.IR outfile ] +.RB [ \-o +.IR outfile ] .RI [ version ] .B mkinitramfs .RB [ \-\-supported-host-version= @@ -29,7 +29,7 @@ for an better alternative. .TP \fB \-o \fI outfile -Write the image to +Write the image to .IR outfile . .TP diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 5af552b..3dc2e2e 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -5,13 +5,13 @@ mkinitramfs \- generate an initramfs image .SH SYNOPSIS .B mkinitramfs -.RB [ \-d -.IR confdir ] -.RB [ \-k ] -.RB [ \-o -.IR outfile ] -.RB [ \-r -.IR root ] +.RB [ \-d +.IR confdir ] +.RB [ \-k ] +.RB [ \-o +.IR outfile ] +.RB [ \-r +.IR root ] .RI [ version ] .B mkinitramfs .RB [ \-\-supported-host-version= @@ -21,17 +21,17 @@ mkinitramfs \- generate an initramfs image .SH DESCRIPTION The -.B mkinitramfs +.B mkinitramfs script generates an initramfs image. The initramfs is a gzipped cpio archive. The archive can be used on a different box of the same arch with the corresponding Linux kernel. .B mkinitramfs -is meant for advanced usage. On your local box +is meant for advanced usage. On your local box .B update-initramfs should do all necessary steps. -At boot time, the kernel unpacks that archive into RAM disk, mounts and -uses it as initial root file system. All finding of the root device +At boot time, the kernel unpacks that archive into RAM disk, mounts and +uses it as initial root file system. All finding of the root device happens in this early userspace. .SH OPTIONS @@ -45,14 +45,14 @@ Keep the temporary directory used to make the image. .TP \fB \-o \fI outfile -Write the image to +Write the image to .IR outfile . .TP \fB \-r \fI root -Override the -.B ROOT -setting in +Override the +.B ROOT +setting in .IR initramfs.conf . .TP diff --git a/scripts/functions b/scripts/functions index c3a3e16..53e07ca 100644 --- a/scripts/functions +++ b/scripts/functions @@ -2,23 +2,23 @@ _log_msg() { - if [ "$quiet" = "y" ]; then return; fi - echo "$@" + if [ "$quiet" = "y" ]; then return; fi + echo "$@" } log_success_msg() { - _log_msg "Success: $@" + _log_msg "Success: $@" } log_failure_msg() { - _log_msg "Failure: $@" + _log_msg "Failure: $@" } log_warning_msg() { - _log_msg "Warning: $@" + _log_msg "Warning: $@" } log_begin_msg() @@ -190,7 +190,7 @@ load_modules() if [ -e /conf/modules ]; then cat /conf/modules | while read m; do # Skip empty lines - if [ -z "$m" ]; then + if [ -z "$m" ]; then continue fi # Skip comments - d?ash removes whitespace prefix diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper index 5a747ba..2d4c209 100755 --- a/scripts/local-top/udev_helper +++ b/scripts/local-top/udev_helper @@ -19,5 +19,5 @@ esac # but might be an old fashioned ISA controller; in which case # we need to load ide-generic. if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - modprobe -q ide-generic + modprobe -q ide-generic fi diff --git a/update-initramfs b/update-initramfs index 866609e..85a5dd2 100755 --- a/update-initramfs +++ b/update-initramfs @@ -189,7 +189,7 @@ create() if version_exists "${version}"; then panic "Cannot create version ${version}: already exists" fi - + if [ -e "${initramfs}" ]; then panic "${initramfs} already exists, cannot create." fi @@ -257,7 +257,7 @@ delete() if [ ! -e "${initramfs}" ]; then panic "Cannot delete ${initramfs}, doesn't exist." fi - + if ! version_exists "${version}"; then panic "Cannot delete version ${version}: Not created by this utility." fi @@ -291,7 +291,7 @@ takeover=0 while getopts "k:cudyvtb:h?" flag; do case "${flag}" in k) - version="${OPTARG}" + version="${OPTARG}" ;; c) mode="c" diff --git a/update-initramfs.8 b/update-initramfs.8 index 9590ca3..a36e83c 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -5,25 +5,25 @@ update-initramfs \- generate an initramfs image .SH SYNOPSIS .B update-initramfs -.RB [ \-k -.IR version ] -.RB [ \-c ] -.RB [ \-u ] -.RB [ \-t ] -.RB [ \-v ] -.RB [ \-b ] -.RB [ \-h ] +.RB [ \-k +.IR version ] +.RB [ \-c ] +.RB [ \-u ] +.RB [ \-t ] +.RB [ \-v ] +.RB [ \-b ] +.RB [ \-h ] .SH DESCRIPTION The -.B update-initramfs +.B update-initramfs script manages your initramfs images on your local box. It keeps track of the existing initramfs archives in /boot. There are three modes of operation create, update or delete. You must at least specify one of those modes. -The initramfs is a gzipped cpio archive. -At boot time, the kernel unpacks that archive into RAM disk, mounts and -uses it as initial root file system. All finding of the root device +The initramfs is a gzipped cpio archive. +At boot time, the kernel unpacks that archive into RAM disk, mounts and +uses it as initial root file system. All finding of the root device happens in this early userspace. .SH OPTIONS @@ -59,7 +59,7 @@ Set an different bootdir for the image creation. .TP \fB \-h -Print a short help page describing the available options in +Print a short help page describing the available options in .B update-initramfs. .SH AUTHOR -- cgit v1.2.3 From 034308f306b2cb3bffeb5811aca2636405d29dd4 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 5 Apr 2010 05:14:34 +0200 Subject: modernize docs to todays standards seems nobody had a look since longer, nuke useless cpiogz for now, we may want resurrect that later. Signed-off-by: maximilian attems --- debian/initramfs-tools.examples | 1 - docs/example_hook | 56 +++------------------------ docs/example_hook_cpiogz | 84 ----------------------------------------- docs/example_script | 63 ++----------------------------- 4 files changed, 9 insertions(+), 195 deletions(-) delete mode 100644 docs/example_hook_cpiogz (limited to 'docs/example_script') diff --git a/debian/initramfs-tools.examples b/debian/initramfs-tools.examples index 9f67297..9466301 100644 --- a/debian/initramfs-tools.examples +++ b/debian/initramfs-tools.examples @@ -1,4 +1,3 @@ conf/modules docs/example_script docs/example_hook -docs/example_hook_cpiogz diff --git a/docs/example_hook b/docs/example_hook index a0d015a..683ddad 100644 --- a/docs/example_hook +++ b/docs/example_hook @@ -1,5 +1,5 @@ #!/bin/sh - +# # # This is an example hook script. It will be run by 'mkinitramfs' # when it creates the image. It's job is to decide which files to @@ -8,39 +8,12 @@ # package is installed, or when the administrator runs 'mkinitramfs' # by hand to update an initramfs image. # -# TODO: What about the case where you install something that should be -# added to the initramfs, but the linux-image it relates to has -# already been installed previously? Does this happen often -# enough that it needs to be handled? How can it be handled? -# -# * Think about the 'usplash'. The initramfs will need to be -# updated if a theme change or update is desired. Maybe it -# should not be totally automatic, but offered on upgrade -# predicated on a user response to a debconf question? That -# issue needs to be explored and a solution specified. -# -# * Do not assume that any needed subdirectories have been created -# yet, but don't bail out if they are already there. -# -# * All of the standard system tools are available, of course, since -# this hook is running in the real system, not the initramfs. -# -# * TODO: ... ? Anything else to tell them in this bullet-list? -# - -# -# The environment contains at least: -# -# CONFDIR -- usually /etc/mkinitramfs, can be set on mkinitramfs +# CONFDIR -- usually /etc/initramfs-tools, can be set on mkinitramfs # command line. # # DESTDIR -- The staging directory where we are building the image. -# -# TODO: Decide what environment variables are meaningful and defined -# in this context, then document them as part of the interface. -# -# TODO: May need a version_compare function for comparison of VERSION? - +# +# see initramfs-tools(8) # # List the soft prerequisites here. This is a space separated list of @@ -80,7 +53,7 @@ esac # course may be other reasons to have custom logic deciding what to # install. The version variable may be useful for this. # -if [ -x /usr/bin/myprog ]; then +if command -v myprog >/dev/null 2>&1; then copy_exec /usr/bin/myprog usr/bin fi @@ -92,23 +65,4 @@ fi # ... and it should do what is necessary to have 'myprog' get run # inside the early runtime environment. -# Handle an error: -# -if [ -n "$an_error_occured" ]; -then - # - # TODO: Do we need 'warn()', 'error()', and/or 'fatal()' for this? - # - echo "An error occured in $0: $an_error_occured" >&2 - exit 1 - # - # TODO: Decide if different error codes are meaningful, what they - # mean, and what the semantics of them are wrt 'mkinitramfs' - # pass or fail. Consider naming the error values with - # mnemonic symbols rather than magic numbers. They may or - # may not be the same set of errors as the set for - # in-initramfs scripts. - # -fi - exit 0 diff --git a/docs/example_hook_cpiogz b/docs/example_hook_cpiogz deleted file mode 100644 index f3e44d9..0000000 --- a/docs/example_hook_cpiogz +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh - -# -# The environment contains at least: -# -# CONFDIR -- usually /etc/mkinitramfs, can be set on mkinitramfs -# command line. -# -# DESTDIR -- The staging directory where we are building the image. -# -# TODO: Decide what environment variables are meaningful and defined -# in this context, then document them as part of the interface. -# -# TODO: Write a common header for these examples or move this -# documentation to a man page and reference it here. :-) -# - -# -# List the soft prerequisites here. This is a space separated list of -# names, of scripts that are in the same directory as this one, that -# must be run before this one can be. -# -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# -# Source the 'hook-functions' scriptlet (for 'catenate_cpiogz'): -# -. /usr/share/initramfs-tools/hook-functions - -# -# Lets pretend it has a conffile (think debconf), and we source it -# here. Don't make debconf lookup calls here. The postinst for the -# package owning this hook script should have done that and configured -# the "/etc/default/conffile" already. -# -# TODO: How does the package ensure that it's installed BEFORE the -# corresponding 'linux-image' package? Can it declare that, in -# the case where it's an add-on that the 'linux-image' is not -# aware of? This might be an apt and dpkg issue. -# -# * Eg. an optional usplash or suspend2ui_fbsplash package. -# -. /etc/default/mypackage-initramfs - -# -# Also pretend that we only include our initramfs overlay if an opion -# is not "no", and the 'linux-image' package we are generating this -# initramfs for matches the version this script's package is designed -# for. Just for example; pretend this example mkinitramfs hook script -# is part of a 'linux-image' or 'xxx-modules' package. -# -if [ "$MYOPTION" != "no" -a "$version" = "2.6.12+ss2.1.9.1" ]; then - catenate_cpiogz /usr/lib/mypackage/initramfs.cpio.gz -fi - -# -# In this case, there does not have to be an (eg.): -# -# "/etc/mkinitramfs/init-top/mypackage" -# -# ... since that script is probably inside of the initramfs overlay -# already. If it's a conffile though, it does not belong in there, -# and should be placed in the appropriate location inside of -# "/etc/mkinitramfs". Remember that if it needs access to the -# settings in our "/etc/default/mypackage-initramfs", then that file -# must also get copied into a location inside of ${DESTDIR} by this -# hook script in order to make it available inside of the initramfs -# environment. -# - -exit 0 diff --git a/docs/example_script b/docs/example_script index d7f407f..5e9153b 100644 --- a/docs/example_script +++ b/docs/example_script @@ -2,45 +2,11 @@ # # This script is run inside of the initramfs environment during the -# system boot process. It is installed there by 'mkinitramfs'. The -# package that owns it may opt to install it in either an appropriate -# location under "/usr/share/initramfs-tools/scripts/", or a similar -# location under "/etc/mkinitramfs/scripts/", depending upon whether -# it should be considered to be a user modifiable conffile or not. -# -# TODO: How do we deal with the case where the package that installed -# this has been removed but not purged, if we always arbitrarily -# copy all of these scripts into the initramfs? -# -# * The available toolset is limited inside this environment... -# -# TODO: document that toolset in the man page. -# -# * /dev, /proc, and /sys are already mounted. / is a ?? ro/rw -# filesystem... etc. more documentation. -# -# * It is expected that /proc and /sys will be umounted before -# changing over to the real root file system, so you must not keep -# any files open on them beyond these scripts. -# -# * You may like to strip these documentation comments from this -# example if you take it for a template, to save a little space in -# the initramfs, since nobody will ever read it from inside of -# there anyhow. -# - -# -# The environment contains at least the following variables: -# -# TODO: Decide what environment variables are meaningful and defined -# in this context, then document them as part of the interface. -# -# Because this script will be run as a full separate process, rather -# than sourced inside the context of the driver script, if it needs to -# pass information to another script that may run after it, it must do -# so by writing data to a file location known to both scripts. Simply -# setting an environment variable will not work. +# system boot process. It is installed there by 'update-initramfs'. +# The # package that owns it may opt to install it in an appropriate +# location under "/usr/share/initramfs-tools/scripts/". # +# see initramfs-tools(8) for more details. # # List the soft prerequisites here. This is a space separated list of @@ -66,25 +32,4 @@ esac echo "Got here!" -# Handle an error: - -if [ -n "$an_error_occured" ]; -then - # - # TODO: Do we need 'warn()', 'error()', and/or 'fatal()' for this? - # I think we ultimately do, and that they need to be in their own - # well-documented location so that an overlay can override them. - # Think 'usplash' progress updates. - # - echo "An error occured in $0: $an_error_occured" >&2 - exit 1 - # - # TODO: Decide if different error codes are meaningful, what they - # mean, and what the semantics of them are wrt 'init' pass - # or panic. Consider naming the error values with mnemonic - # symbols rather than magic numbers. - # -fi - exit 0 - -- cgit v1.2.3