diff options
author | Thomas Bächler <thomas@archlinux.org> | 2008-02-16 13:50:25 +0100 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2008-02-16 13:50:25 +0100 |
commit | 29a77254307e42ba0959fe7660aa3d0d76285e6a (patch) | |
tree | fce1b4090f5ca862c169283c7f4412d3b603f003 /cleanup-scripts | |
parent | 410d14a1f9f22bf3f52a58f732305020c29e3141 (diff) | |
download | dbscripts-29a77254307e42ba0959fe7660aa3d0d76285e6a.tar.gz dbscripts-29a77254307e42ba0959fe7660aa3d0d76285e6a.tar.xz |
Commited cleanup script to db-inc/genpkglist
Diffstat (limited to 'cleanup-scripts')
-rwxr-xr-x | cleanup-scripts/cleanup.sh | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/cleanup-scripts/cleanup.sh b/cleanup-scripts/cleanup.sh deleted file mode 100755 index cdb0cef..0000000 --- a/cleanup-scripts/cleanup.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -usage() { - echo "Usage: $0 repo architecture" -} - -getpkgname() { - local tmp - - tmp=${1##*/} - tmp=${tmp%.pkg.tar.gz} - tmp=${tmp%-i686} - tmp=${tmp%-x86_64} - echo ${tmp%-*-*} -} - -FTPBASEDIR="/home/ftp" -FTPDIR=${FTPBASEDIR}/${1}/os/${2} -DBFILE=${FTPDIR}/${1}.db.tar.gz -MISSINGFILES="" -DELETEFILES="" - -if [ $# -lt 2 -o ! -f ${DBFILE} ]; then - usage - exit 1 -fi - -TMPDIR=$(mktemp -d /tmp/cleanup.XXXXXX) || exit 1 - -cd ${TMPDIR} -tar xzf ${DBFILE} -for pkg in *; do - filename=$(grep -A1 '^%FILENAME%$' ${pkg}/desc | tail -n1) - [ -z "${filename}" ] && filename="${pkg}.pkg.tar.gz" - if [ ! -f ${FTPDIR}/${filename} ]; then - MISSINGFILES="${MISSINGFILES} ${filename}" - else - pkgname="$(getpkgname ${filename})" - for otherfile in ${FTPDIR}/${pkgname}-*; do - otherfile="$(basename ${otherfile})" - if [ "${otherfile}" != "${filename}" -a "${pkgname}" = "$(getpkgname ${otherfile})" ]; then - DELETEFILES="${DELETEFILES} ${otherfile}" - fi - done - fi -done - -cd - >/dev/null -rm -rf ${TMPDIR} - -echo -ne "DIRECTORY:\n${FTPDIR}\n\n" -echo -ne "DELETEFILES:\n${DELETEFILES}\n\n" -echo -ne "MISSINGFILES:\n${MISSINGFILES}\n\n" |