From 9d65344fba27ab87f019fa9071fcea0985c190f7 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 22 Dec 2012 13:09:10 -0500 Subject: lsinitcpio: abort on unknown file formats Specficially, abort when a user tries to run lsinitcpio on a kernel image. Signed-off-by: Dave Reisner --- lsinitcpio | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lsinitcpio') diff --git a/lsinitcpio b/lsinitcpio index f594fdc..7bbcb52 100755 --- a/lsinitcpio +++ b/lsinitcpio @@ -241,11 +241,16 @@ esac # read compression type case $(file -Lb "$_image") in - @(data|LZMA)*) _compress=lzma ;; + 'Linux kernel'*) + die '%s is a kernel image, not an initramfs image!' "$_image" ;; + data*|LZMA*) _compress=lzma ;; gzip*) _compress=gzip ;; bzip2*) _compress=bzip2 ;; lzop*) _compress=lzop ;; XZ*) _compress=xz ;; + 'ASCII cpio'*) : ;; + *) + die 'Unexpected file type. Are you sure this is an initramfs?' "$_image" ;; esac if (( _optanalyze )); then -- cgit v1.2.3-24-g4f1b