diff options
author | John Ankarström <john@ankarstrom.se> | 2021-07-21 13:45:00 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-07-21 13:45:00 +0200 |
commit | 10706a55adb3c5f12fb1438ef9990ee01b9266d2 (patch) | |
tree | 58e447a42ae6c6fddcd4d95c101a23040a8ca8ae | |
parent | 003f1a28b52ef0322975329d086920cf24828ac7 (diff) | |
download | rbsd-10706a55adb3c5f12fb1438ef9990ee01b9266d2.tar.gz |
Remove /git/sec, create more general /git/set instead
-rwxr-xr-x | git/sec | 19 | ||||
-rwxr-xr-x | git/set | 21 |
2 files changed, 21 insertions, 19 deletions
diff --git a/git/sec b/git/sec deleted file mode 100755 index 01b1e34..0000000 --- a/git/sec +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 @@ -0,0 +1,21 @@ +#!/bin/sh -e + +setting=$1 +shift +value=$1 +shift + +if [ $# -eq 0 ]; then + echo "usage: $0 setting value dir ..." 1>&2 + exit 1 +fi + +for d in "$@"; do + if [ -e "$d"/cgitrc ]; then + grep ^"$setting"= "$d"/cgitrc >/dev/null && + sed -i "s ^$setting=.* $setting=$value " "$d"/cgitrc || + echo "$setting=$value" >> "$d"/cgitrc + else + echo "$setting=$value" > "$d"/cgitrc + fi +done |