summaryrefslogtreecommitdiffstats
path: root/cron-jobs
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2008-08-31 07:07:26 +0200
committerAaron Griffin <aaronmgriffin@gmail.com>2008-08-31 07:07:26 +0200
commite1ad729fd49c630eece0055ed996b382811a836c (patch)
tree53ff2ef70e2e0713be848f27079694c5f488a964 /cron-jobs
parentafc6b5b5977fe77e699af8f02f7c8c4c3df603de (diff)
downloaddbscripts-e1ad729fd49c630eece0055ed996b382811a836c.tar.gz
dbscripts-e1ad729fd49c630eece0055ed996b382811a836c.tar.xz
Add sourceball generating cron script
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'cron-jobs')
-rwxr-xr-xcron-jobs/sourceballs81
-rw-r--r--cron-jobs/sourceballs.skip1
2 files changed, 82 insertions, 0 deletions
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
new file mode 100755
index 0000000..f599ff1
--- /dev/null
+++ b/cron-jobs/sourceballs
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+ftpbase="/home/ftp"
+srcbase="/home/aaron/public_html/sources/"
+repos="core extra unstable testing"
+arches="i686 x86_64"
+
+LOCKFILE="/tmp/.sourceball.lock"
+
+if [ ! -f /etc/makepkg.conf ]; then
+ echo "/etc/makepkg.conf not found! Aborting"
+ exit 1
+fi
+
+. /etc/makepkg.conf
+cleanup () {
+ rm -f "$LOCKFILE"
+ exit 0
+}
+
+ctrl_c() {
+ cleanup
+}
+
+if [ -f "$LOCKFILE" ]; then
+ owner="$(/usr/bin/stat -c %U $LOCKFILE)"
+ echo "error: source tarball generation is already in progress (started by $owner)"
+ exit 1
+fi
+
+trap cleanup 0
+trap ctrl_c 2
+
+/bin/touch "$LOCKFILE"
+
+dirname="$(/bin/readlink -f $(/usr/bin/dirname $0))"
+
+getpkgname() {
+ local tmp
+
+ tmp=${1##*/}
+ tmp=${tmp%$PKGEXT}
+ for a in $arches; do
+ tmp=${tmp%-$a}
+ done
+ echo ${tmp%-*-*}
+}
+
+FAILED_PKGS=""
+
+for repo in $repos; do
+ for arch in $arches; do
+ export CARCH="$arch"
+ ftppath="$ftpbase/$repo/os/$arch"
+ cd $ftppath
+ for pkg in *$PKGEXT; do
+ pkgname=$(getpkgname $pkg)
+ srcpath="$srcbase/"
+ srcpkg="${pkg//-$arch$PKGEXT/$SRCEXT}"
+
+ if grep $pkgname "$dirname/sourceballs.skip" >/dev/null 2>&1; then
+ echo ":: Skipping package '$pkgname'"
+ continue
+ fi
+
+ if [ ! -f "$srcpath$srcpkg" ]; then
+ if ! $dirname/../misc-scripts/make-sourceball $pkgname $repo $arch; then
+ FAILED_PKGS="$FAILED_PKGS $pkg"
+ fi
+ fi
+ done
+ done
+done
+
+if [ -n "$FAILED_PKGS" ]; then
+ echo ""
+ echo "The following packages failed:"
+ echo -e $FAILED_PKGS | sed "s| |\n\t|g" | sort -u
+fi
+
+cleanup
diff --git a/cron-jobs/sourceballs.skip b/cron-jobs/sourceballs.skip
new file mode 100644
index 0000000..0b5a58e
--- /dev/null
+++ b/cron-jobs/sourceballs.skip
@@ -0,0 +1 @@
+readline