File: localize.sh

package info (click to toggle)
tcng 10b-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,644 kB
  • sloc: ansic: 19,040; pascal: 4,640; yacc: 2,619; sh: 1,914; perl: 1,546; lex: 772; makefile: 751
file content (47 lines) | stat: -rwxr-xr-x 840 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#
# localize.sh - Complete installation of binary distribution
#
# Written 2001,2004 by Werner Almesberger
#
# Copyright 2001 Network Robots
# Copyright 2004 Werner Almesberger
#

if [ ! -d bin ]; then
    echo "$0: directory ./bin not found" 1>&2
    exit 1
fi

TCNG_INSTALL_CWD=/usr/lib/tcng
DESTDIR=$1

wrap()
{
    if [ -z "$2" ]; then
	if [ -f $1 ] && file $1 | grep ELF >/dev/null; then : ; else
	    return 0
	fi
	[ ! -x ${2:-$1} ] || mv ${2:-$1} ${2:-$1}.bin
    fi
    echo Creating link for $1
    ln -s $TCNG_INSTALL_CWD/${2:-$1} $1
}


fix()
{
    [ -f $1 -a -x $1 ] || return 0
    perl -pi -e \
     'BEGIN { $pwd = "'$TCNG_INSTALL_CWD'" } s/topdir=[^\$].*/topdir=$pwd/;' $1
}


wrap bin/tcc
wrap bin/tcng bin/tcc
wrap bin/tcsim
fix lib/tcng/bin/tcc-module
fix lib/tcng/bin/kmod_cc
fix lib/tcng/bin/tcmod_cc

exit 0