diff --git a/pack-initrd b/pack-initrd index adda676..0c5f33a 100755 --- a/pack-initrd +++ b/pack-initrd @@ -4,5 +4,15 @@ initrd=${1:-initrd.img} ramdisk=${2:-ramdisk} +if [ ! -d $ramdisk ]; then + echo "$ramdisk does not exist." + exit 1 +fi + +if [ -f $initrd ]; then + echo "$initrd already exist." + exit 1 +fi + ( cd $ramdisk; find | sort | cpio --quiet -o -H newc ) | gzip > $initrd diff --git a/unpack-initrd b/unpack-initrd index 6530f12..987239c 100755 --- a/unpack-initrd +++ b/unpack-initrd @@ -4,6 +4,11 @@ initrd=${1:-initrd.img} ramdisk=${2:-ramdisk} +if [ ! -f $initrd ]; then + echo "$initrd does not exist." + exit 1 +fi + if [ -d $ramdisk ]; then echo "$ramdisk already exists." exit 1