From a051fb16ec3b24c7665afc294b0b6920a3a3ab73 Mon Sep 17 00:00:00 2001 From: linimon Date: Mon, 16 Nov 2009 00:16:08 +0000 Subject: Harden these a bit: make them identify on which host they were running; skip unncessary steps. --- Tools/portbuild/scripts/clean-chroot | 4 ++-- Tools/portbuild/scripts/cleanup-chroots | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'Tools/portbuild') diff --git a/Tools/portbuild/scripts/clean-chroot b/Tools/portbuild/scripts/clean-chroot index 07d7d1cb9008..7ec91af79bf8 100755 --- a/Tools/portbuild/scripts/clean-chroot +++ b/Tools/portbuild/scripts/clean-chroot @@ -24,11 +24,11 @@ cleanup_mount() { if [ -d ${chroot}${mount} ]; then mdir=$(fstat -f ${chroot}${mount} | head -2 | tail -1 | awk '{print $5}') if [ "${mdir}" = "MOUNT" ]; then - umount -f ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} failed!" + umount -f ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} on $(hostname) failed!" fi if [ "${mdir}" = "${chroot}${mount}" ]; then kill_procs ${chroot} ${mount} - umount -f ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} failed!" + umount -f ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} on $(hostname) failed!" fi fi } diff --git a/Tools/portbuild/scripts/cleanup-chroots b/Tools/portbuild/scripts/cleanup-chroots index 166f4ff7ae69..328668735e44 100755 --- a/Tools/portbuild/scripts/cleanup-chroots +++ b/Tools/portbuild/scripts/cleanup-chroots @@ -14,7 +14,7 @@ kill_procs() while [ ! -z "${pids}" ]; do pids=$(fstat -f "$dir" | tail +2 | awk '{print $3}' | sort -u) if [ ! -z "${pids}" ]; then - echo "Killing off pids in ${dir}" + echo "Killing off pids in ${dir} on $(hostname)" ps -p $pids kill -KILL ${pids} 2> /dev/null sleep 2 @@ -29,11 +29,11 @@ cleanup_mount() { if [ -d ${chroot}${mount} ]; then mdir=$(fstat -f ${chroot}${mount} | head -2 | tail -1 | awk '{print $5}') if [ "${mdir}" = "MOUNT" ]; then - umount ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} failed!" + umount ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} on $(hostname) failed!" fi if [ "${mdir}" = "${chroot}${mount}" ]; then kill_procs ${chroot}${mount} - umount ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} failed!" + umount ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} on $(hostname) failed!" fi fi } @@ -90,5 +90,7 @@ done mkdir -p ${scratchdir}/old mv ${old2} ${scratchdir}/old rm -rf ${scratchdir}/old 2> /dev/null -chflags -R noschg ${scratchdir}/old -rm -rf ${scratchdir}/old +if [ -d ${scratchdir}/old ]; then + chflags -R noschg ${scratchdir}/old + rm -rf ${scratchdir}/old +fi -- cgit