summaryrefslogtreecommitdiffstats
path: root/cron-jobs/genpkglist
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2008-05-07 08:06:21 +0200
committerAaron Griffin <aaronmgriffin@gmail.com>2008-05-07 08:06:57 +0200
commit511759504993c858d977b649cd02cf7969811b57 (patch)
tree3e98d0b862e5ccb7776d7ccd5cb92e6d259c6c04 /cron-jobs/genpkglist
parentcbd6533816b1c27aab268b5c8f823345be8e12ed (diff)
downloaddbscripts-511759504993c858d977b649cd02cf7969811b57.tar.gz
dbscripts-511759504993c858d977b649cd02cf7969811b57.tar.xz
Moving some files around, organizational
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'cron-jobs/genpkglist')
-rwxr-xr-xcron-jobs/genpkglist74
1 files changed, 74 insertions, 0 deletions
diff --git a/cron-jobs/genpkglist b/cron-jobs/genpkglist
new file mode 100755
index 0000000..31b7c78
--- /dev/null
+++ b/cron-jobs/genpkglist
@@ -0,0 +1,74 @@
+#!/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
+repotag=$2
+
+rm -f $pkgfile
+for package in *; do
+ if [ -d "$package/$repotag/" ]; then
+ cd "$package/$repotag/"
+ if [ -f PKGBUILD ]; then
+ . PKGBUILD
+ if [ -f $ftppath/$pkgname-$pkgver-$pkgrel.pkg.tar.gz ]; then
+ echo "$pkgname-$pkgver-$pkgrel.pkg.tar.gz" >>$pkgfile
+ elif [ -f $ftppath/$pkgname-$pkgver-$pkgrel-$dbarch.pkg.tar.gz ]; then
+ echo "$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 ..
+ fi
+done
+
+cd $ftppath
+unset DUPES DUPEFILES last
+for pkg in *.pkg.tar.gz; do
+ pkgname=$(getpkgname $pkg)
+ if [ "$last" = "$pkgname" ]; then
+ DUPES="$DUPES $pkgname"
+ DUPEFILES="$DUPEFILES $pkg"
+ fi
+ last=$pkgname
+done
+
+showdupes() {
+ done=
+ for i in *.pkg.tar.gz; do
+ pkgname=$(getpkgname $i)
+ if [ "$pkgname" = "$1" ]; then
+ ls -l $i | awk '{print $6" "$7" "$8" "$9}'
+ done=1
+ else
+ [ "$done" = "1" ] && return
+ fi
+ done
+}
+
+if [ "$DUPES" ]; then
+ DUPES=$((for d in $DUPES; do echo $d; done) | sort -u)
+ echo "Possible Dupes for $ftppath (remove old versions)"
+ echo "Date Filename"
+ for dupe in $DUPES; do
+ showdupes $dupe
+ done
+fi