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 | |
parent | f3fd330cddade1c66d0f101d5cc6f657c4cd1bb6 (diff) | |
download | plan9-51b5b02f52cc6f314029f3f2fe97afdc26ba0f25.tar.gz |
Add various patches
Diffstat (limited to 'patch/patch-update')
-rw-r--r-- | patch/patch-update/email | 1 | ||||
-rw-r--r-- | patch/patch-update/files | 1 | ||||
-rw-r--r-- | patch/patch-update/notes | 0 | ||||
-rw-r--r-- | patch/patch-update/readme | 8 | ||||
-rwxr-xr-x | patch/patch-update/update | 35 |
5 files changed, 45 insertions, 0 deletions
diff --git a/patch/patch-update/email b/patch/patch-update/email new file mode 100644 index 0000000..191feb6 --- /dev/null +++ b/patch/patch-update/email @@ -0,0 +1 @@ +john@ankarstrom.se diff --git a/patch/patch-update/files b/patch/patch-update/files new file mode 100644 index 0000000..d37e166 --- /dev/null +++ b/patch/patch-update/files @@ -0,0 +1 @@ +/rc/bin/patch/update update diff --git a/patch/patch-update/notes b/patch/patch-update/notes new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/patch/patch-update/notes diff --git a/patch/patch-update/readme b/patch/patch-update/readme new file mode 100644 index 0000000..8681f72 --- /dev/null +++ b/patch/patch-update/readme @@ -0,0 +1,8 @@ +patch/update updates given file(s) in given patch + +I often make small changes, like fixing formatting, +to files in patches that I've already put in /n/sources/patch. + +If /n/sources/patch is accessible to the outside world, +then patch/update might not be a good idea, but I have +/n/sources/patch bound to a patch directory in $home. 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 +} |