/etc/rc.mfs

#!/bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin

if ! mount /proc; then
        echo 'Mounting of /proc filesystem failed!'
        exit 1
fi

if ! mount /mfs; then
        echo 'Mounting of /mfs filesystem failed!'
        exit 1
fi

mkdir   /mfs/home       \
        /mfs/dev        \
        /mfs/var        \
        /mfs/var/db     \
        /mfs/var/mail   \
        /mfs/var/run    \
        /mfs/tmp        \
        /mfs/tmp/vi.recover

chmod 1777 /mfs/tmp /mfs/tmp/vi.recover
chmod 775 /mfs/var/mail
chgrp mail /mfs/var/mail

(
        cd /mfs/var
        tar xpzf /var/log-skel.tar.gz
        tar xpzf /var/spool-skel.tar.gz
)

(
        cd /mfs/dev
        tar xpzf /var/dev-tty.tar.gz
)

awk -F: '($6 ~ "/home/"){print $1,$4}' /etc/passwd \
| while read LUSER LGROUP; do
        if [ -f /usr/home-skel/${LUSER}.tar.gz ]; then
                (
                        cd /mfs/home
                        tar xpzf /usr/home-skel/${LUSER}.tar.gz
                )
        else
                mkdir /mfs/home/$LUSER
                chown $LUSER:$LGROUP /mfs/home/$LUSER
        fi
done

#--