summaryrefslogtreecommitdiffstats
path: root/setup
blob: 76eb68dca3de8cd8c957b1ffa0893f6b7e221a24 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh

set -e
umask 022
prog=setup
binfiles='genpkg prepkg modpkg pbfields putpkgtree getpkgtree
	injectdigs vervar'
preps='perl perl.d/
	perl.d/fetchcpan perl.d/perl-dist perl.d/perl-pkgbuild
	perl.d/scrapecore'

md()
{
	d="$1"
	case "$d" in
	'')	return 1 ;;
	*/)	;;
	*)	d="$d/" # mostly for pretty printing
	esac
	[ -d "$d" ] || mkdir -p "$d"
	echo "$d"
}

ins()
{
	case "$1" in
	*/)	md "$2/$1" ;;
	*)	install -m 755 "$1" "$2/$1"
		echo "$2/$1"
	esac
}

case "$1" in
'')	cat <<EOF 1>&2
Run "$prog genpkg" to install genpkg & friends into ~/genpkg and ~/bin.
Run "$prog mods" to install mods into ~/pkg/mods.
EOF
	;;
genpkg)
	md ~/bin
	for pkg in $binfiles
	do
		ins "bin/$pkg" ~
	done

	md ~/.genpkg
	md ~/.genpkg/preps
	for p in $preps
	do
		ins "preps/$p" ~/.genpkg
	done
	md ~/.genpkg/var
	;;
mods)
	md ~/pkg/mods/
	for m in mods/*
	do
		cp "$m" ~/pkg/"$m"
		echo ~/pkg/"$m"
	done
	;;
*)	echo "$prog: unrecognized argument: $1" 1>&2
	exit 1
esac

exit 0