diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-05-15 00:49:20 +0200 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-05-15 00:51:05 +0200 |
commit | 39298cf09e2e88b1f6aec779170990675baf8992 (patch) | |
tree | 653de4d1002b0be8a6b6111e88b7c4cc5df29203 /cron-jobs/genpkglist | |
parent | e021dfb2c476c2841606e63e6ae58dfc45cd1b47 (diff) | |
download | dbscripts-39298cf09e2e88b1f6aec779170990675baf8992.tar.gz dbscripts-39298cf09e2e88b1f6aec779170990675baf8992.tar.xz |
Cron cleanup, and only copy DB files once
This would break all adds if there were any deletes.
We definitely don't want that.
Also, cleanup of cron scripts in the same commit because
I'm lazy
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'cron-jobs/genpkglist')
-rwxr-xr-x | cron-jobs/genpkglist | 86 |
1 files changed, 20 insertions, 66 deletions
diff --git a/cron-jobs/genpkglist b/cron-jobs/genpkglist index 31b7c78..0b5d76f 100755 --- a/cron-jobs/genpkglist +++ b/cron-jobs/genpkglist @@ -1,74 +1,28 @@ #!/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 +if [ $# -ne 2 ]; then + echo "usage: $(basename $0) <reponame> <arch>" + exit 1 +fi - tmp=${1##*/} - tmp=${tmp%.pkg.tar.gz} - tmp=${tmp%-i686} - tmp=${tmp%-x86_64} - echo ${tmp%-*-*} -} +reponame=$1 +arch=$2 -pkgfile="$(pwd)/packages.txt" -ftppath=$1 -repotag=$2 +##### Arch specific stuff. TODO make this configurable ##### +ftppath="/home/ftp/$reponame/os/$arch/" +############################################################ -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 +if [ ! -d "$ftppath" ]; then + echo "FTP path '$ftppath' does not exist" + exit 1 +fi -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 +if [ ! -f /etc/makepkg.conf ]; then + echo "/etc/makepkg.conf not found! Aborting" + exit 1 +fi -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 -} +. /etc/makepkg.conf -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 +cd "$ftppath" +ls -1 *$PKGEXT |