summaryrefslogtreecommitdiffstats
path: root/misc-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'misc-scripts')
-rwxr-xr-xmisc-scripts/ftpdir-cleanup-repo (renamed from misc-scripts/ftpdir-cleanup)13
-rwxr-xr-xmisc-scripts/make-sourceball21
-rwxr-xr-xmisc-scripts/sourceballs-cleanup27
3 files changed, 6 insertions, 55 deletions
diff --git a/misc-scripts/ftpdir-cleanup b/misc-scripts/ftpdir-cleanup-repo
index ac17a8d..12f726c 100755
--- a/misc-scripts/ftpdir-cleanup
+++ b/misc-scripts/ftpdir-cleanup-repo
@@ -12,14 +12,6 @@ reponame=$1
. "$(dirname $0)/../db-functions"
. "$(dirname $0)/../config"
-cleanup() {
- trap '' 2 15
- for arch in ${ARCHES[@]}; do
- repo_unlock $reponame $arch
- done
- exit 1
-}
-
clean_pkgs () {
for pkg in "$@"; do
if [ -h "$pkg" ]; then
@@ -30,9 +22,6 @@ clean_pkgs () {
done
}
-trap cleanup 2
-trap cleanup 15
-
${CLEANUP_DRYRUN} && echo 'dry run mode is active'
ftppath_base="$FTP_BASE/$reponame/os"
@@ -41,7 +30,7 @@ for arch in ${ARCHES[@]}; do
repo_lock $reponame $arch $LOCK_TIMEOUT || continue
- CLEANUP_TMPDIR=$(mktemp -d ${TMPDIR}/cleanup-XXXXXX) || exit 1
+ CLEANUP_TMPDIR=$(mktemp -d ${WORKDIR}/cleanup-XXXXXX) || exit 1
ftppath="$ftppath_base/$arch"
MISSINGFILES=""
DELETEFILES=""
diff --git a/misc-scripts/make-sourceball b/misc-scripts/make-sourceball
index e216356..6e57385 100755
--- a/misc-scripts/make-sourceball
+++ b/misc-scripts/make-sourceball
@@ -22,21 +22,7 @@ _arch="$3"
srcpath="$FTP_BASE/sources/"
logpath="/var/log/sourceballs/"
-cleanup() {
- restore_umask
- rm -rf "$WORKDIR"
- [ "$1" ] && exit $1
-}
-
-ctrl_c() {
- echo "Interrupted" >&2
- cleanup 0
-}
-
-die() {
- echo -e "$*" >&2
- cleanup 1
-}
+script_lock
create_srcpackage() {
if [ -d "$1" ]; then
@@ -71,9 +57,6 @@ create_srcpackage() {
fi
}
-trap ctrl_c 2
-trap cleanup 0 1
-
set_umask
/bin/mkdir -p "$logpath"
cd "$WORKDIR"
@@ -91,3 +74,5 @@ else
die "\tPackage '$packagename' does not exist in repo '$reponame-$_arch'"
fi
fi
+
+script_unlock
diff --git a/misc-scripts/sourceballs-cleanup b/misc-scripts/sourceballs-cleanup
index c87a888..e058c38 100755
--- a/misc-scripts/sourceballs-cleanup
+++ b/misc-scripts/sourceballs-cleanup
@@ -6,19 +6,7 @@
srcpath="$FTP_BASE/sources/"
logfile="$srcpath/cleanup.txt"
-LOCKFILE="/tmp/.sourceball-cleanup.lock"
-
-cleanup () {
- restore_umask
- rm -rf "$WORKDIR"
- rm -f "$LOCKFILE"
- exit 0
-}
-
-ctrl_c() {
- echo "Interrupted" >&2
- cleanup 0
-}
+script_lock
remove_old() {
if [ -d "$1" ]; then
@@ -52,17 +40,6 @@ remove_old() {
fi
}
-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"
-
#adjust the nice level to run at a lower priority
/usr/bin/renice +10 -p $$ > /dev/null
@@ -91,4 +68,4 @@ for sourceball in "$srcpath"/*$SRCEXT; do
fi
done
-cleanup 0
+script_unlock