summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-09-27 15:58:30 +0200
committerDave Reisner <dreisner@archlinux.org>2012-09-30 00:06:09 +0200
commit887511601787db60b5692802fc2ccdfd47c0d698 (patch)
tree485eac988fd91a9ea672b204b294b434dbade965
parente6d2bfd161c61dccefc94df7594e4410e1cc37e9 (diff)
downloadmkinitcpio-887511601787db60b5692802fc2ccdfd47c0d698.tar.gz
mkinitcpio-887511601787db60b5692802fc2ccdfd47c0d698.tar.xz
lsinitcpio: add -c, --config option to dump config
Now that mkinitcpio stores the build time config file in the image, we should have a way of easily getting it back out. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--bash-completion2
-rwxr-xr-xlsinitcpio12
-rw-r--r--lsinitcpio.1.txt3
3 files changed, 13 insertions, 4 deletions
diff --git a/bash-completion b/bash-completion
index e56cd6c..4e548af 100644
--- a/bash-completion
+++ b/bash-completion
@@ -3,7 +3,7 @@
_lsinitcpio() {
local cur opts
- opts=(-a --analyze -h --help -n --nocolor -v --verbose -x --extract)
+ opts=(-a --analyze -c --config -h --help -n --nocolor -v --verbose -x --extract)
_get_comp_words_by_ref cur
diff --git a/lsinitcpio b/lsinitcpio
index 46ea9f0..1d4a343 100755
--- a/lsinitcpio
+++ b/lsinitcpio
@@ -17,7 +17,8 @@ lsinitcpio %VERSION%
usage: ${0##*/} [options] <initramfs>
Options:
- -a, --analyze analyze contents
+ -a, --analyze analyze contents of image
+ -c, --config show configuration file image was built with
-h, --help display this help
-n, --nocolor disable colorized output
-v, --verbose more verbose output
@@ -162,8 +163,8 @@ analyze_image() {
fi
}
-OPT_SHORT='ahnvx'
-OPT_LONG=('analyze' 'help' 'nocolor' 'verbose' 'extract')
+OPT_SHORT='achnvx'
+OPT_LONG=('analyze' 'help' 'nocolor' 'showconfig' 'verbose' 'extract')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1
@@ -175,6 +176,8 @@ while :; do
case $1 in
-a|--analyze)
analyze=1 ;;
+ -c|--config)
+ showconfig=1 ;;
-h|--help)
usage
exit 0 ;;
@@ -227,6 +230,9 @@ esac
if (( analyze )); then
analyze_image "$image"
+elif (( showconfig )); then
+ decomp "$1" | bsdtar xOf - buildconfig 2>/dev/null ||
+ die 'Failed to extract config from image (mkinitcpio too old?)'
else
decomp "$image" | bsdcpio -i --quiet $verbose $list
fi
diff --git a/lsinitcpio.1.txt b/lsinitcpio.1.txt
index 7a152ab..63b5566 100644
--- a/lsinitcpio.1.txt
+++ b/lsinitcpio.1.txt
@@ -23,6 +23,9 @@ Options
Analyze the contents of the specified image and print output in human
readable form.
+*-c, \--config*::
+ Show the configuration file the given image was built with.
+
*-h, \--help*::
Output a short overview of available command-line switches.