From f042c1f3d2c28b12bcceb5c21481514eeb628650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 20 Jul 2021 21:44:04 +0200 Subject: Add /git/sec script --- git/sec | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 git/sec 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 -- cgit v1.2.3