code: mafs

ref: a6e9ab0ced8523fb8099afa4547dc27793e27462
dir: /build_mafs_isos.rc/

View raw version
#!/bin/rc
rfork en

# a copy of http://felloff.net/usr/cinap_lenrek/buildisos.rc to build
#	9front iso's including mafs
#
# git/clone git://git.9front.org/plan9front/plan9front ../../plan9front_mafs
#
# to write to a usb disk sd6 from openbsd
# dd if=9front_mafs-9589.ba66d8f69edd895682f2661524a1d07612cb9ba8.amd64.iso of=/dev/rsd6c bs=1M

www=`{pwd}
cd ../../plan9front_mafs

#archs=(amd64 386 arm arm64)
archs=(amd64 386)

release=9front_mafs-`{git/log -s | wc -l}^.^`{git/query HEAD}
echo release $release

rm -f $www/$release.*

. ./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 install

	# mafs
	cd $www
	mk install

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

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

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

# make manpage indices
cd /sys/man
mk

# release
#trackers=`{hget https://newtrackon.com/api/live | sed 12q}

#webseeds=(\
#	http://9front.org/iso/ \
#	http://lux.felloff.net/usr/cinap_lenrek/9front/ \
#)

fn mkdist {
	cd /sys/lib/dist
	mk $www/$1.gz
	cd $www
	chmod +t $1 $1.gz
	#ip/torrent -t^$trackers -w^$webseeds -c $1.gz > $1.gz.torrent
}

for(a in $archs){
	switch($a){
	case amd64
		mkdist $release.amd64.iso
	case 386
		mkdist $release.386.iso
	case arm
		mkdist $release.pi.img
	case arm64
		mkdist $release.pi3.img
		mkdist $release.reform.img
	}
}

cd $www