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

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


#!/bin/rc

#update plan9.ini

cp /tmp/configfiles/plan9.ini /tmp/configfiles/plan9.ini.tmp
INICHOICE=blank

echo 'UPDATE PLAN9.INI'

while (! ~ $INICHOICE 'q') {
echo '(1) change sysname defaults'
echo '(2) change boot option number default'
echo '(3) change venti server default'
echo '(v) view current state'
echo '(s) save changes'
echo '(q) quit'

INICHOICE = `{read}

switch($INICHOICE){
case 1
	echo '1. change name of current system to another in all appearances'
	echo '2. change name of any system in appearing in plan9.ini to aother (use sysname=ask for a prompt with 9gcpuf kernel)'
	SYSCHOICE=`{read}
	switch($SYSCHOICE){
		case 1
			echo 'enter new system name'
			NEWSYSNAME=`{read}
			cat /tmp/configfiles/plan9.ini.tmp |sed s/$sysname/$NEWSYSNAME/g >/tmp/configfiles/newplan9.ini.tmp
			mv /tmp/configfiles/newplan9.ini.tmp /tmp/configfiles/plan9.ini.tmp
		case 2
			echo 'enter old systen name to change'
			OLDNAME=`{read}
			echo 'enter new system name'
			NEWSYSNAME=`{read}
			cat /tmp/configfiles/plan9.ini.tmp |sed s/$OLDNAME/$NEWSYSNAME/g >/tmp/configfiles/newplan9.ini.tmp
			mv /tmp/configfiles/newplan9.ini.tmp /tmp/configfiles/plan9.ini.tmp
	}
case 2
	echo 'enter new name of menudefault item'
	NEWBOOT=`{read}
	OLDBOOT=`{grep menudefault /tmp/configfiles/plan9.ini.tmp | awk '{print $1}'}
	NEWBOOT='menudefault='$NEWBOOT','
	echo replacing $OLDBOOT with $NEWBOOT
	cat /tmp/configfiles/plan9.ini.tmp |sed s/$OLDBOOT/$NEWBOOT/g >/tmp/configfiles/newplan9.ini.tmp
	mv /tmp/configfiles/newplan9.ini.tmp /tmp/configfiles/plan9.ini.tmp
case 3
	echo 'enter new venti dialstring'
	NEWVENTI=`{read}
	grep venti /tmp/configfiles/plan9.ini.tmp |grep -v ask >/tmp/configfiles/newplan9.ini.tmp
	OLDVENTI=`{tail -n 1 /tmp/configfiles/newplan9.ini.tmp}
	NEWVENTI='venti='$NEWVENTI
	echo replacing $OLDVENTI with $NEWVENTI
	cat /tmp/configfiles/plan9.ini.tmp |sed s/$OLDVENTI/$NEWVENTI/g >/tmp/configfiles/newplan9.ini.tmp
	mv /tmp/configfiles/newplan9.ini.tmp /tmp/configfiles/plan9.ini.tmp
case v
	cat /tmp/configfiles/plan9.ini.tmp
case s
	echo overwriting /n/9fat/plan9.ini
	cp /tmp/configfiles/plan9.ini.tmp /n/9fat/plan9.ini
case *
	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.