summaryrefslogtreecommitdiffstats
path: root/relpkg
blob: cb6cdc4d108475255af4f3a58c5259fa8a80871b (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
#!/bin/bash

repodir="/srv/http/sites/bluewind/repo"
host="bluewind.at"
user="web-flo"
dbfile="bluewind.db.tar.gz"
all_arches=(i686 x86_64)

_startdir="$PWD"

error() {
	echo "ERROR: $@" >&2
	exit 1
}

warn() {
	echo "WARNING: $@" >&2
}

if [[ $# > 0 ]]; then
	_dirs="$@"
else
	_dirs="."
fi

for _dir in $_dirs; do
	cd "$_startdir/$_dir"
	source PKGBUILD

	unset -f build 
	unset -f package

	for _arch in ${arch[@]}; do
		pkgfile="${pkgname}-${pkgver}-${pkgrel}-${_arch}.pkg.tar.xz"
		if [[ ! -f "$pkgfile" ]]; then
			warn "$pkgfile doesn't exist"
			continue
		fi
		rsync --partial --progress "$pkgfile" "$user@$host://$repodir/$_arch/$pkgfile"
		if [[ $_arch == "any" ]]; then
			for _arch in ${all_arches[@]}; do
				ssh "$user@$host" "ln -sf ../any/$pkgfile $repodir/$_arch/$pkgfile"
				ssh "$user@$host" "repo-add -q $repodir/$_arch/$dbfile $repodir/$_arch/$pkgfile"
			done
		else
			ssh "$user@$host" "repo-add -q $repodir/$_arch/$dbfile $repodir/$_arch/$pkgfile"
		fi
	done

	#ssh "$user@$host" "$repodir/bin/clean_pkg_name" "$pkgname"
done