From 89f56eb5ee6b8f18f7fc414190f05f63ec643e5e Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Wed, 22 Nov 1995 10:21:25 +0000 Subject: [PATCH] new fancy snapshot install from david@city.ac.uk --- src/etc/etc.sparc/install.sh | 127 ++++++++++++++++++++++++++++++----- 1 file changed, 109 insertions(+), 18 deletions(-) diff --git a/src/etc/etc.sparc/install.sh b/src/etc/etc.sparc/install.sh index a5f3079c..f75d3cd8 100644 --- a/src/etc/etc.sparc/install.sh +++ b/src/etc/etc.sparc/install.sh @@ -1,20 +1,111 @@ #!/bin/sh -# $Id: install.sh,v 1.2 1995/11/08 07:12:53 deraadt Exp $ +# $Id: install.sh,v 1.3 1995/11/22 10:21:25 deraadt Exp $ + +# XXX should handle --unlink + +INSTALLTO=/mnt +TARFLAGS=xfp +TARLIST="bin sbin usr.bin usr.games usr.include usr.lib usr.libexec usr.misc \ + usr.sbin usr.share var dev" + umask 0 -cat ./bin.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./etc.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./sbin.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./usr.bin.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./usr.games.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./usr.include.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./usr.lib.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./usr.libexec.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./usr.misc.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./usr.sbin.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./usr.share.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./var.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cat ./dev.tar.gz | gzip -d | (cd /mnt; tar xvpf -) -cp ./bsd.scsi3 /mnt/bsd -chmod 640 /mnt/bsd; chown root.kmem /mnt/bsd -cd /mnt/dev; ./MAKEDEV all -mv /mnt/etc/fstab.sd /mnt/etc/fstab + +# Usage 'install.sh [-v] [installto]' +# -v : Set verbose mode (tar lists files) +# installto : Sets the path to install to. +# +while [ -n "$1" ]; do + case "$1" in + -v) + TARFLAGS=xvfp + echo "(Verbose mode on)" + ;; + *) + if [ ! -d $1 ]; then + echo "Cannot extract to $1 - no such directory." + exit 3 + fi + INSTALLTO=$1 + ;; + esac + shift +done +echo "Installing to '$INSTALLTO'." + +# Try for gnutar first, then gtar, or just use tar if no luck +# Also check we have gzip in the path +# +oldIFS="$IFS" +IFS=":${IFS}" +for search in gnutar gtar tar;do + TAR= + for dir in $PATH;do + if [ -x $dir/$search ];then + TAR=$dir/$search + break 2 + fi + done +done +echo "Using $TAR to extract files." +GZIP= +for dir in $PATH;do + if [ -x $dir/gzip ];then + GZIP=$dir/gzip + break + fi +done +if [ -z "$GZIP" ];then + echo "Cannot find gzip in your path - aborting." + exit 3 +fi +echo "Found $GZIP." +IFS="$oldIFS" + +# If etc/passwd found, check if we _really_ want to extract over etc. +# +INSTALLETC=y +if [ -f $INSTALLTO/etc/passwd ];then + echo "" + echo "" + echo "**** etc/passwd found - do you want to extract over etc? (y/n)" + read ans + case $ans in + y* | Y* ) + echo "Ok - extracting etc." + ;; + *) + echo "Not extracting etc." + INSTALLETC=n + ;; + esac + echo "" +fi +if [ $INSTALLETC = y ];then + TARLIST="etc $TARLIST" +fi + +# Extract the files +# +for f in $TARLIST ; do + echo "---- $f ----" + $GZIP -d -c ./$f.tar.gz | (cd $INSTALLTO; $TAR $TARFLAGS -) + if [ $? != 0 ] ; then + echo "**** Extract of $f failed. Aborting". + exit 3 + fi +done + +# Tidy up +# +echo "Installing bsd.scsi3 as kernel, replace by hand you need to." +cp ./bsd.scsi3 $INSTALLTO/bsd +chmod 640 $INSTALLTO/bsd; chown root.kmem $INSTALLTO/bsd +if [ ! -c $INSTALLTO/dev/console ];then + echo "Tar did not understand device nodes - removing" + rm -rf $INSTALLTO/dev/[a-z]* +fi +cd $INSTALLTO/dev; ./MAKEDEV all +if [ $INSTALLETC = y ];then + mv $INSTALLTO/etc/fstab.sd $INSTALLTO/etc/fstab +fi +echo "You should probably edit $INSTALLTO/etc/fstab"