From 0a1ca73183dc552e5388cd8961408e4604c1bb45 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 9 Mar 2007 04:35:04 +0000 Subject: * Added confirmation step to makepkg -C operation to ensure user is deleting exactly what they think they are. --- scripts/makepkg | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/makepkg b/scripts/makepkg index 68713f46..397a3296 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -486,16 +486,28 @@ fi if [ "$CLEANCACHE" = "1" ]; then #fix flyspray feature request #5223 - if [ -n "$SRCDEST" ]; then - msg "Cleaning up source files from the cache." - rm -rf "$SRCDEST"/* - if [ $? -ne 0 ]; then - error "Problem removing files; you may not have correct permissions in $SRCDEST" - exit 1 + if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then + msg "Cleaning up ALL files from $SRCDEST." + echo -n " Are you sure you wish to do this? [Y/n] " + read answer + answer=$(echo $answer | tr [:upper:] [:lower:]) + if [ "$answer" = "yes" -o "$answer" = "y" ]; then + rm -rf "$SRCDEST"/* + if [ $? -ne 0 ]; then + error "Problem removing files; you may not have correct permissions in $SRCDEST" + exit 1 + else + # removal worked + msg "Source cache cleaned." + exit 0 + fi else + # answer = no + "No files have been removed." exit 0 fi else + # SRCDEST undefined (should never happen) error "Source destination must be defined in makepkg.conf." exit 1 fi -- cgit v1.2.3-24-g4f1b