summaryrefslogtreecommitdiffstats
path: root/lsinitcpio
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 /lsinitcpio
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>
Diffstat (limited to 'lsinitcpio')
-rwxr-xr-xlsinitcpio12
1 files changed, 9 insertions, 3 deletions
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