Skip to content
Snippets Groups Projects
Verified Commit 5be25c5f authored by Jan Alexander Steffens (heftig)'s avatar Jan Alexander Steffens (heftig)
Browse files

archbuild: Make clean scripts a bit more verbose

parent 03e502c4
No related branches found
No related tags found
No related merge requests found
#!/bin/zsh
setopt extendedglob nomatch errreturn
integer ret=0 br=0
integer ret=0
cd /var/lib/archbuild
chroots=( */^root(/Nmh+12) )
(( ${#chroots} )) || exit 0
df -HT .
echo "<6>Deleting ${#chroots} chroots"
if btrfs filesystem df . &>/dev/null; then
remove() {
btrfs sub del $1
btrfs sub del $1 &>/dev/null
}
else
remove() {
......@@ -15,7 +21,7 @@ else
}
fi
for chroot in */^root(/Nmh+12); do
for chroot in $chroots; do
exec 9>>| $chroot.lock
if ! flock -n 9; then
......@@ -23,9 +29,9 @@ for chroot in */^root(/Nmh+12); do
continue
fi
echo "<6>Deleting $chroot"
if ! remove $chroot &>/dev/null; then
if remove $chroot; then
echo "<6>Deleted $chroot"
else
echo "<3>Error deleting $chroot"
ret=1
fi
......@@ -33,4 +39,5 @@ for chroot in */^root(/Nmh+12); do
# We don't remove the lockfile. Less races that way
done
df -HT .
exit $ret
#!/bin/zsh
setopt extendedglob nomatch errreturn
cd /var/lib/archbuilddest
integer ret=0
rm -rf srcdest/*(Na+90)
cd /var/lib/archbuilddest/srcdest
files=( *(Na+90) )
(( ${#files} )) || exit 0
df -HT .
echo "<6>Deleting ${#files} files"
for file in $files; do
if rm -rf $file; then
echo "<6>Deleted $file"
else
echo "<3>Error deleting $file"
ret=1
fi
done
df -HT .
exit $ret
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment