summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-12-31 14:18:35 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-12-31 14:18:35 -0500
commitb220202c57cde13273af84e4954dbbccd2824c42 (patch)
tree67df531dc366fe8b34fab14e6abf01de90124115
parent563cf021c96446aa15a41c1f532067d13d880b41 (diff)
parente6294556d3197b7d87f7659355d0e189fad613d6 (diff)
Merge branch 'cleanup4' into db-import2
-rwxr-xr-xcron-jobs/ftpdir-cleanup13
-rwxr-xr-xcron-jobs/sourceballs6
-rwxr-xr-xcron-jobs/update-web-db4
-rw-r--r--db-functions19
-rwxr-xr-xdb-move4
-rwxr-xr-xdb-remove4
-rwxr-xr-xdb-repo-add4
-rwxr-xr-xdb-repo-remove4
-rwxr-xr-xdb-update4
-rwxr-xr-xtesting2x4
10 files changed, 38 insertions, 28 deletions
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index e1294bd..e42a1a8 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -1,16 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/../config"
-. "$(dirname $0)/../db-functions"
-
-# just like mv -f, but we touch the file and then copy the content so
-# default ACLs in the target dir will be applied
-mv_acl() {
- rm -f "$2"
- touch "$2"
- cat "$1" >"$2" || return 1
- rm -f "$1"
-}
+. "$(dirname "$(readlink -e "$0")")/../config"
+. "$(dirname "$(readlink -e "$0")")/../db-functions"
clean_pkg() {
local pkg
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 34de2a6..2362024 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -1,6 +1,6 @@
#!/bin/bash
-dirname="$(dirname $(readlink -e $0))"
+dirname="$(dirname "$(readlink -e "$0")")"
. "${dirname}/../config"
. "${dirname}/../db-functions"
pushd "${WORKDIR}" >/dev/null
@@ -90,7 +90,7 @@ for repo in ${PKGREPOS[@]}; do
pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null
SRCPKGDEST=. makepkg --nocolor --allsource --ignorearch --skippgpcheck >"${WORKDIR}/${pkgbase}.log" 2>&1
if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then
- mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}"
+ mv_acl "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}"
# Avoid creating the same source package for every arch
echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs"
newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
@@ -127,7 +127,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
for old_pkg in ${old_pkgs[@]}; do
msg2 "${old_pkg}"
if ! ${SOURCE_CLEANUP_DRYRUN}; then
- mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}"
+ mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
fi
done
diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db
index 195d1fc..713e75e 100755
--- a/cron-jobs/update-web-db
+++ b/cron-jobs/update-web-db
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/../config"
-. "$(dirname $0)/../db-functions"
+. "$(dirname "$(readlink -e "$0")")/../config"
+. "$(dirname "$(readlink -e "$0")")/../db-functions"
# setup paths
SPATH="/srv/http/archweb"
diff --git a/db-functions b/db-functions
index f5e2b3d..90d2a09 100644
--- a/db-functions
+++ b/db-functions
@@ -15,9 +15,19 @@ restore_umask () {
umask $UMASK >/dev/null
}
+# just like mv -f, but we touch the file and then copy the content so
+# default ACLs in the target dir will be applied
+mv_acl() {
+ rm -f "$2"
+ touch "$2"
+ cat "$1" >"$2" || return 1
+ rm -f "$1"
+}
+
# set up general environment
WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX")
LOCKS=()
+REPO_MODIFIED=0
# Used: plain, msg, msg2, warning, error, in_array, get_full_version
# Overwritten: cleanup, abort, die
@@ -70,6 +80,11 @@ cleanup() {
script_unlock
fi
rm -rf "$WORKDIR"
+
+ if (( REPO_MODIFIED )); then
+ date +%s > "${FTP_BASE}/lastupdate"
+ fi
+
[ "$1" ] && exit $1
}
@@ -413,6 +428,8 @@ arch_repo_add() {
|| error "repo-add -f ${repo}${FILESEXT} ${pkgs[@]}"
popd >/dev/null
set_repo_permission "${repo}" "${arch}"
+
+ REPO_MODIFIED=1
}
arch_repo_remove() {
@@ -431,4 +448,6 @@ arch_repo_remove() {
/usr/bin/repo-remove -q "${filesfile}" ${pkgs[@]} \
|| error "repo-remove ${filesfile} ${pkgs[@]}"
set_repo_permission "${repo}" "${arch}"
+
+ REPO_MODIFIED=1
}
diff --git a/db-move b/db-move
index 6e8796d..1b34404 100755
--- a/db-move
+++ b/db-move
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/config"
-. "$(dirname $0)/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
msg "usage: ${0##*/} <repo-from> <repo-to> <pkgname|pkgbase> ..."
diff --git a/db-remove b/db-remove
index ccab5ea..993574f 100755
--- a/db-remove
+++ b/db-remove
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/config"
-. "$(dirname $0)/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
msg "usage: ${0##*/} <repo> <arch> <pkgname|pkgbase> ..."
diff --git a/db-repo-add b/db-repo-add
index 5d5b653..a6355a1 100755
--- a/db-repo-add
+++ b/db-repo-add
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/config"
-. "$(dirname $0)/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
msg "usage: ${0##*/} <repo> <arch> <pkgfile> ..."
diff --git a/db-repo-remove b/db-repo-remove
index 2a693f4..7077d62 100755
--- a/db-repo-remove
+++ b/db-repo-remove
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/config"
-. "$(dirname $0)/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
msg "usage: ${0##*/} <repo> <arch> <pkgname> ..."
diff --git a/db-update b/db-update
index 28fcabe..9c6a56a 100755
--- a/db-update
+++ b/db-update
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/config"
-. "$(dirname $0)/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -ge 1 ]; then
warning "Calling ${0##*/} with a specific repository is no longer supported"
diff --git a/testing2x b/testing2x
index d93c5f8..14610c2 100755
--- a/testing2x
+++ b/testing2x
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/config"
-. "$(dirname $0)/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 1 ]; then
msg "usage: ${0##*/} <pkgname|pkgbase> ..."