diff options
author | John Ankarström <john@ankarstrom.se> | 2021-01-28 21:33:30 +0000 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-01-28 21:33:30 +0000 |
commit | 51b5b02f52cc6f314029f3f2fe97afdc26ba0f25 (patch) | |
tree | 711d1efadeb78ad9b2d9f7b629350358838bc626 /patch/patch-update/update | |
parent | f3fd330cddade1c66d0f101d5cc6f657c4cd1bb6 (diff) | |
download | plan9-51b5b02f52cc6f314029f3f2fe97afdc26ba0f25.tar.gz |
Add various patches
Diffstat (limited to 'patch/patch-update/update')
-rwxr-xr-x | patch/patch-update/update | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/patch/patch-update/update b/patch/patch-update/update new file mode 100755 index 0000000..6d7f2bf --- /dev/null +++ b/patch/patch-update/update @@ -0,0 +1,35 @@ +#!/bin/rc -e + +# patch/update -- update file(s) in patch + +flagfmt=a +args='name file...' +if(! ifs=() eval `{aux/getflags $*} || test $#* -lt 2){ + aux/usage + exit usage +} + +if(! test -d /n/sources/patch){ + rfork n + 9fs sources +} + +d=/n/sources/patch/$1 +shift +if(! test -d $d){ + echo 'no such patch' $d >[1=2] + exit nopatch +} + +for(file in $*){ + src=`{cleanname -d `{pwd} $file} + dst=`{awk '$1 == ENVIRON["src"] { print $2 }' $d/files} + if (~ $dst ''){ + echo $src not found in $d/files -- wrong patch? >[1=2] + exit 'nofile' + } + echo cp $src $d/$dst + cp $src $d/$dst + chmod ug+rw $d/$dst >[2]/dev/null + chmod a+r $d/$dst >[2]/dev/null +} |