summaryrefslogtreecommitdiffstats
path: root/t/recipes/checks/executable/legacy-scripts/build-spec/debian/rules
blob: dc6b7d52fd9dd2ae0d9092a5dcc7e12bd486e5a9 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/make -f

tmp=debian/tmp

build-arch:
	echo "Hi, in an arch: all package, I am a bug!"

build-indep:

build: build-arch build-indep

binary-arch:
	echo "Hi, in an arch: all package, I am a bug!"

binary-indep:
	install -d $(tmp)/usr/bin/
	install -d $(tmp)/etc/X11/Xsession.d/
	install -d $(tmp)/etc/init.d/
	install -d $(tmp)/etc/csh/login.d/
	install -d $(tmp)/etc/fish.d/
	install -d $(tmp)/usr/share/scripts/
	install -d $(tmp)/usr/share/doc/scripts/
	install -d $(tmp)/usr/lib/cgi-bin
	install -d $(tmp)/usr/src/scripts
	install -d $(tmp)/DEBIAN

	install -m 755 csh-foo $(tmp)/etc/csh/login.d/ 
	install -m 755 envfoo $(tmp)/usr/bin/
	install -m 755 fish-foo $(tmp)/etc/fish.d/
	install -m 755 jruby-broken $(tmp)/usr/bin/
	install -m 755 py3.Xfoo $(tmp)/usr/bin/
# This uses "env" and should trigger script-in-usr-share-doc
	install -m 755 py3.Xfoo $(tmp)/usr/share/doc/scripts/
	install -m 755 py3foo $(tmp)/usr/bin/
# This uses "env" and should trigger script-in-usr-share-doc
	install -m 755 py3foo $(tmp)/usr/share/doc/scripts/
	install -m 755 perlfoo $(tmp)/usr/bin/
	install -m 755 rubyfoo $(tmp)/usr/bin/
# This doesn't use "env" but should also trigger script-in-usr-share-doc
	install -m 755 rubyfoo $(tmp)/usr/share/doc/scripts/
	install -m 755 make-foo $(tmp)/usr/bin/
	install -m 755 lefty-foo $(tmp)/usr/bin/
	install -m 4751 perlfoo $(tmp)/usr/bin/suidperlfoo2
	install -m 755 sh-broken $(tmp)/usr/bin/
	install -m 4555 suidperlfoo $(tmp)/usr/bin/
	install -m 755 tkfoo $(tmp)/usr/bin/
	install -m 755 wishfoo $(tmp)/usr/bin/
	install -m 644 xsession-test $(tmp)/etc/X11/Xsession.d/

# Permissions here aren't part of what's being tested, but let us exercise
# some other errors.
	install -m 755 perl-bizarre-1 $(tmp)/usr/bin/
	install -m 750 perl-bizarre-2 $(tmp)/usr/bin/
	install -m 754 perl-bizarre-3 $(tmp)/usr/bin/
	install -m 705 guile-bizarre $(tmp)/usr/bin/

# First one should produce a warning; second one shouldn't.
	install -m 755 gccbug.dpatch $(tmp)/usr/share/scripts/
	install -m 755 gccbug.dpatch $(tmp)/usr/src/scripts/

	install -m 644 init-skeleton $(tmp)/etc/init.d/skeleton
	install -m 755 init-no-lsb $(tmp)/etc/init.d/no-lsb
	install -m 755 init-lsb-broken $(tmp)/etc/init.d/lsb-broken
	install -m 755 init-lsb-other $(tmp)/etc/init.d/lsb-other

	install -m 755 phpfoo $(tmp)/usr/share/scripts/
	sed 's/php$$/php7.0/' phpfoo > $(tmp)/usr/share/scripts/php7.0foo
	chmod 755 $(tmp)/usr/share/scripts/php7.0foo

	install -m 755 phpenvfoo $(tmp)/usr/share/scripts/
	sed 's/php$$/php7.0/' phpenvfoo > $(tmp)/usr/share/scripts/php7.0envfoo
	chmod 755 $(tmp)/usr/share/scripts/php7.0envfoo

	echo "#!/usr/bin/perl" >> $(tmp)/usr/share/scripts/foobar.in
	chmod 644 $(tmp)/usr/share/scripts/foobar.in

	touch $(tmp)/usr/share/scripts/mono.exe
	chmod 755 $(tmp)/usr/share/scripts/mono.exe

	echo "#!/bin/sh" > $(tmp)/usr/share/scripts/foo\$$bar
	chmod 755 $(tmp)/usr/share/scripts/foo\$$bar

	echo "#!/bin/sh" > $(tmp)/usr/lib/cgi-bin/cgi-script
	chmod 755 $(tmp)/usr/lib/cgi-bin/cgi-script

	echo "#!/bin/sh" > $(tmp)/usr/bin/test.sh
	chmod 755 $(tmp)/usr/bin/test.sh


	dh_testroot # dummy to test missing debhelper dependency


	install -m 644 debian/changelog $(tmp)/usr/share/doc/scripts/changelog.Debian
	gzip -n -9 $(tmp)/usr/share/doc/scripts/changelog.Debian
	install -m 644 debian/copyright $(tmp)/usr/share/doc/scripts/copyright

	install -m 644 debian/scripts.conffiles $(tmp)/DEBIAN/conffiles
	install -m 755 debian/preinst $(tmp)/DEBIAN/preinst
	install -m 755 debian/postinst $(tmp)/DEBIAN/postinst
	install -m 755 debian/postrm $(tmp)/DEBIAN/postrm
	touch $(tmp)/DEBIAN/prerm
	chmod 755 $(tmp)/DEBIAN/prerm
	dpkg-gencontrol -isp
	dpkg --build $(tmp) ..

binary: binary-arch binary-indep

clean:
	rm -rf debian/files $(tmp) debian/substvars

.PHONY: build-arch build-indep build binary-arch binary-indep binary clean