diff options
author | Thomas Bächler <thomas@archlinux.org> | 2013-11-19 23:10:26 +0100 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2013-11-24 00:50:50 +0100 |
commit | 1bf318f11d42522973633aa1c837693476c3a9e0 (patch) | |
tree | ec6e4808fb3d09373941e7a129956ac46f65f4ec /mkinitcpio | |
parent | 95b2c16f44f02ac264686651cf1aa207c65cb93a (diff) | |
download | mkinitcpio-1bf318f11d42522973633aa1c837693476c3a9e0.tar.gz mkinitcpio-1bf318f11d42522973633aa1c837693476c3a9e0.tar.xz |
mkinitcpio: add -d option
The -d (--generatedir) option writes the root of the generated image
directly to the specified directory.
Useful for generating a shutdown-ramfs with mkinitcpio -d /run/initramfs/.
Diffstat (limited to 'mkinitcpio')
-rwxr-xr-x | mkinitcpio | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -19,7 +19,7 @@ _d_presets=mkinitcpio.d # options and runtime data _optmoduleroot= _optkver= _optgenimg= -_optcompress= +_optcompress= _opttargetdir= _optshowautomods=0 _optsavetree=0 _optshowmods=0 _optquiet=1 _optcolor=1 _optskiphooks=() _optaddhooks=() _hooks=() _optpreset=() @@ -53,6 +53,7 @@ usage: ${0##*/} [options] -r, --moduleroot <dir> Root directory for modules (default: /) -S, --skiphooks <hooks> Skip specified hooks, comma-separated, during build -s, --save Save build directory. (default: no) + -d, --generatedir <dir> Write generated image into <dir> -t, --builddir <dir> Use DIR as the temporary build directory -V, --version Display version information and exit -v, --verbose Verbose output (default: no) @@ -298,10 +299,10 @@ process_preset() ( trap 'cleanup 130' INT trap 'cleanup 143' TERM -_opt_short='A:c:g:H:hk:nLMPp:r:S:st:Vvz:' +_opt_short='A:c:g:H:hk:nLMPp:r:S:sd:t:Vvz:' _opt_long=('add:' 'addhooks:' 'config:' 'generate:' 'hookhelp:' 'help' 'kernel:' 'listhooks' 'automods' 'moduleroot:' 'nocolor' 'allpresets' - 'preset:' 'skiphooks:' 'save' 'builddir:' 'version' 'verbose' 'compress:') + 'preset:' 'skiphooks:' 'save' 'generatedir:' 'builddir:' 'version' 'verbose' 'compress:') parseopts "$_opt_short" "${_opt_long[@]}" -- "$@" || exit 1 set -- "${OPTRET[@]}" @@ -327,6 +328,10 @@ while :; do -s|--save) _optsavetree=1 ;; + -d|--generatedir) + shift + _opttargetdir=$1 + ;; -g|--generate) shift [[ -d $1 ]] && die "Invalid image path -- must not be a directory" @@ -414,8 +419,8 @@ KERNELVERSION=$(resolve_kernver "$_optkver") || cleanup 1 _d_kmoduledir=$_optmoduleroot/lib/modules/$KERNELVERSION [[ -d $_d_kmoduledir ]] || die "'$_d_kmoduledir' is not a valid kernel module directory" -_d_workdir=$(initialize_buildroot "$KERNELVERSION") || cleanup 1 -BUILDROOT=$_d_workdir/root +_d_workdir=$(initialize_buildroot "$KERNELVERSION" $_opttargetdir) || cleanup 1 +BUILDROOT=${_opttargetdir:-$_d_workdir/root} . "$_f_config" || die "Failed to read configuration \`%s'" "$_f_config" |