#!/usr/bin/env bash # # Take mfsroot.gz from images dir, mount it on mfsdir, # cp -R the stuff from the eyes/eye/... onto the mounted fs, # umount and zip, mount a floppy on flp, and overwrite its mfsroot.gz file. # umount. # sundir="/home/sunpendulum" mfsdir="${sundir}/mfs" flpdir="${sundir}/flp" imgdir="${sundir}/images" eye=$1 prompt=$2 if [ x$USER != xroot ] then echo "be root" exit fi eyedir=${sundir}/eyes/${eye} if [ x${eye} = "x" ] then echo "floppy eyename [prompt]" exit 1 fi function pr { if [ x${prompt} != "x" ] then echo $1 read fi } function sset { if [ x${prompt} != "x" ] then set $1 fi } function abort { echo "$_ failed .. it is senseless to continue - exiting." exit } # create a mounted mfsroot on ${mfsdir} # ------------------------------------- echo -n "creating a mounted mfsroot on ${mfsdir} ... " cd ${imgdir} || abort sset -x [ -f mfsroot.gz ] && gunzip mfsroot.gz md=`mdconfig -a -t vnode -f mfsroot` || abort mount /dev/${md}c ${mfsdir} || abort sset +x echo "Done" pr "Mfsroot is unzipped an mounted, next comes file copy" # populate with individual files # ------------------------------ echo -n "populating with individual files ... " # this is for the harddisk sset -x cp -R -p -f ${eyedir}/fs/* ${mfsdir}/sun/ || abort # this is for the mfsroot fs cp -R -p -f ${eyedir}/cf/* ${mfsdir}/ || abort echo "Done" sset +x pr "Files are copied, next comes unmount and gzip" # umount mfsroot # -------------- echo -n "umount mfsroot ... " sset -x umount -f ${mfsdir} || abort mdconfig -d -u ${md} || abort gzip -9 mfsroot || abort sset +x echo "Done" pr "Unmount an zipping Done, next comes copy to floppy" # copy to floppy # -------------- echo -n "copy to floppy ... " sset -x md=`mdconfig -a -t vnode -f mfsroot.flp` || abort mount /dev/${md}c ${flpdir} || abort cp mfsroot.gz ${flpdir}/ || abort umount ${flpdir} || abort mdconfig -d -u ${md} || abort cp mfsroot.flp ${eyedir}/flp/ || abort sset +x echo "Done" ls -l ${eyedir}/flp/ || abort echo pr "Floppy Image Done, next comes atesi.zip" # create atesi email attachment # ----------------------------- echo -n "creating atesi email attachment ... " cd ${eyedir} || abort dir=`basename ${eyedir}` echo $dir [ -d atesi ] || mkdir atesi rm -rf atesi/* sset -x ln ../../dostools/fdimage.exe atesi/ || abort ln ../../kern.flp atesi/ || abort ln flp/mfsroot.flp atesi/ || abort atesi="atesi-${dir}.zip" rm -rf $atesi zip -9r $atesi atesi/ || abort sset +x echo "Done"