summaryrefslogtreecommitdiffstats
path: root/scripts/makepkg
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-03-09 05:35:04 +0100
committerDan McGee <dan@archlinux.org>2007-03-09 05:35:04 +0100
commit0a1ca73183dc552e5388cd8961408e4604c1bb45 (patch)
tree3b097db4fccf301975a4b5b584d0e0ea08fff26b /scripts/makepkg
parent28aca444a282d23c79e932120cf7db04fdedb7eb (diff)
downloadpacman-0a1ca73183dc552e5388cd8961408e4604c1bb45.tar.gz
pacman-0a1ca73183dc552e5388cd8961408e4604c1bb45.tar.xz
* Added confirmation step to makepkg -C operation to ensure user is deleting
exactly what they think they are.
Diffstat (limited to 'scripts/makepkg')
-rwxr-xr-xscripts/makepkg24
1 files 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