Skip to content

Commit

Permalink
Don't cleanup distfiles if distfiles is a symlink
Browse files Browse the repository at this point in the history
It might be a symlink to the master distfiles mirror and we don't want
to risk deleting that.
  • Loading branch information
ryandesign committed Mar 7, 2018
1 parent 4b9448b commit f151333
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mpbb-cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ cleanup() {
# $thisdir is set by mpbb and points to the directory in which this script resides
# shellcheck disable=SC2154
"${option_prefix}/bin/port-tclsh" "${thisdir}/tools/uninstall-old-ports.tcl"
echo
echo "----> Deleting distfiles"
find "${option_prefix}/var/macports/distfiles" -type f -mtime +1 -print -delete | sed -E 's/^/Deleting distfile /'
find "${option_prefix}/var/macports/distfiles" -type d -mindepth 1 -empty -print -delete | sed -E 's/^/Deleting directory /'
if [ ! -L "${option_prefix}/var/macports/distfiles" ]; then
echo
echo "----> Deleting distfiles"
find "${option_prefix}/var/macports/distfiles" -type f -mtime +1 -print -delete | sed -E 's/^/Deleting distfile /'
find "${option_prefix}/var/macports/distfiles" -type d -mindepth 1 -empty -print -delete | sed -E 's/^/Deleting directory /'
fi
echo
for dir in build logs; do
echo "----> Deleting ${dir}"
Expand Down

0 comments on commit f151333

Please sign in to comment.