aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-20 21:44:04 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-20 21:44:58 +0200
commitf042c1f3d2c28b12bcceb5c21481514eeb628650 (patch)
tree8244768ea8d651208800e93c574a66664b79e810
parent78d047863a86933693470a70ef6c0e6e07ecd4c5 (diff)
downloadrbsd-f042c1f3d2c28b12bcceb5c21481514eeb628650.tar.gz
Add /git/sec script
-rwxr-xr-xgit/sec19
1 files changed, 19 insertions, 0 deletions
diff --git a/git/sec b/git/sec
new file mode 100755
index 0000000..01b1e34
--- /dev/null
+++ b/git/sec
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+
+sec=$1
+shift
+
+if [ -e "$sec" ] || [ -z "$sec" ]; then
+ echo "usage: $0 section dir ..." 1>&2
+ exit 1
+fi
+
+for d in "$@"; do
+ if [ -e "$d"/cgitrc ]; then
+ grep ^section= "$d"/cgitrc >/dev/null &&
+ sed -i 's/^section=.*/section='"$sec"'/' "$d"/cgitrc ||
+ echo section="$sec" >> "$d"/cgitrc
+ else
+ echo section="$sec" > "$d"/cgitrc
+ fi
+done