summaryrefslogtreecommitdiffstats
path: root/setup
blob: 7ed11f4479871084683227be2206f90376ecb4d6 (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
#!/bin/sh

set -e
umask 022
prog=setup
binfiles='genpkg mkpkgmeta modpkg pbfields putpkgtree getpkgtree injectdigs'
metas='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 tweaks" to install tweaks into ~/pkg/tweaks.
EOF
	;;
genpkg)	md ~/bin
	for pkg in $binfiles
	do
		ins "bin/$pkg" ~
	done

	md ~/.genpkg
	md ~/.genpkg/metas
	for m in $metas
	do
		ins "metas/$m" ~/.genpkg
	done
	md ~/.genpkg/var
	;;
tweaks)	md ~/pkg/tweaks/
	for t in tweaks/*
	do
		case $t in *~) continue ;; esac
		echo ~/pkg/"$t"
		cp "$t" ~/pkg/"$t"
	done
	;;
*)	echo "$prog: unrecognized argument: $1" 1>&2
	exit 1
esac

exit 0