1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 71c2568..86ee878 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -21,7 +21,7 @@ my $ROOT="..";
 my $ziptool="zip -r9";
 my $output="rockbox.zip";
 my $verbose;
-my $install=0;
+my $install;
 my $exe;
 my $target;
 my $modelname;
@@ -475,8 +475,6 @@ $year+=1900;
 sub runone {
     my ($target, $fonts)=@_;

-    my $samedir = abs_path("$install/$rbdir") eq abs_path($rbdir);
-
     # build a full install .rockbox ($rbdir) directory
     buildzip($target, $fonts);

@@ -496,12 +494,18 @@ sub runone {
         print "$ziptool $output $rbdir $target >/dev/null\n";
     }

+    my $samedir = 0; # is the destination dir equal to source dir ?
+
     if($install) {
         if ($install =~ /\/dev\/null/) {
             die "ERROR: No PREFIX given\n"
         }
+
+        my $destdir = "$install/$rbdir";
+        $samedir = abs_path($destdir) eq abs_path($rbdir);
+
         if (!$samedir) {
-            system("cp -r $rbdir \"$install\" >/dev/null");
+            system("mkdir -p \"$destdir\" && cp -r $rbdir \"$install/\"");
         }
     }
     else {