File: installer

package info (click to toggle)
netscape4.77 4.77-2
  • links: PTS
  • area: non-free
  • in suites: potato, woody
  • size: 27,132 kB
  • ctags: 63
  • sloc: sh: 1,927; makefile: 319
file content (414 lines) | stat: -rw-r--r-- 10,993 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
#!/bin/bash
if [ "$1" != "log" ];then
	exec bash -x $0 log "$@" 2> log
else
	shift
fi
ARCH=${ARCH:-i386}
LIBC=${LIBC:-6}
X_PATH=${X_PATH:-/usr/X11R6/bin}
VER=${VER:-4.77}
VERS=${VERS:-477}
DH_SHARE=${DH_SHARE:-/usr/share/debhelper}
LIBCF() {
	local t=$2 v
	if [ -z "$3" ]; then
		v="-$VERS"
	fi
	if [ "$t" ]; then
		t="-$t"
	fi
	if [ $LIBC = 5 ];then
		LIBCM=-libc5
	fi
	case "$1$t" in
		communicator-smotif|\
		communicator-dmotif|\
		navigator-smotif|\
		navigator-dmotif|\
		netscape-smotif|\
		netscape-dmotif)
			echo $1$t$v$LIBCM;;
		*)
			echo $1$t$v;;
	esac
}
pkg_bad() {
	case $ARCH in
		i386)	
			if [ "$LIBC" = "5" ]; then
				return 0
			fi
			;;
		powerpc)
			if [ "$LIBC" = "5" ]; then
				return 0
			fi
			case "$1" in
				navigator-*)	return 0;;
			esac;;
		*)	echo "Unknown $ARCH in pkg_bad\(\)!"
			echo "Edit $0."
			exit 1;;
	esac
	return 1
}
cat_control() {
	grep -v '^ *$' debian/control.d/$(LIBCF "$1" "$2" no)
	echo
}
build_control() {
	grep -v '^ *$' debian/control.base
	echo
	for LIBC in 5 6;do
		for a in {communic,navig}ator;do
			for b in smotif base;do
				if [ $b = base -a $LIBC = 5 ]; then
					continue
				fi
				if pkg_bad $a-$b; then
					continue
				fi
				cat_control $a $b
			done
		done
		if ! pkg_bad netscape-smotif; then
			cat_control netscape smotif
		fi
	done
	for a in {communic,navig}ator-nethelp communicator-spellchk netscape-{base,java,{ja,ko,zh}-resource};do
		if pkg_bad $a; then
			continue
		fi
		cat_control $a
	done
}

install_all() {
	install_indep
	install_arch
}
install_indep() {
	dh_clean -k -i
	dh_installdirs -i
	for a in {communic,navig}ator-nethelp communicator-spellchk netscape-java;do
		if pkg_bad $a; then
			continue
		fi
		dir=debian/$a-${VERS}/usr/lib/netscape/${VERS}/$(echo $a|cut -f 1 -d -)
		$SHELL ./my-install -v ${VER} \
			-p $a \
			-t $dir
#
# Symlink doc dir to netscape-base-${VERS}
#
		(install -d debian/$a-${VERS}/usr/share/doc
			ln -s netscape-base-${VERS} debian/$a-${VERS}/usr/share/doc/$a-${VERS})

		if [ -e debian/extras/$a/lib ]; then
			cp -a debian/extras/$a/lib/ debian/$a-${VERS}/usr/lib/netscape/${VERS}/
		fi
		if [ -e debian/extras/$a/doc ]; then
			cp -a debian/extras/$a/doc/ debian/$a-${VERS}/usr/doc/$a-${VERS}/
		fi
		mkdir -p debian/$a-${VERS}/DEBIAN
#		mkdir -p debian/$a-${VERS}/usr/lib/netscape/db
		dir=debian/$a-${VERS}/DEBIAN
		for aa in debian/indep.{pre,post}{inst,rm};do
			if [ -e $aa ];then
				name=$dir/$(echo $aa | cut -f 2- -d .)
				cp $aa $name
				chmod 755 $name
			fi
		done
		for aa in postinst prerm; do
			if [ ! -e $dir/$aa ]; then
				echo "#!/bin/sh -e" > $dir/$aa
				chmod 755 $dir/$aa
			fi
			sed "s/#PACKAGE#/$a-${VERS}/g" $DH_SHARE/autoscripts/$aa-doc >> $dir/$aa
		done
	done

	VERS=$VERS make -C locale install DESTTOPDIR=`pwd`/debian
	for a in netscape-{ja,ko,zh}-resource;do
		if pkg_bad $a; then
			continue
		fi
		mkdir -p debian/$a-${VERS}/DEBIAN
		dir=debian/$a-${VERS}/DEBIAN
		for aa in debian/indep.{pre,post}{inst,rm};do
			if [ -e $aa ];then
				name=$dir/$(echo $aa | cut -f 2- -d .)
				cp $aa $name
				chmod 755 $name
			fi
		done
		for aa in postinst prerm; do
			if [ ! -e $dir/$aa ]; then
				echo "#!/bin/sh -e" > $dir/$aa
				chmod 755 $dir/$aa
			fi
			sed "s/#PACKAGE#/$a-${VERS}/g" $DH_SHARE/autoscripts/$aa-doc >> $dir/$aa
		done
	done

	install_menus_indep
}

install_arch() {
	dh_clean -k -a
	dh_installdirs -a
	for LIBC in 5 6;do
		for a in {communic,navig}ator;do
			let v=0
			[ $a = communicator ] && let v=v+2
			for b in smotif base;do
				[ $b = dmotif ] && let v=v+1
				[ $ARCH = powerpc -a $b = dmotif ] && continue
				if pkg_bad $a-$b; then
					continue
				fi
				v=$VERS$v
				dir=debian/$(LIBCF $a $b)/usr/lib/netscape/${VERS}/$a/
 					$SHELL ./my-install -v ${VER} \
					-p $a-$b \
					-a $ARCH \
					-l $LIBC \
					-t $dir
				if [ $b = base ];then
					sym_doc=netscape-base-${VERS}
					tag=ver-base
					tag_sed=''
				else
					sym_doc=$a-base-${VERS}
					tag=browser
					tag_sed="
						-e s|\${VER}|$VER|g
						-e s|\${VERS}|$VERS|g
						-e s|\${N_PR}|$v|g
						-e s|\${B_PR}|$v|g
						-e s|\${BIN}|$a|g
						-e s|\${FLA}|$b|g
						-e s|\${X_PATH}|$X_PATH|g
						-e s|\${NS_BIN}|/usr/lib/netscape/${VERS}/$a/$a-$b|g"
				fi
#
# Symlink doc dir to $a-base-${VER}, or, for $a-base-${VERS}
#
				install -d debian/$(LIBCF $a $b)/usr/share/doc
				ln -s $sym_doc debian/$(LIBCF $a $b)/usr/share/doc/$(LIBCF $a $b)

				mkdir -p debian/$(LIBCF $a $b)/DEBIAN
				if [ $b != base ];then
					mkdir -p debian/$(LIBCF $a $b)/usr/X11R6/bin
					ln -s ../../lib/netscape/$VERS/$a/$a-$b debian/$(LIBCF $a $b)/usr/X11R6/bin/$a-$b-${VERS}
				fi
#				mkdir -p debian/$(LIBCF $a $b)/usr/lib/netscape/db
				dir=debian/$(LIBCF $a $b)/DEBIAN
				for aa in debian/$tag.{pre,post}{inst,rm};do
					if [ -e $aa ];then
						name=$dir/$(echo $aa | cut -f 2- -d .)
						sed $tag_sed $aa > $name
						chmod 755 $name
					fi
				done
				for aa in postinst prerm; do
					if [ ! -e $dir/$aa ]; then
						echo "#!/bin/sh -e" > $dir/$aa
						chmod 755 $dir/$aa
					fi
					sed "s/#PACKAGE#/$(LIBCF $a $b)/g" $DH_SHARE/autoscripts/$aa-doc >> $dir/$aa
				done
			done
		done
	done
#
# Create doc symlinks for the meta pkgs.
#
	for LIBC in 5 6; do
		p=$(LIBCF netscape smotif)
		mkdir -p debian/$p/usr/share/doc/
		ln -s netscape-base-${VERS} debian/$p/usr/share/doc/$p
	done

	mkdir -p debian/netscape-base-$VERS/usr/share/doc/netscape-base-$VERS
	cp -a debian/override.Lintian debian/netscape-base-$VERS/usr/share/doc/netscape-base-$VERS
	for LIBC in 5 6; do
		dir=debian/$(LIBCF netscape smotif)/DEBIAN
		mkdir -p $dir
		for aa in postinst prerm; do
			if [ ! -e $dir/$aa ]; then
				echo "#!/bin/sh -e" > $dir/$aa
				chmod 755 $dir/$aa
			fi
			sed "s/#PACKAGE#/$(LIBCF netscape smotif)/g" $DH_SHARE/autoscripts/$aa-doc >> $dir/$aa
		done
	done

#	for a in $(grep '^Package: ' debian/control | cut -f 2 -d ' ');do
#		mkdir -p debian/$a-$b-${VERS}$LIBCM/usr/lib/netscape/db
#		touch debian/$a-$b-${VERS}$LIBCM/usr/lib/netscape/db/$a-$b-${VERS}
#	done
	$SHELL ./my-install -v ${VER} \
		-p netscape-base \
		-a $ARCH \
		-l $LIBC \
		-t debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape
	mkdir -p debian/netscape-base-$VERS/DEBIAN
#	mkdir -p debian/netscape-base-$VERS/usr/lib/netscape/db
	dir=debian/netscape-base-$VERS/DEBIAN
	for aa in debian/ver-base.{pre,post}{inst,rm};do
		if [ -e $aa ];then
			name=$dir/$(echo $aa | cut -f 2- -d .)
			cp $aa $name
			chmod 755 $name
		fi
	done
#
# Make directories
#
	mkdir -p debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape
	for a in {communic,navig}ator;do
		for b in smotif ;do
			if pkg_bad $a-$b; then
				continue
			fi
			[ $ARCH = powerpc -a $b = dmotif ] && continue
			mkdir -p debian/$(LIBCF $a $b)/usr/lib/menu
		done
	done
#	mkdir -p debian/netscape-base-$VERS/usr/share/doc/netscape-base-4/
	rm -f debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape/LICENSE
#	mv debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape/LICENSE\
#		debian/netscape-base-$VERS/usr/doc/netscape-base-4/LICENSE-${VERS}
#	ln -s ../../../../doc/netscape-base-4/LICENSE-${VERS} debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape/LICENSE
#
# Move binaries around and build C wrapper
#
	for LIBC in 5 6;do
		for a in {communic,navig}ator;do
			for b in smotif ;do
				if pkg_bad $a-$b; then
					continue
				fi
				[ $ARCH = powerpc -a $b = dmotif ] && continue
				mv debian/$(LIBCF $a $b)/usr/lib/netscape/${VERS}/$a/$a-$b \
					debian/$(LIBCF $a $b)/usr/lib/netscape/${VERS}/$a/$a-$b.real
				ln -s ../../base-4/wrapper \
					debian/$(LIBCF $a $b)/usr/lib/netscape/${VERS}/$a/$a-$b
# Unfortunately, this doesn't seem to work yet <sigh>
# commented out for now.
#				tag_sed="
#					-e s|\${VERS}|$VERS|g
#					-e s|\${BIN}|$a|g
#					-e s|\${FLA}|$b|g"
#				sed $tag_sed debian/wrapns.c.in > debian/wrapns.c
#				gcc -O2 -o debian/wrapns debian/wrapns.c
#				install -s debian/wrapns debian/$(LIBCF $a $b)/usr/lib/netscape/${VERS}/$a/$a-$b
#				rm -f debian/wrapns.c debian/wrapns
			done
		done
	done
#
# Remove unnescessary files.
#
	rm -rf debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape/dynfonts
	rm -rf debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape/java/classes/{aix,irix,hpux}
#
# Make symlinks
#
	touch debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape/java


	files1="$(cd debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape;/bin/ls -d *)"
	for a in {communic,navig}ator;do

		#
		# Link files from browser-base to base
		#
		if ! pkg_bad $a; then
			for f in $files1;do
				ln -s ../netscape/$f \
					debian/$a-base-${VERS}/usr/lib/netscape/${VERS}/$a/$f
			done
		fi

		#
		# Link files from browser-base to netscape-base
		#
#		files2="$(cd debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape;/bin/ls -d *)"
#		for b in smotif ;do
#			[ $ARCH = powerpc -a $b = dmotif ] && continue
#			for f in $files2;do
#				ln -s ../../netscape/$f \
#					debian/$(LIBCF $a $b)/usr/lib/netscape/${VERS}/$a/$f
#			done
#		done
		ln -s /etc/mime.types debian/$a-base-${VERS}/usr/lib/netscape/${VERS}/$a/mime.types
		ln -s /etc/mailcap debian/$a-base-${VERS}/usr/lib/netscape/${VERS}/$a/mailcap
	done
	rm -rf debian/netscape-base-$VERS/usr/lib/netscape/${VERS}/netscape/java
	install_menus_arch
}
first_case() {
	local o1 o2
	case $1 in
		l)	o1='[:upper:]' o2='[:lower:]';;
		u)	o2='[:upper:]' o1='[:lower:]';;
	esac
	echo "$(echo $2|cut -b 1|tr $o1 $o2)$(echo $2|cut -b 2-)"
}
install_menus_indep() {
	for a in netscape-{ja,ko,zh}-resource; do
		if pkg_bad $a; then
			continue
		fi
		mkdir -p debian/$a-${VERS}/usr/lib/menu/
		sed "s|VERS|${VERS}|g" debian/$a.menu > debian/$a-${VERS}/usr/lib/menu/$a-${VERS}
		dir=debian/$a-${VERS}/DEBIAN
		for aa in postinst postrm; do
			if [ ! -e $dir/$aa ]; then
				echo "#!/bin/sh -e" > $dir/$aa
				chmod 755 $dir/$aa
			fi
			cat $DH_SHARE/autoscripts/$aa-menu >> $dir/$aa
		done
	done
}
install_menus_arch() {
	for LIBC in 5 6;do
		for a in {communic,navig}ator;do
			for b in smotif ;do
				if pkg_bad $a-$b; then
					continue
				fi
				[ $ARCH = powerpc -a $b = dmotif ] && continue
				[ ! -d debian/$a-$b-${VERS} ] && continue
				case $b in
					smotif)	o="static";;
					dmotif)	o="dynamic";;
				esac
				f="$(first_case u $a)"
				mkdir -p debian/$(LIBCF $a $b)/usr/lib/menu
				sed -e "s|BROWSER|$(LIBCF $a $b)|g" \
					-e "s|TITLE_MAIL|$f($o ${VER}) Mail|g" \
					-e "s|TITLE_NEWS|$f($o ${VER}) News|g" \
					-e "s|TITLE|$f($o ${VER}) Browser|g" \
					-e "s|CMD_MAIL|/usr/lib/netscape/${VERS}/$a/$a-$b mailbox:|g" \
					-e "s|CMD_NEWS|/usr/lib/netscape/${VERS}/$a/$a-$b news:|g" \
					-e "s|CMD|/usr/lib/netscape/${VERS}/$a/$a-$b|g" \
						debian/$a.menu > debian/$(LIBCF $a $b)/usr/lib/menu/$a-$b-${VERS}
			done
		done
	done
}
while [ "$1" ];do
	case $1 in
		all|arch|indep) eval install_$1;;
		control)	build_control;;
		*)	echo please pass one of all, arch, or indep;;
	esac
	shift
done
exit 0