shithub: iso

ref: 3f41864567637e51424fa721078604eec88628b3
dir: /bin/buildisos.rc/

View raw version
#!/bin/rc -e
rfork en

home=/usr/build
webfs

cd $home/code/plan9front

archs=(amd64 386 arm arm64 spim)

www=$home/www/9front
wwwt=$home/www/torrent

. ./sys/lib/rootstub
. ./sys/lib/rootbind

# preclean
cd /sys/src
mk clean
cd /sys/src/boot
mk clean
cd /sys/src/9
mk clean

# build for cputype
cd /sys/src
mk install

# build everything
for(i in $archs)@{
	rfork en

	objtype=$i
	bind -c /n/src9/$i /$i

	# user
	cd /sys/src
	mk nuke
	mk libs
	mk install

	# kernel
	switch($objtype){
	case amd64
		cd /sys/src/9/pc64
		mk clean
		mk install
		mk clean
	case 386
		cd /sys/src/9/pc
		mk clean
		mk install
		mk clean
	case arm
		cd /sys/src/9/bcm
		mk clean
		mk 'CONF=pi' install
		mk 'CONF=pi2' install
		mk clean
	case arm64
		cd /sys/src/9/bcm64
		mk clean
		mk 'CONF=pi3' install
		mk 'CONF=pi4' install
		mk clean
		cd /sys/src/9/imx8
		mk clean
		mk 'CONF=reform' install
		mk clean
		cd /sys/src/9/arm64
		mk install
		mk clean
	case spim
		cd /sys/src/9/mt7688/
		mk clean
		mk install
		mk clean
	}

	# bootloader
	switch($objtype){
	case 386 amd64
		cd /sys/src/boot/pc
		mk clean
		mk install
		mk clean
		cd /sys/src/boot/efi
		mk clean
		mk install
		mk clean
	case arm arm64
		cd /sys/src/boot/bcm
		mk clean
		mk
		cd /sys/src/boot/reform
		mk clean
		mk
		cd /sys/src/boot/qemu
		mk clean
		mk
	}
}

# postclean
cd /sys/src
mk clean
cd /sys/src/9
mk clean

# make manpage indices
cd /sys/man
mk

fn mkdist {
	mk $www/$release.$1.gz
	ip/torrent -c -w http://iso.only9fans.com/9front/$release.$1.gz \
		-t udp://tracker.opentrackr.org:1337/announce \
		$www/$release.$1.gz > $wwwt/$release.$1.torrent
}

cd /sys/lib/dist
for(a in $archs){
	switch($a){
	case amd64
		mkdist amd64.iso
		mkdist amd64.qcow2
	case 386
		mkdist 386.iso
	case arm
		mkdist pi.img
	case arm64
		mkdist pi3.img
		mkdist reform.img
		mkdist arm64.qcow2
	}
}