From: Tim Russell (trussell@cwis.unomaha.edu)
Date: 09/08/92


From: trussell@cwis.unomaha.edu (Tim Russell)
Subject: Re: SLS package installation
Date: Tue, 8 Sep 1992 08:07:45 GMT

bugs@cs.montana.edu (Dave Seelmeyer) writes:

>their job, and all is ok so far. The problem is when I want to do a full
>installation (full base and X11). I have tried sysinstall -all and also
>doinstall /dev/hda2. With the first, it asks to insert disk #3 in the
>floppy drive and press return. Upon doing this, it repeats the message.
>It will do this 3 times and return to the prompt. With the second, it
>starts with the same disk #3 message and then responds with "magic match
>failed" or somesuch and comes back to the prompt.

    Peter doesn't want to admit it, but apparently even his own kernel
didn't get his patches right. According to him, his kernel is supposed
to be patched so it automatically figures out what kind of a filesystem
it's mounting, but it doesn't work.

    Here's a fixed version of sysinstall that you can use.

# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# sysinstall
# This archive created: Tue Sep 8 03:10:08 1992
cat << \SHAR_EOF > sysinstall
#
# Installation of packages from floppy
# requires: tar, sed, basename, compress/zcat, mount and umount.
# copywrite Softlanding Software, 1992: Distribute and use freely.

# Er, 'copyright', that is. :-) Modified by Tim Russell to work.

INSTROOT=/
INSTDEV=/dev/fd0

while [ 0 ]; do
        if [ $# -gt 1 -a "$1" = "-instdev" ]; then
                INSTDEV=$2;
                shift 2;
                continue;
        elif [ $# -gt 1 -a "$1" = "-instroot" ]; then
                INSTROOT=$2;
                shift 2;
                continue;
        else
                break;
        fi
done;

INSTDIR=$INSTROOT/install/installed
#INSTTEST=/usr2/dist
MNTDIR=/user

function MountDisk() {
        declare -i MountStat
        if [ "$INSTTEST" != "" ]; then
                test -d $INSTTEST;
                MountStat=$?
                return $MountStat;
        fi
        if [ "$1" = "2" ]; then
                FSTYPE="minix"
        else
                FSTYPE="msdos"
        fi
        for j in 1 2 3; do
                echo -n "Insert disk $1 into the floppy drive then hit enter, or q to quit"
                read ans;
                if [ "$ans" = "q" ]; then
                        exit 1;
                fi;
                mount -t $FSTYPE $INSTDEV $MNTDIR >& /dev/null
                MountStat=$?
                if [ $MountStat = 0 ]; then
                        return 0;
                fi
        done
        exit 1
}

function UnmountDisk() {
        if [ "$INSTTEST" = "" ]; then
                umount $INSTDEV > /dev/null
        fi;
}

function InstallPkg() {
        if [ -f $1 ]; then
                echo -n "installing `basename $1 .taz`..."
                (cd $INSTROOT; tar -xzvf - | sed "/\/$/d" ) < $1 > $INSTDIR/`basename $1 .taz`
                if [ -f /install/doinst.sh ]; then
                        sh /install/doinst.sh ;
                        rm -rf /install/doinst.sh ;
                fi
                echo "done"
        else
                echo "$1 not found"
        fi;
}

function InstallDisk() {
        declare -i Status;
        for k in 1 2 3; do
                MountDisk $1
                Status=$?
                if [ $Status != 0 ]; then
                        return 1;
                fi
                if [ "$INSTEST" = "" ]; then
                        SRCDIR=$MNTDIR
                else
                        SRCDIR=$INSTEST/$1
                fi
                if [ -e $SRCDIR/disk$1 -o $1 = Disk ]; then
                        for FileZ in $SRCDIR/*.taz; do
                                if [ $1 = Disk ]; then
                                        echo -n "Install $FileZ (y/n/q)?"
                                        read ans;
                                        if [ "$ans" = "Y" -o "$ans" = "y" ]; then
                                                InstallPkg $FileZ;
                                        elif [ "$ans" = "q" -o "$ans" = "Q" ]; then
                                                exit 0;
                                        fi
                                else
                                                InstallPkg $FileZ;
                                fi
                        done
                        UnmountDisk
                        return 0
                else
                        UnmountDisk
                        echo -n "error: you may have inserted the wrong disk, try again (y/n)?"
                        read ans;
                        if [ "$ans" = "N" -o "$ans" = "n" ]; then
                                return 1
                        fi
                fi;
        done
}

function RemovePkg() {
        if [ -f $INSTDIR/$1 ]; then
                (cd $INSTROOT; xargs /bin/rm -f ) < $INSTDIR/$1
                rm $INSTDIR/$1
        else
                echo "error: unknown package $1"
        fi
}

function PrintUsage() {
        echo "usage: sysinstall -all * install everything: base + X11"
        echo " sysinstall -base * install full base: no X11"
        echo " sysinstall -mini * install a minimal base: ~3 Meg"
        echo " sysinstall -rest * install the rest of the base"
        echo " sysinstall -X11 * install just X11"
        echo " sysinstall -install pkg.taz * install a specific pkg file"
        echo " sysinstall -remove pkg * uninstall a pkg"
        echo " sysinstall -extract pkg * collect pkg files into new pkg.taz"
        echo " sysinstall -disk * install all pkgs on a disk"
        echo " sysinstall -disk DISKNUM * install pkgs on disk DISKNUM"
        echo " sysinstall -mount * mount floppy"
        echo " sysinstall -unmount * unmount floppy"
        echo " sysinstall -instdev INSTDEV * device to install from"
        echo " sysinstall -instroot INSTROOT * directory to use as root"
}

function InstallX11 {
        for i in 11 12 13 14 15; do
                InstallDisk $i;
        done
}

function InstallRest() {
        for i in 5 6 7 8 9 10 2; do
                InstallDisk $i;
        done
}

function InstallMini() {
        for i in 3 4; do
                InstallDisk $i;
        done
}

function InstallBase() {
        InstallMini;
        InstallRest;
}

function InstallAll() {
        InstallBase;
        InstallX11;
}

function ShowInstalled() {
        for i in $INSTDIR/*; do
                echo "`basename $i`";
        done;
}

#if [ "/" != $INSTROOT ]; then
# mount $INSTROOT &> /dev/null
# MNTSTAT=$?;
# if [ $MNTSTAT != 1 ]; then
# echo "error: $INSTROOT must have a partition mounted on it. First use:"
# echo " mount /dev/?d?? $INSTROOT"
# echo " For example: mount /dev/hda2 $INSTROOT"
# exit 1;
# fi
#fi

if [ $# = 0 ]; then
        PrintUsage;
elif [ $1 = "-view" ]; then
        ShowInstalled;
elif [ $1 = "-all" ]; then
        InstallAll;
elif [ $1 = "-base" ]; then
        InstallBase;
elif [ $1 = "-mini" ]; then
        InstallMini;
elif [ $1 = "-rest" ]; then
        InstallRest;
elif [ $1 = "-X11" ]; then
        InstallX11;
elif [ $1 = "-remove" -a $# = 2 ]; then
        RemovePkg $2
elif [ $1 = "-install" -a $# = 2 ]; then
        InstallPkg $2
elif [ $1 = "-extract" -a $# = 2 ]; then
        if [ -f $INSTDIR/$2 ]; then
                (cd $INSTROOT; tar -czf - -T $INSTDIR/$2 ) > $2.taz
        else
                echo "$2 not found";
        fi;
elif [ $1 = "-disk" ]; then
        if [ $# = 1 ] ; then
                InstallDisk Disk
        else
                InstallDisk $2
        fi
elif [ $1 = "-mount ]; then
        MountDisk;
elif [ $1 = "-unmount ]; then
        UnmountDisk;
else
        PrintUsage;
fi;
SHAR_EOF
# End of shell archive
exit 0