aboutsummaryrefslogtreecommitdiff
path: root/git/sec
blob: 01b1e3413f9ffb544649cdb0bc6692fdee9e2780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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