aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/config/util/syminst.sh
blob: f9e1863d53f519a28384954d1b617df176ae3bc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh

#
# syminst - install with a symbolic link back to the build tree
#

# set DOITPROG to echo to test this script

doit="${DOITPROG-}"


# put in absolute paths if you don't have them in your path; or use env. vars.

lnprog="${LNPROG-ln -s}"
rmprog="${RMPROG-rm}"

instcmd="$lnprog"
rmcmd="$rmprog -f"
srcdir=`pwd`/
src=""
dst=""

while [ x"$1" != x ]; do
    case $1 in
	-c) shift
	    continue;;

	-m) shift
	    shift
	    continue;;

	-o) shift
	    shift
	    continue;;

	-g) shift
	    shift
	    continue;;

	-s) shift
	    continue;;

	-DIR) srcdir=`echo $2 | sed 's;/\./;/;g'`/
	      shift
              shift
              continue;;

	*)  if [ x"$src" = x ]
	    then
		src=$1
	    else
		dst=$1
	    fi
	    shift
	    continue;;
    esac
done

if [ x"$src" = x ]
then
	echo "syminst:  no input file specified"
	exit 1
fi

if [ x"$dst" = x ]
then
	echo "syminst:  no destination specified"
	exit 1
fi


# if destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic

if [ -d $dst ]
then
	dst="$dst"/`basename $src`
fi

case $src in
    /*) srcdir=""
	instcmd=cp;;
esac

# get rid of the old one and mode the new one in

$doit $rmcmd $dst
$doit $instcmd $srcdir$src $dst

exit 0