diff --git a/ChangeLog-current.txt b/ChangeLog-current.txt index dc359e5..c776af4 100644 --- a/ChangeLog-current.txt +++ b/ChangeLog-current.txt @@ -85,4 +85,6 @@ enhancements: alphabetical list, so shuffling/reordering of the queue will be necessary in order to list the dependencies correctly, but at least this will give users a head start on setting up a large build queue. + * The process of searching for obsolete source archives can now be + interrupted with ESC. +--------------------------+ diff --git a/src/usr/sbin/sbopkg b/src/usr/sbin/sbopkg index 701283f..53a90a4 100755 --- a/src/usr/sbin/sbopkg +++ b/src/usr/sbin/sbopkg @@ -2408,10 +2408,13 @@ remove_obsoleted_sources() { local FIND_RESULT=$SBOPKGTMP/sbopkg_obsolete_find local SOURCES=$SBOPKGTMP/sbopkg_app_sources + local PROGRESSBAR_INTERRUPTED=$SBOPKGTMP/sbopkg_progressbar-interrupted local PROGRESS=0 local NUMINFO local INFO APP_CURRSRC REGEX + rm -f $PROGRESSBAR_INTERRUPTED + { # Grouping for progressbar echo 0 # Progressbar begin @@ -2419,8 +2422,10 @@ remove_obsoleted_sources() { NUMINFO=$(wc -l < $FIND_RESULT) ls -A $SRCDIR > $SOURCES - # Reading from $FIND_RESULT... - while read INFO; do + for INFO in $(cat $FIND_RESULT); do + # Bail out if the user pressed ESC + progressbar_interrupted && touch $PROGRESSBAR_INTERRUPTED && break + APP_CURRSRC=$(get_source_names "$INFO") if [[ $APP_CURRSRC ]]; then REGEX="/^$APP_CURRSRC$/d;$REGEX" @@ -2429,11 +2434,16 @@ remove_obsoleted_sources() { # Progress indicator, for the progressbar (( PROGRESS += 1 )) echo $(($PROGRESS * 100 / $NUMINFO)) - done < $FIND_RESULT + done sed -i "$REGEX" $SOURCES } | progressbar "Searching obsolete sources" \ "This may take a while, so please be patient..." + if [[ -f $PROGRESSBAR_INTERRUPTED ]]; then + rm -f $PROGRESSBAR_INTERRUPTED $SOURCES + return + fi + # Quote file names sed -i "s/^\(.*\)$/\"\\1\"/" $SOURCES