Firmicus a écrit :
> Allan McRae a écrit :
>   
>> Firmicus wrote:
>>     
>>> ... and a second one.
>>>
>>> Cheers,
>>> F
>>>   
>>>       
>> Hmmm....   finding it difficult to review this one.
>>
>>     
Ah, Geez, I should have noticed that! :D
Here is the patch. Hope my explanations will still be useful.
F
>From e4ce3b3936b87bc360eb2f3a03b21abc14d6cfca Mon Sep 17 00:00:00 2001
From: Francois Charette <[email protected]>
Date: Tue, 15 Sep 2009 14:56:15 +0200
Subject: [PATCH 2/2] Fix moving pkg and src to PKGDEST and SRCDEST

The test " -n $PKGDEST " and " -n $SRCDEST " must be replaced
by -d , otherwise if the string is defined but the directory
does not exist, then the mv operation will fail. Also a trailing / is
necessary to avoid the resulting package being written to,
say, the file /pkgdest !
---
 makechrootpkg |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/makechrootpkg b/makechrootpkg
index 9e227d0..639d197 100755
--- a/makechrootpkg
+++ b/makechrootpkg
@@ -238,24 +238,24 @@ if mkarchroot -r "/chrootbuild" "$uniondir"; then
         fi
 
         if [ -e $pkgfile ]; then
-            if [ -n "$PKGDEST" ]; then
+            if [ -d "$PKGDEST" ]; then
                 echo "Moving completed ${_pkgname} package file to ${PKGDEST}"
-                mv $pkgfile "${PKGDEST}"
+                mv $pkgfile "${PKGDEST}/"
             else
                 echo "Moving completed ${_pkgname} package file to ${WORKDIR}"
-                mv $pkgfile "${WORKDIR}"
+                mv $pkgfile "${WORKDIR}/"
             fi
         fi
     done
 
     for f in ${chrootdir}/union/srcdest/*; do
         [ -e "$f" ] || continue
-        if [ -n "$SRCDEST" ]; then
+        if [ -d "$SRCDEST" ]; then
             echo "Moving downloaded source file $(basename $f) to ${SRCDEST}"
-            mv "$f" "${SRCDEST}"
+            mv "$f" "${SRCDEST}/"
         else
             echo "Moving downloaded source file $(basename $f) to ${WORKDIR}"
-            mv "$f" "${WORKDIR}"
+            mv "$f" "${WORKDIR}/"
         fi
     done
 else
-- 
1.6.4.3

Reply via email to