#!/bin/rc # THIS FILE IS AUTOMATICALLY GENERATED # FROM /sys/src/cmd/fossil/conf.rc. DO NOT EDIT. # EDITED BY MYCROFTIV # the fossil configuration is stored at the 127kB offset in the disk # and extends for at most 1 kB. rfork e fn usage { echo 'usage: fossilconf [-w] /dev/sdC0/fossil [config]' >[1=2] exit usage } wflag=no while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 --){ switch($1){ case -w wflag=yes case * usage } shift } if(~ $1 --) shift if(~ $wflag no && ! ~ $#* 1) usage if(~ $wflag yes && ! ~ $#* 1 2) usage disk=$1 if(! test -f $disk){ echo 'unknown disk' $1 >[1=2] exit nodisk } fn sigexit { rm -f /tmp/fossilconf.$pid } if(~ $wflag yes){ {echo fossil config; cat $2} >/tmp/fossilconf.$pid || exit oops if(! test -s /tmp/fossilconf.$pid){ echo 'config is empty; will not install' >[1=2] exit emptyconfig } dd -quiet 1 -bs 1024 -count 1 -if $disk -iseek 127 \ >/tmp/_fossilconf.old || exit backup dd -quiet 1 -count 2 >/tmp/fossilconf.$pid || exit dd dd -quiet 1 -bs 1024 -count 1 -if /tmp/fossilconf.$pid \ -trunc 0 -of $disk -oseek 127 || exit dd2 exit 0 } dd -quiet 1 -bs 1024 -count 1 -if $disk -iseek 127 | zerotrunc >/tmp/fossilconf.$pid sed 1d /tmp/fossilconf.$pid exit 0