#
# undead.sh	Mount and load up the /wraith directory for use
#
# Version:	0.3  01-Feb-2005  
#

# If this has already been run then don't run it again.
# We can't handle two wraiths!
[ -f /wraith/live ] && exit 0

# Create writable space
mount -n -t tmpfs tmpfs /wraith

# Create the directory structure
cd /wraith
gzip -dc /wraith.cpio.gz | cpio -idum
cd /

# Perform the cross mounts with bind
# which is like a directory hard link.
cd /wraith
for i in *
do
	mkdir $i.ro
	# We use mount with the -n
	# To avoid confusing the mtab
	mount -n --bind /$i /wraith/$i.ro
	mount -n --bind /wraith/$i /$i
done
cd /

touch /wraith/live

: exit 
