summaryrefslogtreecommitdiff
path: root/etc/etc.sparc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-22 10:21:26 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-22 10:21:26 +0000
commitfec5e44a63f6a013e83b2fb42b6e1ea9269e2bcc (patch)
tree50cfb29d0faf24167afe729bdf59034c0360ea5c /etc/etc.sparc
parent9166cb8f10c5d4dee789964ef479c5f126331d59 (diff)
new fancy snapshot install from david@city.ac.uk
Diffstat (limited to 'etc/etc.sparc')
-rw-r--r--etc/etc.sparc/install.sh127
1 files changed, 109 insertions, 18 deletions
diff --git a/etc/etc.sparc/install.sh b/etc/etc.sparc/install.sh
index a5f3079cad4..f75d3cd8ca1 100644
--- a/etc/etc.sparc/install.sh
+++ b/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"