summaryrefslogtreecommitdiffstats
path: root/lsinitcpio
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-12-22 19:09:10 +0100
committerDave Reisner <dreisner@archlinux.org>2013-01-12 20:31:29 +0100
commit9d65344fba27ab87f019fa9071fcea0985c190f7 (patch)
tree554790f8375d60d8906c8c22a64b0320dd721313 /lsinitcpio
parent3e18e3d923f0353ceb9a407b63f16222d609b5ee (diff)
downloadmkinitcpio-9d65344fba27ab87f019fa9071fcea0985c190f7.tar.gz
mkinitcpio-9d65344fba27ab87f019fa9071fcea0985c190f7.tar.xz
lsinitcpio: abort on unknown file formats
Specficially, abort when a user tries to run lsinitcpio on a kernel image. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'lsinitcpio')
-rwxr-xr-xlsinitcpio7
1 files changed, 6 insertions, 1 deletions
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