summaryrefslogtreecommitdiffstats
path: root/cron-jobs/adjust-permissions
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-08 15:11:14 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-08 15:11:14 +0200
commit6326b0e86214a37d9f9be62bc84a79b015ff3633 (patch)
treefe6df6cbbf0f7afe4f7cb68d89ab40193d851883 /cron-jobs/adjust-permissions
parent9eb1cd7b9403533c4b60ecfbbbf00a08c211059a (diff)
downloaddbscripts-6326b0e86214a37d9f9be62bc84a79b015ff3633.tar.gz
dbscripts-6326b0e86214a37d9f9be62bc84a79b015ff3633.tar.xz
Cleanup cron-jobs/adjust-permissions
Diffstat (limited to 'cron-jobs/adjust-permissions')
-rwxr-xr-xcron-jobs/adjust-permissions57
1 files changed, 26 insertions, 31 deletions
diff --git a/cron-jobs/adjust-permissions b/cron-jobs/adjust-permissions
index c92cb9e..c21af0c 100755
--- a/cron-jobs/adjust-permissions
+++ b/cron-jobs/adjust-permissions
@@ -1,49 +1,44 @@
#!/bin/bash
-if [ -f /tmp/.ftpmaint.lck ]; then
- exit 0
-fi
-
-/bin/touch /tmp/.ftpmaint.lck
+script_lock
. "$(dirname $0)/../db-functions"
. "$(dirname $0)/../config"
get_dir_owner() {
- case $1 in
- core)
- echo "ftp:ftp-arch" ;;
- extra)
- echo "ftp:ftp-extra" ;;
- testing)
- echo "ftp:ftp-extra" ;;
- community)
- echo "root:tusers" ;;
- community-testing)
- echo "root:tusers" ;;
- packages/arch)
- echo "ftp:ftp-extra" ;;
- packages/community)
- echo "root:tusers" ;;
- esac
+ case $1 in
+ core)
+ echo "ftp:ftp-arch" ;;
+ extra)
+ echo "ftp:ftp-extra" ;;
+ testing)
+ echo "ftp:ftp-extra" ;;
+ community)
+ echo "root:tusers" ;;
+ community-testing)
+ echo "root:tusers" ;;
+ packages/arch)
+ echo "ftp:ftp-extra" ;;
+ packages/community)
+ echo "root:tusers" ;;
+ esac
}
#adjust the nice level to run at a lower priority
/usr/bin/renice +10 -p $$ > /dev/null
-cd $FTP_BASE
+pushd $FTP_BASE >/dev/null
for d in $(get_repos_for_host); do
- owner="$(get_dir_owner $d)"
- /bin/chown -R $owner $d/os/{any,i686,x86_64}
- /bin/chmod -R g+w $d/os/{any,i686,x86_64}
+ owner="$(get_dir_owner $d)"
+ /bin/chown -R $owner $d/os/{any,i686,x86_64}
+ /bin/chmod -R g+w $d/os/{any,i686,x86_64}
done
-
for p in $(get_pkgpool_for_host); do
- owner="$(get_dir_owner $p)"
- /bin/chown -R $owner $p/{any,i686,x86_64}
- /bin/chmod -R g+w $p/{any,i686,x86_64}
+ owner="$(get_dir_owner $p)"
+ /bin/chown -R $owner $p/{any,i686,x86_64}
+ /bin/chmod -R g+w $p/{any,i686,x86_64}
done
-
/bin/chmod 555 $FTP_BASE
+popd >/dev/null
-rm -f /tmp/.ftpmaint.lck
+script_unlock