1#!/bin/sh
2
3#
4# syminst - install with a symbolic link back to the build tree
5#
6
7# set DOITPROG to echo to test this script
8
9doit="${DOITPROG-}"
10
11
12# put in absolute paths if you don't have them in your path; or use env. vars.
13
14lnprog="${LNPROG-ln -s}"
15rmprog="${RMPROG-rm}"
16
17instcmd="$lnprog"
18rmcmd="$rmprog -f"
19srcdir=`pwd`/
20src=""
21dst=""
22
23while [ x"$1" != x ]; do
24    case $1 in
25	-c) shift
26	    continue;;
27
28	-m) shift
29	    shift
30	    continue;;
31
32	-o) shift
33	    shift
34	    continue;;
35
36	-g) shift
37	    shift
38	    continue;;
39
40	-s) shift
41	    continue;;
42
43	-DIR) srcdir=`echo $2 | sed 's;/\./;/;g'`/
44	      shift
45              shift
46              continue;;
47
48	*)  if [ x"$src" = x ]
49	    then
50		src=$1
51	    else
52		dst=$1
53	    fi
54	    shift
55	    continue;;
56    esac
57done
58
59if [ x"$src" = x ]
60then
61	echo "syminst:  no input file specified"
62	exit 1
63fi
64
65if [ x"$dst" = x ]
66then
67	echo "syminst:  no destination specified"
68	exit 1
69fi
70
71
72# if destination is a directory, append the input filename; if your system
73# does not like double slashes in filenames, you may need to add some logic
74
75if [ -d $dst ]
76then
77	dst="$dst"/`basename $src`
78fi
79
80case $src in
81    /*) srcdir=""
82	instcmd=cp;;
83esac
84
85# get rid of the old one and mode the new one in
86
87$doit $rmcmd $dst
88$doit $instcmd $srcdir$src $dst
89
90exit 0
91