summaryrefslogtreecommitdiff
path: root/sys/lib/dist/mkfile
blob: 98dcd8fee7c620226c9a098146ebb79d0a975af0 (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
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
# /sys/lib/dist/mkfile
src9=/n/sources/plan9		# what to export
dist=/sys/lib/dist		# where this machinery lives
scr=/n/other/dist		# scratch space before copying to web.protect
# import /sys/lib/dist/web.protect from the outside
x=`{setup}

cd:V: $scr/plan9.iso

ncd:V: $scr/plan9-new.iso.bz2

ncd-dist:V: $scr/plan9-new.iso.bz2
	mk $dist/web.protect/plan9-new.iso.bz2

cd-dist:V: $scr/plan9.iso.bz2
	mk $dist/web.protect/plan9.iso.bz2

contrib-cd:V: $scr/contrib.iso.bz2
	mk $dist/web.protect/contrib.iso.bz2

$scr/%.iso:D: $src9/dist/replica/plan9.log
	@ { cd pc; mk cddisk }
	rm -f $target
	bind pc/cddisk cdstub/bootdisk.img
	if(! test -f $src9/bootdisk.img)
		bind -a cdstub $src9
	title=`{date | sed 's/(...) (...) (..) (..:..):.. (...) (....)/Plan 9 - \2 \3 \6 \4/'}
	title=$"title
	echo 'CD:' $title
	disk/mk9660 -9cj -v $title -s $src9 -b bootdisk.img $target

# copy compressed file from scratch space to the distribution, carefully
$dist/web.protect/%.iso.bz2:	$scr/%.iso.bz2
	>>$target.new
	chmod +t $target.new		# waste write buf, not venti store
	cp $prereq $target.new
	# replace previous version with a flash cut
	if (test -e $target)
		mv $target $target.old # try to not clobber downloads in progress
	mv $target.new $target

cd-cleanup:V:
	rm -f $dist/web.protect/*.iso.bz2.old # remove old versions after a delay

# generate replica log & db for $src9 only
scan:V:
	test -d $scr		# make sure other was mounted above
	test -d $src9
	test -d $dist/web.protect
	lock scan.lock replica/scan $dist/sources.replica
	chmod +t $src9/dist/replica/*.^(db log)

# generate replica log & db for all of /n/sources
scanall:V:
	@ {
		rfork ne
		d=/n/sources
		test -d $src9
		lock scanall.lock replica/scan $dist/sourcesall.replica
		chmod +t $src9/dist/replica/*.^(db log)
	}

compresslog:V:
	{
	awk -f logcompress.awk $src9/dist/replica/plan9.log |
		awk -f logtime.awk -v 't='^`{date -n} >/tmp/plan9.log
	rm -f $src9/dist/replica/plan9.new.log
	cp /tmp/plan9.log $src9/dist/replica/plan9.new.log &&
		mv $src9/dist/replica/plan9.new.log $src9/dist/replica/plan9.log
	} <scan.lock

#restart:V:
#	rm -f $src9/dist/replica/plan9.db
#	rm -f $src9/dist/replica/plan9.log
#	chmod 664 $src9/dist/replica/plan9.db >$src9/dist/replica/plan9.db
#	chmod 664 $src9/dist/replica/plan9.log >$src9/dist/replica/plan9.log
#	chmod +a $src9/dist/replica/plan9.log
#	mk scan

odump:V:
	disk/dump9660 -9cj -v 'Plan 9 4e Dumps' -s $src9 \
		-p /sys/lib/sysconfig/proto/allproto $scr/distdump.iso

cd.install:V:
#	if(~ $sysname achille){
#		echo; echo; echo '*** run this on a real machine, like chips.'
#		exit bad
#	}
	bzip2 -9 <$scr/plan9.iso >web.protect/nplan9.iso.bz2

D.install:V:
	D=/n/roro/usr/rob/testplan9
	9fs roro
	test -d $D
	cp $D$dist/pc/ndisk $dist/web.protect/ndisk
	cp $D$dist/pc/9loaddebug $dist/web.protect/n9loaddebug

reallyinstall:V:
	if(! ~ $sysname achille){
		echo; echo; echo '*** this needs to run on achille.'
		exit bad
	}
	cd web.protect
	for (i in plan9.iso.bz2 disk 9loaddebug vmware.zip)
		if(test -f n$i){
			mv $i _$i && { mv n$i $i || mv _$i $i }
		}
	rm /srv/ramfs.9down4e
	$dist/startcache

dump:V:
	rm -f /srv/9660.xxx
	9660srv 9660.xxx
	mount /srv/9660.xxx /n/kremvax $scr/plan9.iso
	now=`{mtime $dist/web.protect/plan9.iso.bz2 | awk '{print $1}'}
	ls -l /rls/plan9/4e.iso
	disk/dump9660 -9cj -s /n/kremvax -n $now /rls/plan9/4e.iso
	ls -l /rls/plan9/4e.iso
	rm /srv/9660.xxx

reencode:V:
	rm -f $scr/nplan9.iso
	rm -f /srv/9660.xxx
	9660srv 9660.xxx
	mount /srv/9660.xxx /n/kremvax $scr/plan9.iso
	disk/mk9660 -9cj -v 'Plan 9 4th Edition' -s /n/kremvax \
		-b bootdisk.img $scr/nplan9.iso
	rm /srv/9660.xxx

# compress a cd image in scratch space
$scr/%.iso.bz2:D: $scr/%.iso
	@ {
		cd $scr
		bzip2 -9 <$stem.iso >n$stem.iso.bz2 &&
		{
			if (test -e $stem.iso.bz2)
				mv  $stem.iso.bz2 _$stem.iso.bz2
			mv n$stem.iso.bz2 $stem.iso.bz2
		}
		echo `{date} md5 `{md5sum <$stem.iso.bz2} \
			sha1 `{sha1sum <$stem.iso.bz2} \
			$stem.iso.bz2 >>/usr/web/plan9checksums.txt
	}

$scr/contrib.iso:DV:
	rm -f $target
	disk/mk9660 -9cj -v 'Plan 9 Extras' -s /n/sources \
		-p ./contrib.proto $target

rebuild:V:
	chmod +l build.lock >>build.lock
	rebuild <build.lock

rebuild-mail:V:
	chmod +l build.lock >>build.lock
	rebuild <build.lock
	datemail 'nightly build errors' 9trouble <buildit.out
	datemail 'nightly build differences' 9trouble <checkbuild.out
	status=''

scansources-mail:V:
	scansources | datemail 'nightly fs vs. sources scan' 9trouble

worldwritable-mail:V:
	test -e $src9
	@ {cd /n/sources; /usr/rsc/bin/$cputype/lsr -t -d} |
		awk '$2 ~ /[2367]$/' | grep -vf ok-writable |
		datemail 'WRITABLE FILES ON SOURCES' 9trouble || status=''
	status=''
	@ {
		cd $src9
		/usr/rsc/bin/$cputype/lsr -t -d $src9
	} |
		awk '$2 ~ /[2367][^2367].$/' |
		datemail 'non-group-writable files on sources' 9trouble
	status=''
	# use /n/boot to avoid walking the archives mounted under
	# /lib/vac, or other mounts or binds.
	rfork n
	9fs boot
	test -e /n/boot/sys
	/usr/rsc/bin/$cputype/lsr -t -d /n/boot/sys /n/boot/lib |
		grep -v '/lib/audio/|/sys/src/cmd/vac/test/' | # give us a break
		awk '$2 ~ /[2367][^2367].$/' |
		datemail 'non-group-writable files on fs' 9trouble
	status=''

9.tar.gz:V:
	@{
		rfork n
		9fs sources
		test -e $src9
		bind -a $src9 $src9/sys/src
		cd $src9/sys/src
		tar c LICENSE NOTICE 9
	} | gzip >$target

9-export:V: 9.tar.gz
	9fs sources
	cp 9.tar.gz /n/sources/extra/9.tgz
	chmod +t    /n/sources/extra/9.tgz

plan9.tar.bz2:V:
	@{
		rfork n
		9fs sources
		cd /n/sources
		test -e $src9
		bind /n/empty $src9/lib/font
		bind /n/empty $src9/sys/lib/postscript/font
		bind /n/empty $src9/sys/lib/ghostscript
		bind /n/empty $src9/sys/src/cmd/gs
		tar c plan9/LICENSE* plan9/NOTICE plan9/*/mkfile plan9/*/include \
			plan9/acme/*/src plan9/acme/bin/source \
			plan9/^(adm cron lib lp mail rc sys tmp usr)
	} | bzip2 >$target

plan9-export:V: plan9.tar.bz2
	9fs sources
	chmod +t plan9.tar.bz2
	mv plan9.tar.bz2 /n/sources/extra/plan9.tar.bz2