new sorry mechanism. Reference: /n/atom/patch/applied/apatchsorry Date: Sat Feb 22 16:05:21 CET 2014 Signed-off-by: quanstro@quanstro.net --- /rc/bin/apatch/sorry Thu Jan 1 00:00:00 1970 +++ /rc/bin/apatch/sorry Sat Feb 22 16:04:24 2014 @@ -0,0 +1,32 @@ +#!/bin/rc + +rfork e +. /rc/bin/apatch/defs +mountfs -a +mountdist -w # writable + +test -e /n/dist/lib/patch.skip && bind /dev/null /n/dist/lib/patch.skip +test -e /n/dist/lib/patch.skipfile && bind /dev/null /n/dist/lib/patch.skipfile + +errs=/tmp/sorry.$pid +if($patch/·sorry $* |[2] tee $errs){ + if(test -d $PD/$*.*){ + echo '#you could:' + echo rm -rf $PD/$patch.* + } + echo patch has been sorry''''d. emailing... + u=`{cat $PD/sorry/$1/email|grep -v '^-$'} + + # gross + if(~ $u quanstro@quanstro.net) + u=() + + @{builtin cd $PD/sorry/$1 && $patch/diffemail; echo ------; cat $errs} | + mail -s 'sorry patch: '^$PD/sorry/$1 $M $u + rm -f $errs +} + +# if(test -x /sys/lib/dist/update){ +# echo '#run this to update the replica db.' +# echo '# /sys/lib/dist/update' +# } --- /rc/bin/apatch/·sorry Thu Jan 1 00:00:00 1970 +++ /rc/bin/apatch/·sorry Sat Feb 22 16:04:24 2014 @@ -0,0 +1,25 @@ +#!/bin/rc + +rfork e +. /rc/bin/apatch/defs + +args='patch-name' +flagfmt='' +if(! eval `'' {aux/getflags $*} || ! ~ $#* 1){ + aux/usage + exit usage +} +mountfs -a +mountdist -w # writable + +d=$PD/$1 +if(! $patch/okay $d){ + echo 'bad patch: '$status >[1=2] + exit badpatch +} + +echo /dist/patch/$1 +$patch/readfile >> $d/notes +echo moving to sorry ... >[1=2] +mkdir $PD/sorry/$1 && dircp $PD/$1 $PD/sorry/$1 && rm -r $PD/$1 +echo done>[1=2] --- /rc/bin/apatch/readfile Thu Jan 1 00:00:00 1970 +++ /rc/bin/apatch/readfile Sat Feb 22 16:04:24 2014 @@ -0,0 +1,9 @@ +#!/bin/rc +if(~ `{cat /proc/$pid/fd | awk 'NR==2{print $NF}'} */dev/cons && test -w /dev/consctl){ + >/dev/consctl { + echo holdon + cat + } +} +if not + cat