#!/bin/sh
# ver. .2
# Script to unpack floppy image woafnew.img into a kernel and directory tree.
# After modification use makewoaf.sh (requires files Config and makeimage) to
#   recreate your own floppy or initrd for use with loadlin.exe.

# unpack the 2.2.25 kernel
dd if=woafnew.img of=bzImage bs=1k skip=0 count=395

# unpack the ramdisk image
dd if=woafnew.img skip=395 of=Image.gz bs=1k

# uncompress the rdisk image
gunzip < Image.gz > image

# mount the image on the loop device
MOUNTP='mnt'
if [ ! -d "$MOUNTP" ]; then
  mkdir mnt
fi
mount -o loop image mnt

# kill any old reference tree
rm -rf woaf-ref

# create new reference tree
echo "Creating woaf directory reference tree."
mkdir woaf-ref

# copy the image to the reference tree and display the root dir.
cd woaf-ref;cp -af ../mnt/* .

# unmount and clean up intermediate files.
cd -;umount mnt
rm -f image
echo $(pwd)/woaf-ref:
ls -al woaf-ref
echo
echo $(pwd):
ls -al
