On Die, 02 Jan 2001, you wrote:
dd
>       I have just received the latest Toms digest with your CD rom 
>script. Unfortunately my mail reader is unable to decode it from the 
>centre of the digest:(
>       Would you be kind enough to send me a copy separately as it 
>is something I would like to try with my Win98 CD writer?
>       I really love Toms little disk it has been so useful for 
>both Win & Lin boxes when things go wrong. I've also learnt so much 
>about scripting in general just de constructing his various scripts 
>& rebuilding new versions.
>
>       Anyway, many thanks in advance and Happy New Year
>       

I have now applayed a delay for slow scsi devices (aha2940) which never mounted
the cd with /etc/mountcd

-------snip-------
#!2/bin/ash
ST=1/settings.s
.. $ST
CK=`du -k $ST`
umount $RD $FD $MP 2>$NU
mkdir $MP

mv 2/usr/bin/umount 2/bin 2>$NU
mv 2/usr/bin/insmod 2/bin 2>$NU
mv 2/usr/lib/modules/scsi 2/lib 2>$NU
#ln -s /lib/scsi 2/usr/lib/modules/scsi 2>$NU

if [ ~`hostname` = ~6M ];then;NM=tomsrtbt;else;NM=`hostname`-tomsrtbt;fi
PL=`awk 'BEGIN{print '"$PL"'+1}'`
BLD=$NM-$VE.$PL
echo -e "NM=$NM\\nPL=$PL">ST
mkfs.minix $RD>$NU
mount $RD $MP
cp -a 1 2 $MP
cd $MP
export POSIXLY_CORRECT=YES
awk '
        BEGIN{
        "du -k -s 2"|getline T
        "du -k -s 2/usr"|getline UZ
        RZ=int(1.06*(T-UZ))
        UZ=int(1.05*UZ)
        "ls -Rid `find 2`|cut -c 1-7|sort -nu|wc -l"|getline T
        "ls -Rid `find 2/usr`|cut -c 1-7|sort -nu|wc -l"|getline UI
        RI=int(1.125*(T-UI))
        UI=int(1.125*UI)
        "du 1|cut -f1"|getline T
        Z1=T+10
        OA=int((Z1+1)/2)
        print "RZ=" RZ
        print "RI=" RI
        print "UZ=" UZ 
        print "UI=" UI
        print "Z1=" Z1
        print "OA=" OA
        }'>>$ID/ST
cd $ID
.. ST
umount $MP
sed -e "/mount -o ro /c mount -o ro $FD /fl"<2/etc/rc.M>new
cp new 2/etc/rc.M
dd -q if=/dev/zero of=$RD bs=1k count=$RZ
mkfs.minix -i $RI $RD $RZ>$NU
mount $RD $MP
cd 2

cat >etc/rc.0 <<!!
#!/bin/sh
PATH=/usr/bin:/bin
case "\$0" in
 *6)
  cmd=reboot
  ;;
 *)
  cmd=halt
  ;;
esac
if [ "\$1" != "fast" ]
then
 killall5 -15
 sleep 3
 killall5 -9
fi
\$cmd -w
cd /usr
umount -a -tnfs &
sleep 1
umount -a -tnonfs 2>/dev/null
echo \$cmd
sleep 1
\$cmd -f
!!
cat >etc/mountcd <<!!
sleep1()
{       
IFS=" ."
read a b</proc/uptime
b=\$a
while [ \$a -eq \$b ]
do read b c</proc/uptime
done
}       
sleep1  
while [ 1 ]
do
for i in /dev/hdc /dev/hdd /dev/hdb /dev/scd0 /dev/scd1 
do
sleep1
if [ \$i = /dev/scd0 ] 
then for x in Now lets wait for some extra slow scsi devices
do echo -n "\$x "
sleep1
done
echo
fi
mount -t iso9660 -o ro \$i \$1 2>/dev/null
echo \$i
if [ -f \$1/tomsrtbt/settings.s ] ; then
echo cd found in \$i
exit
fi
umount \$1 2>/dev/null
done
echo -n "try again (y/n) "
read x
if [ x\$x = "xn" ] 
then break
fi 
done
echo no cd found , mount the cd to \$1 and type exit
ash
!!
cat >etc/rc.M <<!!
#!/bin/sh
BT=1
PATH=/usr/bin:/bin
for X in /lib/scsi/*; do insmod \$X; done
#mount -o ro /dev/fd0u1722 /fl
/etc/mountcd /fl
.. /fl/tomsrtbt/settings.s
mkfs.minix /dev/ram1 \$UZ
echo /usr loading...
mount /dev/ram1 /usr
dd if=/fl/tomsrtbt/usr.cpio.bz2 |bzip2 -ds|cpio -iumd||FAIL CORRUPTED?
update &
cp /fl/tomsrtbt/rc.* /fl/tomsrtbt/*.s /usr/doc
gzip -d /usr/doc/*.gz
.. /usr/doc/rc.custom
umount /fl
!!
chmod u+x etc/mountcd etc/rc.*
find . -path ./usr -prune -o -print|cpio -umpdB $MP 2>$NU
mkdir $MP/usr
umount $MP
echo gzipping...
dd -q if=$RD bs=1k count=$RZ|gzip -9 -n>$ID/root.raw.gz
echo bzip2ing...
find usr -depth|cpio -oB 2>$NU|bzip2 -$BZ>$ID/usr.cpio.bz2
cd ..
awk -v DZ=$DZ -v OA=$OA '
        BEGIN{
        "filesize root.raw.gz"|getline T
        Z2=int((T+511)/512)
        O2=(2*OA+Z2)
        "filesize usr.cpio.bz2"|getline T
        Z3=int((T+511)/512)
        FR=(DZ-O2-Z3)
        FR=(2880-O2)
        O1=OA+(int(FR/2))
        O2=O2+(2*int(FR/2))
        print "O1=" O1
        print "O2=" O2
        print "Z2=" Z2
        print "Z3=" Z3
        print "FR=" FR
        }'>>ST
.. ST
echo -e "$FR sectors free!"
if [ $FR -ge 0 ];then
 cat>>ST<<'!'
dd>$NU 2>&1 <<'(15 seconds...)'


!
echo Welcome to $NM-$VE.$PL>>ST
 sed -e "/NM=/,/Welcome/d"<$ST>new
 sed -e "/#AUTO#/r ST"<new>$ST
 [ "$CK" = "`du -k $ST`" ]||FAIL settings.s grew, run build again
 mkdir $BLD
 cp -af $ID/2/usr/doc/* $BLD
 cp $ST $BLD
 cp 2/usr/bin/fdformat 2/usr/bin/fdflush $BLD
 dd -q if=/dev/zero of=$RD bs=1k count=2880
 mkfs.minix -i 16 $RD 2880>$NU
 mount $RD $MP
 cp root.raw.gz $MP
 cp -af 1/* $MP
 umount $MP
# dd -q if=root.raw.gz of=$RD bs=1k seek=$O1
# dd -q if=usr.cpio.bz2 of=$RD seek=$O2
 mount $RD $MP
 rm $MP/map
 lilo -C -<<-!
        boot=$RD
        disk=$RD
        bios=0x00
        sectors=18
        heads=2
        cylinders=80
        install=$MP/boot.b
        message=$MP/settings.s
        backup=/dev/null
        map=$MP/map
        timeout=150
        read-write
        vga=ask
        prompt
        image=$MP/zImage
        root=/dev/ram0
        initrd=$MP/root.raw.gz
!
 cp $MP/map 1
 umount $MP
 dd -q if=$RD of=$BLD/tomsrtbt.raw count=2880
tar -cf - $BLD|gzip -9>$BLD.tar.gz
 echo Build done, \"cd $BLD\" to install it.
 echo tomsrtbt.raw is the bootimage
 echo cp tomsrtbt.raw settings.s rc.config.gz usr.cpio.gz in a dir named tomsrtbt  
else
 echo Cannot build, $FR sectors free!
fi
cp 1/settings.s 1/rc.* $BLD
cp usr.cpio.bz2 $BLD 
rm -f -r usr.cpio.bz2 boot.raw root.raw.gz ST new $MP
--------snip----------

>                         
>                                   regards davidh.
--
MFG G.Fink

Reply via email to