xref: /plan9-contrib/sys/lib/dist/mkfile (revision 8ccc32ef0b9b7222ff49b683668eb07a18989e02)
1# /sys/lib/dist/mkfile
2
3<defs
4
5x=`{setup}	# import /sys/lib/dist/web.protect from the outside
6
7cd:V: $scr/plan9.iso
8
9ncd:V: $scr/plan9-new.iso.bz2
10
11ncd-dist:V: $scr/plan9-new.iso.bz2
12	mk $dist/web.protect/plan9-new.iso.bz2
13
14$scr/usbdisk.bz2:D: $scr/plan9.iso.bz2
15	cd pc; mk $target
16usb-dist:V: $scr/usbdisk.bz2
17	mk $dist/web.protect/usbdisk.bz2
18
19#contrib-cd:V: $scr/contrib.iso.bz2
20#	mk $dist/web.protect/contrib.iso.bz2
21#$scr/contrib.iso:DV:
22#	rm -f $target
23#	disk/mk9660 -9cj -v 'Plan 9 Extras' -s /n/sources \
24#		-p ./contrib.proto $target
25
26$scr/%.iso:D: $src9/dist/replica/plan9.log
27	rfork n
28	@ { cd pc; mk cddisk }
29	rm -f $target
30	bind pc/cddisk cdstub/bootdisk.img
31	bind /386/9load cdstub/9load
32	bind /386/pbsraw cdstub/pbsraw
33	if(! test -f $src9/bootdisk.img)
34		bind -a cdstub $src9
35	title=`{date | sed 's/(...) (...) (..) (..:..):.. (...) (....)/Plan 9 - \2 \3 \6 \4/'}
36	title=$"title
37	echo 'CD:' $title
38	disk/mk9660 -9cj -v $title -s $src9 -B pbsraw -x 9load $target
39
40# copy (compressed) file from scratch space to the distribution, carefully
41$dist/web.protect/%:		$scr/%
42	>>$target.new
43	chmod +t $target.new		# waste write buf, not venti store
44	cp $prereq $target.new
45	# replace previous version with a flash cut
46	if (test -e $target)
47		mv $target $target.old # try to not clobber downloads in progress
48	mv $target.new $target
49
50cd-cleanup:V:
51	rm -f $dist/web.protect/*.iso.bz2.old # remove old versions after a delay
52
53# generate replica log & db for $src9 only
54scan:V:
55	test -d $scr		# make sure other was mounted above
56	test -d $src9
57	test -d $dist/web.protect
58	lock scan.lock replica/scan $dist/sources.replica
59	chmod +t $src9/dist/replica/*.^(db log)
60
61# generate replica log & db for all of /n/sources
62scanall:V:
63	@ {
64		rfork ne
65		d=/n/sources
66		test -d $src9
67		lock scanall.lock replica/scan $dist/sourcesall.replica
68		chmod +t $src9/dist/replica/*.^(db log)
69	}
70
71compresslog:V:
72	{
73	awk -f logcompress.awk $src9/dist/replica/plan9.log |
74		awk -f logtime.awk -v 't='^`{date -n} >/tmp/plan9.log
75	rm -f $src9/dist/replica/plan9.new.log
76	cp /tmp/plan9.log $src9/dist/replica/plan9.new.log &&
77		mv $src9/dist/replica/plan9.new.log $src9/dist/replica/plan9.log
78	} <scan.lock
79
80#restart:V:
81#	rm -f $src9/dist/replica/plan9.db
82#	rm -f $src9/dist/replica/plan9.log
83#	chmod 664 $src9/dist/replica/plan9.db >$src9/dist/replica/plan9.db
84#	chmod 664 $src9/dist/replica/plan9.log >$src9/dist/replica/plan9.log
85#	chmod +a $src9/dist/replica/plan9.log
86#	mk scan
87
88odump:V:
89	disk/dump9660 -9cj -v 'Plan 9 4e Dumps' -s $src9 \
90		-p /sys/lib/sysconfig/proto/allproto $scr/distdump.iso
91
92cd.install:DV:
93	bzip2 -9 <$scr/plan9.iso >web.protect/nplan9.iso.bz2
94
95D.install:V:
96	D=/n/roro/usr/rob/testplan9
97	9fs roro
98	test -d $D
99	cp $D$dist/pc/ndisk $dist/web.protect/ndisk
100	cp $D$dist/pc/9loaddebug $dist/web.protect/n9loaddebug
101
102reallyinstall:V:
103	if(! ~ $sysname achille){
104		echo; echo; echo '*** this needs to run on achille.'
105		exit bad
106	}
107	cd web.protect
108	for (i in plan9.iso.bz2 disk 9loaddebug vmware.zip)
109		if(test -f n$i){
110			mv $i _$i && { mv n$i $i || mv _$i $i }
111		}
112	rm /srv/ramfs.9down4e
113	$dist/startcache
114
115dump:V:
116	rm -f /srv/9660.xxx
117	9660srv 9660.xxx
118	mount /srv/9660.xxx /n/kremvax $scr/plan9.iso
119	now=`{mtime $dist/web.protect/plan9.iso.bz2 | awk '{print $1}'}
120	ls -l /rls/plan9/4e.iso
121	disk/dump9660 -9cj -s /n/kremvax -n $now /rls/plan9/4e.iso
122	ls -l /rls/plan9/4e.iso
123	rm /srv/9660.xxx
124
125reencode:V:
126	rm -f $scr/nplan9.iso
127	rm -f /srv/9660.xxx
128	9660srv 9660.xxx
129	mount /srv/9660.xxx /n/kremvax $scr/plan9.iso
130	disk/mk9660 -9cj -v 'Plan 9 4th Edition' -s /n/kremvax \
131		-b bootdisk.img $scr/nplan9.iso
132	rm /srv/9660.xxx
133
134# compress a cd image in scratch space
135$scr/%.iso.bz2:D: $scr/%.iso
136	@ {
137		cd $scr
138		bzip2 -9 <$stem.iso >n$stem.iso.bz2 &&
139		{
140			if (test -e $stem.iso.bz2)
141				mv  $stem.iso.bz2 _$stem.iso.bz2
142			mv n$stem.iso.bz2 $stem.iso.bz2
143		}
144		echo `{date} md5 `{md5sum <$stem.iso.bz2} \
145			sha1 `{sha1sum <$stem.iso.bz2} \
146			$stem.iso.bz2 >>/usr/web/plan9checksums.txt
147	}
148
149rebuild:V:
150	chmod +l build.lock >>build.lock
151	lock build.lock rebuild
152
153rebuild-mail:V:
154	chmod +l build.lock >>build.lock
155	lock build.lock rebuild
156	datemail 'nightly build errors' 9trouble <buildit.out
157	datemail 'nightly build differences' 9trouble <checkbuild.out
158	status=''
159
160scansources-mail:V:
161	scansources | datemail 'nightly fs vs. sources scan' 9trouble
162
163worldwritable-mail:V:
164	test -e $src9
165	@ {cd /n/sources; /sys/lib/dist/rsc/bin/$cputype/lsr -t -d} |
166		awk '$2 ~ /[2367]$/' | grep -vf ok-writable |
167		datemail 'WRITABLE FILES ON SOURCES' 9trouble || status=''
168	status=''
169	@ {
170		cd $src9
171		/sys/lib/dist/rsc/bin/$cputype/lsr -t -d $src9
172	} |
173		awk '$2 ~ /[2367][^2367].$/' |
174		datemail 'non-group-writable files on sources' 9trouble
175	status=''
176	# use /n/boot to avoid walking the archives mounted under
177	# /lib/vac, or other mounts or binds.
178	rfork n
179	9fs boot
180	test -e /n/boot/sys
181	/sys/lib/dist/rsc/bin/$cputype/lsr -t -d /n/boot/sys /n/boot/lib |
182		grep -v '/lib/audio/|/sys/src/cmd/vac/test/' | # give us a break
183		awk '$2 ~ /[2367][^2367].$/' |
184		datemail 'non-group-writable files on fs' 9trouble
185	status=''
186
1879.tar.gz:V:
188	@{
189		rfork n
190		9fs sources
191		test -e $src9
192		bind -a $src9 $src9/sys/src
193		cd $src9/sys/src
194		tar c LICENSE NOTICE 9
195	} | gzip >$target
196
1979-export:V: 9.tar.gz
198	9fs sources
199	cp 9.tar.gz /n/sources/extra/9.tgz
200	chmod +t    /n/sources/extra/9.tgz
201
202plan9.tar.bz2:V:
203	@{
204		rfork n
205		9fs sources
206		cd /n/sources
207		test -e $src9
208		bind /n/empty $src9/lib/font
209		bind /n/empty $src9/sys/lib/postscript/font
210		bind /n/empty $src9/sys/lib/ghostscript
211		bind /n/empty $src9/sys/src/cmd/gs
212		tar c plan9/LICENSE* plan9/NOTICE plan9/*/mkfile plan9/*/include \
213			plan9/acme/*/src plan9/acme/bin/source \
214			plan9/^(adm cron lib lp mail rc sys tmp usr)
215	} | bzip2 >$target
216
217plan9-export:V: plan9.tar.bz2
218	9fs sources
219	chmod +t plan9.tar.bz2
220	mv plan9.tar.bz2 /n/sources/extra/plan9.tar.bz2
221