diff options
Diffstat (limited to 'docs/example_hook')
-rw-r--r-- | docs/example_hook | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/docs/example_hook b/docs/example_hook index a0d015a..1f35352 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 |