When PKGDEST pointed to a non-writable location, makepkg would fail
after completing the build process. This patch makes it abort as
soon as PKGDEST is parsed.

Also, move the SRCDEST check to the same point rather than right
before downloading sources (which was after dependency checks).

Signed-off-by: Allan McRae <[email protected]>
---
 scripts/makepkg.sh.in |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 5560c77..a087ee7 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -454,12 +454,6 @@ remove_deps() {
 download_sources() {
        msg "$(gettext "Retrieving Sources...")"
 
-       if [[ ! -w $SRCDEST ]] ; then
-               error "$(gettext "You do not have write permission to store 
downloads in %s.")" "$SRCDEST"
-               plain "$(gettext "Aborting...")"
-               exit 1
-       fi
-
        pushd "$SRCDEST" &>/dev/null
 
        local netfile
@@ -1644,8 +1638,20 @@ readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
 # override settings with an environment variable for batch processing
 PKGDEST=${_PKGDEST:-$PKGDEST}
 PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined
+if [[ ! -w $PKGDEST ]]; then
+       error "$(gettext "You do not have write permission to store packages in 
%s.")" "$PKGDEST"
+       plain "$(gettext "Aborting...")"
+       exit 1
+fi
+
 SRCDEST=${_SRCDEST:-$SRCDEST}
 SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined
+if [[ ! -w $SRCDEST ]] ; then
+       error "$(gettext "You do not have write permission to store downloads 
in %s.")" "$SRCDEST"
+       plain "$(gettext "Aborting...")"
+       exit 1
+fi
+
 SRCPKGDEST=${_SRCPKGDEST:-$SRCPKGDEST}
 SRCPKGDEST=${SRCPKGDEST:-$PKGDEST} #default to $PKGDEST if undefined
 
-- 
1.7.0.1


Reply via email to