#/bin/bash

echo Making /tmp/disk directory.

if [ -e /tmp/disk ]; then
 echo "Error: /tmp/disk already exists."
 echo "Move or delete it (rm -rf /tmp/disk) and run this script again."
 exit 1
fi

rm -rf /tmp/disk
mkdir /tmp/disk
echo 

echo Copying some auxilliary and documentation files to /tmp/disk/
cp fordisk/* /tmp/disk
cp auxlist [A-Z]* /tmp/disk

echo
echo Packing /bin/bash to /tmp/disk/bash.gz
gzip -c /bin/bash >/tmp/disk/bash.gz

echo
./maketb

echo
./makeaux

echo
./makelibs
echo

echo "Packing random useful stuff:"

echo " Putting partition information in /tmp/disk/fdisk.list."
fdisk -l >/tmp/disk/fdisk.list

echo " Putting a copy of /etc/fstab in /tmp/disk/fstab.list."
cp /etc/fstab /tmp/disk/fstab.list

echo " Packing vi and more in /tmp/disk/vi_more.tgz..."
unalias -a
tar zchf /tmp/disk/vi_more.tgz `type -p vi` `type -p more`

echo
echo "Done."
echo
echo "Note: you should run the \"./checklibs\" script to check if the"
echo "rescue disk was created correctly. See the CREATE file."

