File: installTed.in

package info (click to toggle)
ted 2.6-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,928 kB
  • ctags: 8,734
  • sloc: ansic: 71,878; makefile: 2,363; sh: 159
file content (206 lines) | stat: -rwxr-xr-x 3,155 bytes parent folder | download
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/bin/sh

NONL_B=-n
NONL_E=

#
#   Intallation directory. As this value is compiled into
#   the 'Ted' executable as well ( see appFrame/config.h.in )
#   changing this value will result in an installation that does
#   not work.
#
#
#   In a normal installation, only run as root.
#
case $RPM_BUILD_ROOT in
    ?*)
	PKGDIR=${RPM_BUILD_ROOT}/usr/local
	;;
    *)
	PKGDIR=/usr/local

	ID=`id`
	case $ID in
	    uid=0\(root\)\ gid=0\(root\)\ *)
		# What you ususlly get when you log in as root.
		;;
	    uid=0\(root\)\ *)
		# Must be sufficient.
		;;
	    *)
		echo 'You must be logged in as root to install Ted.'
		echo 'id:' $ID
		exit 1
		;;
	esac
	;;
esac

#
#   Make file permissions independent on the private settings of
#   the caller.
#
umask 000

#
#   Remember where we are, the packages are supposed to reside
#   in the same directory.
#
DIR=`echo $0 | sed -n -e 's!/[^/]*$!!p'`
case $DIR in
    ?*)
	HERE=`( cd $DIR && pwd )`
	;;
    *)
	HERE=`pwd`
	;;
esac

#
#   Let the user decide whether she wants to install a package.
#
ask()
    {
    answer='?'

    while true
    do
	echo $NONL_B 'Do you want to install package' $1 '? [yes|no|quit] ' $NONL_E

	if  read answer
	then
	    case $answer in
		y|yes)
		    (	cd ${PKGDIR}		&& \
			cat $HERE/$1.tar.gz	|  \
			gzip -d			|  \
			tar xvf -		)
		    break
		    ;;
		n|no)
		    break
		    ;;
		q|quit)
		    break 2
		    ;;
		*)
		    continue
		    ;;
	    esac
	fi

    done
    }

#
#   If the installation directory does not exist make it.
#

if test -d ${PKGDIR}
then
    : ok
else
    if  mkdir ${PKGDIR}			&&
        chown root:root ${PKGDIR}	&&
        chmod 755 ${PKGDIR}
    then
	echo made `ls -ld ${PKGDIR}`
    else
	echo failed to make directory ${PKGDIR}
	exit 1
    fi
fi

case $# in
    0)
	: Default case .. interactive install
	echo -n test > /tmp/$$.echo
	if  grep -q n /tmp/$$.echo
	then
	    NONL_B=
	    NONL_E=\\c
	fi
	rm -f /tmp/$$.echo
	;;
    1)
	: Install a particular package without asking
	:
	if  test x_$1 = x_COMMON
	then
	    SOURCE=${HERE}/@BINDIST@.tar.gz
	else
	    SOURCE=${HERE}/$1.tar.gz
	fi

	if  test -f ${SOURCE}
	then
	    if  (   cd ${PKGDIR}	&& \
		    cat ${SOURCE}	|  \
		    gzip -d		|  \
		    tar xvf -		)
	    then
		exit 0
	    else
		exit 1
	    fi
	else
	    echo File ${SOURCE} does not exist
	    exit 1
	fi
	;;
    *)
	echo 'Usage' $0
	echo 'or   ' $0 something for something.tar.gz
	;;
esac

#
#   Let the user select packages that she wants to install.
#
for pkg in	@BINDIST@	\
		Ted_NL		\
		Ted_GB		\
		Ted_D		\
		Ted_E		\
		Ted_P		\
		Ted_F		\
		Ted_I		\
		Ted_CZ		\
		Ted_DK		\
		Ted_S		\
		Ted_N		\
		Ted_PL
do
    if  test -f $HERE/$pkg.tar.gz
    then
	echo

	if  test -f $HERE/$pkg.lsm
	then
	    sed -n -e	'/^Description/,/^[^ 	]/p'	\
			    $HERE/$pkg.lsm		|
	    sed -e	's/Description:/ /'		\
		-e	'/^[^ 	]/d'			\
		-e	's/[ 	]*/	/'
	fi

	echo

	ask $pkg
    fi
done

case `type Ted` in
    'Ted is ${PKGDIR}/bin/Ted')
	: ok
	;;
    *)
	echo
	echo
	if  test -f ${PKGDIR}/bin/Ted
	then
	    echo Do not forget to include ${PKGDIR}/bin in your PATH.
	else
	    echo Ted is not installed as ${PKGDIR}/bin/Ted.
	fi
esac