diff options
author | Dan McGee <dan@archlinux.org> | 2007-03-09 04:35:04 +0000 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-03-09 04:35:04 +0000 |
commit | 0a1ca73183dc552e5388cd8961408e4604c1bb45 (patch) | |
tree | 3b097db4fccf301975a4b5b584d0e0ea08fff26b /scripts | |
parent | 28aca444a282d23c79e932120cf7db04fdedb7eb (diff) | |
download | 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')
-rwxr-xr-x | scripts/makepkg | 24 |
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 |