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

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


#!/bin/rc

# update fossil configuration

cp /tmp/configfiles/fossil.conf /tmp/configfiles/fossil.conf.tmp

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

echo 'Fossil configuration updater'
echo '(1) Change size of fossil cache'
echo '(2) Turn on or off listen service for net clients'
echo '(v) View current config state'
echo '(s) Save changes'
echo '(q) quit'
FOSCHOICE=`{read}

switch($FOSCHOICE){
case 1
	CURCACHE=`{grep -e -c /tmp/configfiles/fossil.conf.tmp |awk '{print $NF}'}
	echo 'cache is '$CURCACHE' 8k blocks'
	echo 'new block cache number?'
	NEWCACHE=`{read}
	cat /tmp/configfiles/fossil.conf.tmp |sed s/$CURCACHE/$NEWCACHE/ >/tmp/configfiles/newfossil.conf.tmp
	mv /tmp/configfiles/newfossil.conf.tmp /tmp/configfiles/fossil.conf.tmp
case 2
	if (grep listen /tmp/configfiles/fossil.conf.tmp) {
		echo 'listen on, deactivate? y for yes'
		DEACT=`{read}
		if (~ $DEACT y) {
			grep -v listen /tmp/configfiles/fossil.conf.tmp >/tmp/configfiles/newfossil.conf.tmp
			mv /tmp/configfiles/newfossil.conf.tmp /tmp/configfiles/fossil.conf.tmp
		}
	}
	if not {
		echo 'listen off, activate? y for yes'
		ACT=`{read}
		if (~ $ACT 'y') {
			echo 'listen tcp!*!564' >>/tmp/configfiles/fossil.conf.tmp
		}
	}
case v
	cat /tmp/configfiles/fossil.conf.tmp
case s
	fossil/conf -w /dev/sdC0/fossil </tmp/configfiles/fossil.conf.tmp
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 webmaster@9p.io.