aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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