summaryrefslogtreecommitdiffstats
path: root/bin/putpkgtree
blob: 2606460795043a44e326cebcaab93397cd132255 (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
27
28
#!/bin/sh

prog=putpkgtree

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

case "$3" in
beg|body|end) ;;
*)	echo "$prog: third parameter must be 'beg', 'body', or 'end'" 1>&2
	exit 2
esac

if ! [ -d PKGTREE ]
then
	echo "$prog: PKGTREE directory does not exist" 1>&2
	exit 100
fi
cd PKGTREE

[ -d "$1" ] || mkdir "$1"
cd "$1"
[ -d "$2" ] || mkdir "$2"
cd "$2"
cat >> "$3"