summaryrefslogtreecommitdiff
path: root/pkg.sh
blob: b47e895902b28ae6a24ba76ed492395fddb9d4a1 (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
usage() {
		echo ""
		echo "Usage: $0 <add|update> <pkgname>"
		echo ""
		echo "This script wraps the typical AUR creation and update procedures"
		echo ""
		exit 1
}

add_pkg() {
	local pkgname="$1"
	[[ -z $pkgname ]] && usage 

	git remote add -f $pkgname "ssh://aur@aur.archlinux.org/$pkgname.git"
	git merge -s ours --no-commit "$pkgname/master"
	git read-tree "--prefix=$pkgname/" -u "$pkgname/master"
	git commit -m "Add $pkgname subtree"
}

update_pkg() {
	local pkgname="$1"
	[[ -z $pkgname ]] && usage 

	git pull -s subtree $pkgname master
}

case "$1" in
	add)
		add_pkg $2
		;;
	update)
		update_pkg $2
		;;
	*)
		usage
esac