#!/bin/sh
# created January 03, 2005
# create and mount an encrypted file system on loop back device loop0
# will not mount the c: drive
#
/sbin/modprobe blowfish
/sbin/modprobe cryptoloop
# size in k for new device
# 5000000=5Gig
SIZE=5000000
# where to mount
MPOINT="/home/user/mount"
df | grep loop0
if [ "$?" = "0" ]
then
echo loop0 is in use
exit
fi
if [ ! -f file.crypt ]
then
echo file.crypt not found. creating...
# this can take a few minutes if a multi gig file is being created
dd if=/dev/zero of=file.crypt bs=1024 count=$SIZE
NEW=1
fi
/sbin/losetup -e blowfish /dev/loop0 ./file.crypt
if [ "$?" = "1" ]
then
echo "loopback setup failed"
exit
fi
if [ "$NEW" = "1" ]
then
echo new filesystem. formating device to ${SIZE}k.
/sbin/mkfs -t ext2 /dev/loop0 $SIZE
fi
mount /dev/loop0 $MPOINT
echo
echo mount information:
df -h | grep $MPOINT
echo