remount dist if permissions aren't appropriate to save annoyance Reference: /n/atom/patch/applied2013/distperms Date: Wed Jun 26 03:09:07 CES 2013 Signed-off-by: quanstro@quanstro.net --- /rc/bin/apatch/defs Wed Jun 26 03:08:31 2013 +++ /rc/bin/apatch/defs Wed Jun 26 03:08:31 2013 @@ -1,6 +1,6 @@ P=atom S=atom -M=sources@9atom.org +M=(sources@9atom.org) MS=sources@9atom.org PD=/n/$P/patch SD=/n/$S/plan9 @@ -20,15 +20,26 @@ } } +fn canwrite { + { + touch $1 && + rm -f $1 + } >[2]/dev/null +} + fn mountdist { test -e /n/dist/386 || bind $SD /n/dist || fail no dist test -e /n/dist/386 || fail /root/386 does not exist if(~ $1 -w){ - { - touch /n/dist/lib/xxx && - rm -f /n/dist/lib/xxx - } >[2]/dev/null || fail no permission to write /n/dist/lib + canwrite /n/dist/lib/xxx || { + # try to remount + unmount /n/$P || fatal remount + mountfs -a || fail mountfs + bind $SD /n/dist || fail no dist + test -e /n/dist/386 || fail /root/386 does not exist + canwrite /n/dist/lib/xxx || fail no permission to write /n/dist/lib + } } } @@ -49,4 +60,11 @@ fn must { $* || fail $* +} + +fn applyxxx { + if(! ~ $#* 0 && test -e $1) + grep -v -f $1 | sed 's/^../xxx &/' | rc + if not + sed 's/^../xxx &/' | rc }