summaryrefslogtreecommitdiffstats
path: root/scripts/abs
blob: 37e39be87697266e207a322d2946cd990139eb4c (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

myver='2.2'
ABS_ROOT=/usr/abs

usage() {
  echo "abs $myver"
  echo "usage: $0"
	echo
	echo "abs will synchronize PKGBUILD scripts from the CVS repository"
	echo "into /usr/abs.  You can follow different package trees by editing"
	echo "/etc/abs/supfile.arch"
  echo
  exit 0
}

update() {
	if [ ! `type -p cvsup` ]; then
		echo "abs: cvsup was not found in PATH.  Install cvsup"
		exit 1
	fi

	if [ ! -d "$ABS_ROOT" ]; then
		echo "abs: directory $ABS_ROOT does not exist"
		exit 1
	fi

	if [ "`id -u`" != "0" ]; then
		echo "abs: you must be root to update your ABS tree"
		exit 1
	fi

	for sup in `find /etc/abs -name "supfile.*"`; do
		cd $ABS_ROOT && cvsup -L 1 -r 0 -g -c .sup $sup
	done		
}

for opt in "$@"; do
	case $opt in
		-h|--help)
			usage
			exit 0 ;;
		*)
			echo "abs: invalid option \"$opt\""
			exit 1 ;;
	esac
done

update

exit 0