~pixelherodev/ANTS

2983aef452f386128e953ac136c44bbc138e4f18 — Noam Preil 11 months ago 5eae0c5
installer: ANTS changes. DEPENDS ON tools.tgz
M rc/bin/inst/bootsetup => rc/bin/inst/bootsetup +21 -2
@@ 35,18 35,34 @@ case go
	if(! test -f /tmp/plan9.ini) {
		@{
			echo 'bootfile='^$bootfile
			echo 'bootcmd=plan9rc'
			echo 'bootargs=local!'^$fs' '$"fsflags
			if(~ $ethermethod manual){
				echo 'ipaddress='^$ipaddr
				echo 'gateway='^$gwaddr
				echo 'ipmask='^$ipmask
			}
			if(~ $#password 1)
				echo 'privpassword='^$password
			if(~ $authservice yes)
				echo 'service=cpu'
			if(~ $#nvram 1)
				echo 'nvram='^$nvram
			if(~ $fstype venti)
				echo 'venti='$fsarenas |sed 's/\/dev/#S/'
			if(~ $fstype fossil)
				if(! ~ $ventidial none)
					echo 'venti='$ventidial
			echo 'mouseport='^$mouseport
			echo 'monitor='^$monitor
			echo 'vgasize='^$vgasize
			echo 'sysname='^$sysname
			cd '#ec'
			for(i in *){
				echo -n $"i'='
				cat $i
				echo
			} | grep -v '(apm0|e820|bootfile|bootargs|bootscreen|nvram|mouseport|monitor|vgasize|cdboot)'
			} | grep -v '(apm0|e820|bootfile|bootargs|bootcmd|bootscreen|nvram|mouseport|monitor|vgasize|cdboot|tgzfs)'
		} >/tmp/plan9.ini
	}



@@ 93,7 109,10 @@ case go
	logprog cp /tmp/plan9.ini /n/9fat/plan9.ini

	# copy kernel
	logprog cp /n/newfs/$cputype/$bootfile /n/9fat/
	logprog cp /n/newfs/$cputype/$bootfile /n/9fat/$bootfile

	# copy tools.tgz
	logprog cp /n/newfs/$cputype/tools.tgz /n/9fat/tools.tgz

	# copy efi bootloader
	logprog mkdir -p /n/9fat/efi/boot

M rc/bin/inst/configfs => rc/bin/inst/configfs +11 -3
@@ 4,7 4,7 @@

switch($1){
case checkdone
	if(~ $#fstype 1 && test -f /bin/$fstype)
	if(~ $#fstype 1 && test -e /bin/$fstype)
		configfs=done
	if not
		configfs=ready


@@ 13,10 13,18 @@ case checkdone
case go
	echo 'You can install the following types of file systems:'
	echo
	echo '	cwfs64x	the cached-worm file server'
	echo '	venti	Venti archive  + Fossil fs (20gb minimum)'
	echo '	cwfs64x	the cached-worm file server (20gb minimum)'
	echo '	hjfs	the new 9front file server (experimental!)'
	echo '	fossil	fossil alone (should be used with remote venti)'
	echo '	ants	venti+fossil ants colony partitioning'
	echo
	prompt -d cwfs64x 'File system' cwfs64x hjfs
	prompt -d venti 'File system' venti cwfs64x hjfs fossil ants
	fstype=$rd
	if(~ $fstype ants){
		fstype=venti
		multifossil=yes
	}
	export fstype
	export multifossil
}

M rc/bin/inst/copydist => rc/bin/inst/copydist +7 -1
@@ 17,7 17,13 @@ case checkready
	}
case go
	rm -f /tmp/copydone
	disk/mkfs -z 16372 -U -s /n/dist -d /n/newfs /sys/lib/sysconfig/proto/allproto
	prompt -d yes 'Copy the distribution to the fs now?' yes no
	copynow=$rd
	if(~ $copynow yes)
		disk/mkfs -z 16372 -U -s /n/dist -d /n/newfs /sys/lib/sysconfig/proto/allproto
		cat /n/newfs/sys/src/ants/.hg/hgrc >/tmp/hgrc
		rm /n/newfs/sys/src/ants/.hg/hgrc
		cp /tmp/hgrc /n/newfs/sys/src/ants/.hg/hgrc
	touch /tmp/copydone

case checkdone

A rc/bin/inst/fossil.conf => rc/bin/inst/fossil.conf +4 -0
@@ 0,0 1,4 @@
fsys main open -c 3000
fsys main snaptime -a 0500
srv -p fscons
srv -A fossil

A rc/bin/inst/initfossil.conf => rc/bin/inst/initfossil.conf +10 -0
@@ 0,0 1,10 @@
fsys main open -AWPV
fsys main
create /active/adm adm sys d775
create /active/adm/users adm sys 664
users -w
uname upas :upas
uname adm +glenda
uname upas +glenda
srv -p fscons.newfs
srv -A fossil.newfs

M rc/bin/inst/main => rc/bin/inst/main +1 -0
@@ 20,6 20,7 @@ tasks=(\
	mountdist\
	download\
	copydist\
	pwsetup\
	ndbsetup\
	tzsetup\
	bootsetup\

A rc/bin/inst/mountfossil => rc/bin/inst/mountfossil +71 -0
@@ 0,0 1,71 @@
#!/bin/rc

# desc: choose and mount file system partition

sname=fossil.newfs

switch($1){
case go
	echo
	echo Please choose drive with fossil partition
	echo

	files=(`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null})
	if(! ~ $#files 0)
		ls -l $files
	echo
	if(~ $#files 1)
		default=(-d $files)
	if not
		default=()
	prompt $default 'Fossil partition' $files
	fs=$rd
	export fs
	fsflags=()
	export fsflags

	prompt -d none 'Dialstring for remote venti server?'
	ventidial=$rd
	export ventidial

	if(! test -f $fs){
		echo 'Fossil partition not found!'
		mountfs=ready
		export mountfs
		exit oops
	}

	echo fsys main config $fs >/tmp/initfossil.conf
	cat initfossil.conf >>/tmp/initfossil.conf
	echo fsys main config $fs >/tmp/fossil.conf
	if (~ $ventidial none)
		echo 'fsys main open -V -c 3000' >>/tmp/fossil.conf
	if not
		echo 'fsys main open -c 3000' >>/tmp/fossil.conf
	echo 'srv -p fscons' >>/tmp/fossil.conf
	echo 'srv -A fossil' >>/tmp/fossil.conf 

	log Starting $fstype file server for $fs
	unmount /n/newfs >[2]/dev/null

	fossil/flfmt $fs
	fossil/conf -w $fs /tmp/initfossil.conf
	fossil/fossil -f $fs
	fossil/conf -w $fs /tmp/fossil.conf

	log Mounting $fstype file server for $fs
	while(! logprog mount -c /srv/$sname /n/newfs)
		sleep 2

case checkready checkdone
	if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){
		if(test -f /srv/$sname && test -d /n/newfs/adm){
			mountfs=done
			export mountfs
			exit
		}
	}
	mountfs=ready
	export mountfs
	exit
}

M rc/bin/inst/mountfs => rc/bin/inst/mountfs +4 -0
@@ 4,6 4,10 @@
# prereq: configfs

switch($fstype){
case venti
	exec ./mountventifossil $*
case fossil
	exec ./mountfossil $*
case cwfs cwfs64 cwfs64x
	exec ./mountcwfs $*
case hjfs

A rc/bin/inst/mountventifossil => rc/bin/inst/mountventifossil +106 -0
@@ 0,0 1,106 @@
#!/bin/rc

# desc: choose and mount file system partition

sname=fossil.newfs

switch($1){
case go
	echo
	echo Please choose drive with fossil and venti arenas+isect partitions
	echo

	files=(`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null})
	if(! ~ $#files 0)
		ls -l $files
	echo
	if(~ $#files 1)
		default=(-d $files)
	if not
		default=()
	prompt $default 'Fossil partition' $files
	fs=$rd
	export fs
	fsflags=()
	export fsflags

	files=(`{ls /dev/sd*/arenas* /dev/fs/arenas* >[2]/dev/null})
	if(! ~ $#files 0)
		ls -l $files
	echo
	if(~ $#files 1)
		default=(-d $files)
	if not
		default=()
	prompt $default 'Venti arenas partition' $files
	fsarenas=$rd
	export fsarenas

	files=(`{ls /dev/sd*/isect* /dev/fs/isect* >[2]/dev/null})
	if(! ~ $#files 0)
		ls -l $files
	echo
	if(~ $#files 1)
		default=(-d $files)
	if not
		default=()
	prompt $default 'Venti isect partition' $files
	fsisect=$rd
	export fsisect

	if(! test -f $fs){
		echo 'Fossil partition not found!'
		mountfs=ready
		export mountfs
		exit oops
	}
	if(! test -f $fsarenas){
		echo 'Venti arenas partition not found!'
		mountfs=ready
		export mountfs
		exit oops
	}
	if(! test -f $fsisect){
		echo 'Venti isect partition not found!'
		mountfs=ready
		export mountfs
		exit oops
	}

	echo fsys main config $fs >/tmp/initfossil.conf
	cat initfossil.conf >>/tmp/initfossil.conf
	echo fsys main config $fs >/tmp/fossil.conf
	cat fossil.conf >>/tmp/fossil.conf
	echo index main >/tmp/venti.conf
	echo arenas $fsarenas >>/tmp/venti.conf
	echo isect $fsisect >>/tmp/venti.conf
	cat venti.conf >>/tmp/venti.conf

	log Starting fossil file server for $fs
	unmount /n/newfs >[2]/dev/null

	fossil/flfmt $fs
	fossil/conf -w $fs /tmp/initfossil.conf
	fossil/fossil -f $fs
	fossil/conf -w $fs /tmp/fossil.conf
	venti/fmtarenas arenas $fsarenas
	venti/fmtisect isect $fsisect
	venti/fmtindex /tmp/venti.conf
	venti/conf -w $fsarenas /tmp/venti.conf

	log Mounting fossil file server for $fs
	while(! logprog mount -c /srv/$sname /n/newfs)
		sleep 2

case checkready checkdone
	if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){
		if(test -f /srv/$sname && test -d /n/newfs/adm){
			mountfs=done
			export mountfs
			exit
		}
	}
	mountfs=ready
	export mountfs
	exit
}

M rc/bin/inst/ndbsetup => rc/bin/inst/ndbsetup +16 -0
@@ 25,6 25,18 @@ case go
	prompt $default 'sysname'
	sysname=$rd

	if(~ $authservice yes){
		if(~ $ipaddr xxx){
			echo
			authip=`{. /net/ndb; echo $ip}
			default=(-d $authip)
			prompt $default 'Enter ip address for auth services'
			authip=$rd
		}
		if not
			authip=$ipaddr
	}

	cp /n/newfs/lib/ndb/local /tmp/ndb.local
	{
		ssam 'x/^.*ether='^$etheraddr^'.*$/ d' /tmp/ndb.local


@@ 35,8 47,12 @@ case go
		switch($ethermethod){
		case automatic
			echo $se
			if(~ $authservice yes)
				echo '	ip='^$authip ' '$ndbauthdom ' auth='^$sysname
		case manual
			echo $se 'ip='^$ipaddr 'ipmask='^$ipmask 'ipgw='^$gwaddr
			if(~ $authservice yes)
				echo '	'^$ndbauthdom ' auth='^$sysname
			if(! ~ $#DNSSERVER 0){
				echo '	'	'dns='^$DNSSERVER
			}

M rc/bin/inst/prepdisk => rc/bin/inst/prepdisk +8 -1
@@ 5,6 5,10 @@

fn autotype {
	switch($fstype){
	case venti
		echo -a 9fat -a nvram -a fossil -a arenas -a isect
	case fossil
		echo -a 9fat -a nvram -a fossil
	case cwfs cwfs64 cwfs64x
		echo -a 9fat -a nvram -a fscache -a fsworm -a other
	case hjfs


@@ 39,7 43,10 @@ case go
	echo 'If it is not yet subdivided, a sensible layout will be suggested;'
	echo 'you can probably just type ''w'' and then ''q''.'
	echo
	disk/prep `{autotype} $disk
	if(~ $multifossil yes)
		cat spawn.prep | disk/prep $disk
	if not
		disk/prep `{autotype} $disk
	disk/prep -p $disk >`{basename -d $disk}^/ctl >[2]/dev/null

case checkdone

A rc/bin/inst/pwsetup => rc/bin/inst/pwsetup +41 -0
@@ 0,0 1,41 @@
#!/bin/rc

# desc: choose password and cpu server option

switch($1){
case checkdone
	if(~ $#password 1 || ~ $#ndbauthdom 1)
		pwsetup=done
	if not
		pwsetup=ready
	export pwsetup
case go
	echo
	echo 'Setup Password'
	echo

	prompt -d no 'Configure as cpu/auth server with no gui?' no yes
	authservice=$rd
	export authservice

	switch($authservice){
	case no
		prompt 'Secure password for remote access: '
		password=$rd
		export password
	case yes
		echo 'Enter hostowner password info for nvram machine key.'
		echo 'You will need to use this same password for the keyfs.'
		echo 'The authid: MUST be set to glenda.'

		auth/factotum -S
	
		echo 'Enter password for keyfs. This MUST be the same password you just entered.'

		auth/keyfs /n/newfs/adm/keys
		auth/changeuser glenda
		factkey=`{cat /mnt/factotum/ctl |grep dp9ik}
		ndbauthdom=`{echo $factkey(4) |sed 's/dom/authdom/'}
		export ndbauthdom
	}
}

A rc/bin/inst/spawn.prep => rc/bin/inst/spawn.prep +10 -0
@@ 0,0 1,10 @@
a 9fat 0 204800
a nvram 204800 204801
. 204801
a fossil . .+10%
a fossil2 . .+5%
a fossil3 . .+5%
a isect . .+4%
a arenas . $
w
q

A rc/bin/inst/spawnbig.prep => rc/bin/inst/spawnbig.prep +12 -0
@@ 0,0 1,12 @@
a 9fat 0 204800
a nvram 204800 204801
. 204801
a fossil . .+8%
a fossil2 . .+3%
a fossil3 . .+3%
a fossil4 . .+3%
a fossil5 . .+3%
a isect . .+4%
a arenas . $
w
q

A rc/bin/inst/venti.conf => rc/bin/inst/venti.conf +5 -0
@@ 0,0 1,5 @@
mem 32m
bcmem 48m
icmem 64m
httpaddr tcp!127.0.0.1!8000
addr tcp!127.0.0.1!17034