summaryrefslogtreecommitdiffstats
path: root/bin/putpkgtree
blob: f4151087ca6df7495ad16f9e4d07ca80fd080235 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

prog=putpkgtree

err()
{
	code="$1"
	shift
	echo $@ 1>&2
	exit "$code"
}

if [ "$#" -ne 3 ]
then
	echo "usage: $prog [file] [section] ['beg'/'body'/'end'] < [text to append]" 1>&2
	exit 2
fi

[ -d "$1" ] || err 101 "$prog: package file does not exist: $1"
cd "$1"

[ -d "$2" ] || err 102 "$prog: section does not exist: $2" 1>&2
cd "$2"

[ -f "$3" ] || err 103 "$prog: subsection does not exist: $3"
cat >> "$3"