summaryrefslogtreecommitdiffstats
path: root/genpkglist
blob: d026916255f321de9d4fc2268ee2043b5ff8e505 (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
#!/bin/bash
#
# genpkglist
#
# Generates a text package database for use with the setup script
# (also used to check for missing packages in the download directory)
#

# Get the package name from the filename
# hackish, but should work for now
getpkgname() {
  local tmp

  tmp=${1##*/}
  tmp=${tmp%.pkg.tar.gz}
  tmp=${tmp%-i686}
  tmp=${tmp%-x86_64}
  echo ${tmp%-*-*}
}

pkgfile="`pwd`/packages.txt"
ftppath=$1
dbarch=$2

rm -f $pkgfile
for category in `find * -maxdepth 0 -type d | grep -v CVS`; do
	cd $category
	for pkg in `/bin/ls`; do
		cd $pkg
		if [ -f PKGBUILD ]; then
			. PKGBUILD
			if [ -f $ftppath/$pkgname-$pkgver-$pkgrel.pkg.tar.gz ]; then
				echo "$category/$pkgname-$pkgver-$pkgrel.pkg.tar.gz" >>$pkgfile
			elif [ -f $ftppath/$pkgname-$pkgver-$pkgrel-$dbarch.pkg.tar.gz ]; then
				echo "$category/$pkgname-$pkgver-$pkgrel-$dbarch.pkg.tar.gz" >>$pkgfile
			else
				echo "notice: Missing $pkgname-$pkgver-$pkgrel-$dbarch.pkg.tar.gz in ftp site" >&2
			fi
		fi
		cd ..
	done
	cd ..
done