1#!/bin/sh
2# $XConsortium: aminstall.sh,v 1.1 94/03/29 15:54:08 gildea Exp $
3# aminstall - transfer cross-compiled files to system running Amoeba.
4# Usage: aminstall binary-directory [-s stksz] unix-source amoeba-dest
5
6#
7# Default soap mask for files
8#
9SPMASK=0xFF:2:2
10export SPMASK
11PROG=$0
12USAGE="Usage: $PROG binary-directory unix-source amoeba-dest"
13
14#
15# Argument check
16#
17case $# in
183|5)	;;
19*)	echo $USAGE >&2
20	exit 1
21	;;
22esac
23
24bindir=$1
25stksz=
26case $2 in
27-s)	if [ $# -ne 5 ]
28	then
29	    echo $USAGE >&2
30	    exit 1
31	fi
32	stksz="-s $3"
33	shift
34	shift
35	;;
36esac
37
38unxfile=$2
39dest=$3
40
41#
42# Change /public .... into /super (just for installation)
43#
44stripped=`echo $dest | sed 's:^/public::'`
45if [ X$dest != X$stripped ]; then
46    dest=/super$stripped
47fi
48
49#
50# If the file already exists, then delete it
51#
52INFO=`$bindir/std_info $dest 2>&1`
53case $INFO in
54*"not found"*)	;;
55*failed*)	;;
56*bytes*)	$bindir/del -f $dest
57		;;
58/??????)	echo $PROG: cannot install over directory 1>&2
59		exit
60		;;
61*)		$bindir/del -d $dest
62		;;
63esac
64
65#
66# Transfer the file to Amoeba
67#
68$bindir/../bin.scripts/ainstall $stksz $unxfile $dest > /dev/null 2>&1
69if [ $? -ne 0 ]
70then
71	echo "This is not binary - using tob"
72	$bindir/tob $unxfile $dest
73fi
74
75