Plan 9 from Bell Labs’s /usr/web/sources/contrib/mycroftiv/unreleased/confighelper/taskassistant

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

# metatask assistant for qemu vm image management

echo 'task assistant for qemu grid VMs'
echo 'currently supported: add system to grid'
echo 'step 1: update current /lib/ndb/local and /cfg with new system'
echo 'step 2: create custom plan9.ini for new system'
echo 'step 3: force filesystem snapshot to save added information'
echo 'step 4: clone fossil to new system and create 9fat with new plan9.ini'
echo 'new system name?'
NEWSYSNAME=`{read}
echo 'new system ip?'
NEWSYSIP=`{read}
echo 'new system authdom? (you probably want this to be the same as your current and other systems)'
NEWAUTHDOM=`{read}
echo 'new system auth server? (often the same as system name for standalone systems)'
NEWAUTH=`{read}
echo 'new system venti dialstring? leave blank for tcp!127.0.0.1!17034'
NEWVENTI=`{read}
if (~ $NEWVENTI '') {
	NEWVENTI = 'tcp!127.0.0.1!17034'
}
echo 'configuration to clone? (? to see a list of available)'
NEWCFG=`{read}
if (~ $NEWCFG '?'){
	ls /cfg
	echo 'configuration to clone?'
	NEWCFG=`{read}
}
echo 'adding new system to grid and forcing filesystem snapshot.'
touch /tmp/configfiles/newsysscript
echo 5 >/tmp/configfiles/newsysscript
echo $NEWCFG >>/tmp/configfiles/newsysscript
echo $NEWSYSNAME >>/tmp/configfiles/newsysscript
echo 4 >>/tmp/configfiles/newsysscript
echo 4 >>/tmp/configfiles/newsysscript
echo $NEWSYSIP >>/tmp/configfiles/newsysscript
echo $NEWSYSNAME >>/tmp/configfiles/newsysscript
echo $NEWAUTHDOM >>/tmp/configfiles/newsysscript
echo $NEWAUTH >>/tmp/configfiles/newsysscript
echo s >>/tmp/configfiles/newsysscript
echo q >>/tmp/configfiles/newsysscript
echo 1 >>/tmp/configfiles/newsysscript
echo 1 >>/tmp/configfiles/newsysscript
echo 1 >>/tmp/configfiles/newsysscript
echo $NEWSYSNAME >>/tmp/configfiles/newsysscript
echo 3 >>/tmp/configfiles/newsysscript
echo $NEWVENTI >>/tmp/configfiles/newsysscript
echo q >>/tmp/configfiles/newsysscript
echo q >>/tmp/configfiles/newsysscript
confighelper </tmp/configfiles/newsysscript >[2=1] >/dev/null

cp /tmp/configfiles/plan9.ini.tmp /tmp/configfiles/plan9.ini
echo 'fsys main snap -a' >>/srv/fscons
echo 'filesystem snapshot started, please wait for it to complete to continue'
echo 'yeah, this script should really help you with knowing how long to wait, sorry.'
echo 'press enter to continue when ready (tip: check fscons for a vac: score to verify completeion)'
continue=`{read}

fossil/last /dev/sdC0/fossil >/tmp/configfiles/fossillast
9fat:
disk/mbr -m /386/mbr /dev/sdC1/data
disk/fdisk -baw /dev/sdC1/data
disk/prep -bw -a^(9fat nvram fossil swap) /dev/sdC1/plan9
disk/format -b /386/pbslba -d -r 2 /dev/sdC1/9fat /n/9fat/9load /n/9fat/9pcf /n/9fat/9pccpuf /n/9fat/9gcpuf /tmp/configfiles/plan9.ini
cp /dev/sdC0/nvram /dev/sdC1/nvram
OLDFOSSIL=`{cat /tmp/configfiles/fossillast |awk -F : '{print $2}'}
fossil/flfmt -v $OLDFOSSIL /dev/sdC1/fossil
fossil/conf /dev/sdC0/fossil | fossil/conf -w /dev/sdC1/fossil

echo 'ok in theory /dev/sdC1/should be a new customized system and it and this system should know each other'
mv /tmp/configfiles/newsysscript /tmp/configfiles/newsysdone
exit

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.