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

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


#!/bin/rc

#help update /lib/ndb/local

cp /tmp/configfiles/libndb/local /tmp/configfiles/libndblocal.tmp

NDBCHOICE=blank
while (! ~ $NDBCHOICE 'q'){

echo 'lib/ndb configuration updater'
echo '(1) Change authdom information'
echo '(2) Change IPs'
echo '(3) Change system names'
echo '(4) Add new system'
echo '(v) View current config state'
echo '(s) Save changes'
echo '(q) quit'
FOSCHOICE=`{read}

switch($FOSCHOICE){
case 1
	echo 'name of authdom to change?'
	OLDAUTHDOM = `{read}
	echo 'name of new authdom?'
	NEWAUTHDOM = `{read}
	cat /tmp/configfiles/libndblocal.tmp |sed s/$OLDAUTHDOM/$NEWAUTHDOM/g >/tmp/configfiles/newlibndblocal.tmp
	mv /tmp/configfiles/newlibndblocal.tmp /tmp/configfiles/libndblocal.tmp
case 2
	echo 'IP to change?'
	OLDIP = `{read}
	echo 'new IP?'
	NEWIP = `{read}
	cat /tmp/configfiles/libndblocal.tmp |sed s/$OLDIP/$NEWIP/g >/tmp/configfiles/newlibndblocal.tmp
	mv /tmp/configfiles/newlibndblocal.tmp /tmp/configfiles/libndblocal.tmp
case 3
	echo 'name of system to change?'
	OLDSYS = `{read}
	echo 'new system name?'
	NEWSYS = `{read}
	cat /tmp/configfiles/libndblocal.tmp |sed s/$OLDSYS/$NEWSYS/g >/tmp/configfiles/newlibndblocal.tmp
	mv /tmp/configfiles/newlibndblocal.tmp /tmp/configfiles/libndblocal.tmp
case 4
	echo 'new system ip?'
	ADDIP = `{read}
	echo 'new system name?'
	ADDSYS = `{read}
	echo 'new system authdom?'
	ADDAUTHDOM =`{read}
	echo 'new system auth server? (often the same as system name for standalone systems)'
	ADDAUTH=`{read}
	echo '' >>/tmp/configfiles/libndblocal.tmp
	echo 'ip='$ADDIP' sys='$ADDSYS' authdom='$ADDAUTHDOM' auth='$ADDAUTH >>/tmp/configfiles/libndblocal.tmp
case v
	cat /tmp/configfiles/libndblocal.tmp
case s
	mv /tmp/configfiles/libndblocal.tmp /lib/ndb/local
case q
	exit
}
}
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 [email protected].