diff options
author | Holger Levsen <holger@layer-acht.org> | 2015-09-10 11:28:56 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-09-10 11:28:56 +0200 |
commit | 064e46b4a50e165b0046a51982dbb31617dc1389 (patch) | |
tree | f6ca56febdea1861990602b6b3b035bf3f864bde /bin | |
parent | 95e01b859cc5aca85e847a2f755cce03ab61c4e6 (diff) | |
download | jenkins.debian.net-064e46b4a50e165b0046a51982dbb31617dc1389.tar.xz |
reproducible: cleanup schroot sessions before moving them away
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/schroot-create.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/schroot-create.sh b/bin/schroot-create.sh index c3ffe469..51859325 100755 --- a/bin/schroot-create.sh +++ b/bin/schroot-create.sh @@ -181,6 +181,12 @@ bootstrap() { fi } +cleanup_schroot_sessions() { + # FIXME: if this works well, move to _common.sh and use the same function from _maintenance.sh + ps fax|grep -v grep |grep schroot || for i in $(schroot --all-sessions -l ) ; do ps fax|grep -v grep |grep schroot || schroot -e -c $i ; done + schroot --all-sessions -l +} + cleanup() { if [ -d $CHROOT_TARGET ]; then sudo rm -rf --one-file-system $CHROOT_TARGET || ( echo "Warning: $CHROOT_TARGET could not be fully removed on forced cleanup." ; ls $CHROOT_TARGET -la ) @@ -196,10 +202,12 @@ trap - INT TERM EXIT rand=$RANDOM if [ -d $SCHROOT_BASE/"$TARGET" ] then + cleanup_schroot_sessions echo "$(date -u ) - $SCHROOT_BASE/$TARGET exists, moving it away to $SCHROOT_BASE/$TARGET-$rand" sudo mv $SCHROOT_BASE/"$TARGET" $SCHROOT_BASE/"$TARGET"-"$rand" fi +cleanup_schroot_sessions echo "$(date -u ) - renaming $CHROOT_TARGET to $SCHROOT_BASE/$TARGET" sudo mv $CHROOT_TARGET $SCHROOT_BASE/"$TARGET" |