File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ IFS="$(printf '\n \t')"
49
49
function cleanup () {
50
50
rm -f $TMPFILE
51
51
rm -f $TMPLIST
52
+ rm -rf $TMP_UNPACK_FOLDER
52
53
rm -f $TOARCHIVE
53
54
IFS=" $OLD_IFS "
54
55
}
@@ -190,6 +191,7 @@ OLD_PWD="`pwd`"
190
191
TMPDIR=${TMPDIR:-/ tmp}
191
192
TMPFILE=` mktemp " $TMPDIR /$PROGRAM .XXXXXX" ` # Create a place to store our work's progress
192
193
TMPLIST=` mktemp " $TMPDIR /$PROGRAM .submodules.XXXXXX" `
194
+ TMP_UNPACK_FOLDER=` mktemp -d " $TMPDIR /$PROGRAM .tmp_unpack_folder.XXXXXX" `
193
195
TOARCHIVE=` mktemp " $TMPDIR /$PROGRAM .toarchive.XXXXXX" `
194
196
OUT_FILE=$OLD_PWD # assume "this directory" without a name change by default
195
197
@@ -286,12 +288,14 @@ if [ $SEPARATE -eq 0 -o "-" == "$OUT_FILE" ]; then
286
288
$TARCMD --concatenate -f " $superfile " " $file " && rm -f " $file "
287
289
done
288
290
elif [ $FORMAT == ' zip' ]; then
291
+ # unpack all zip files, then re-pack
292
+ # unfortunately, more intelligent options don't work:
293
+ # zipmerge is broken (kills the x bit of directories), and zip --grow does not unpack input zipfiles.
294
+ cd $TMP_UNPACK_FOLDER
289
295
sed -e ' 1d' $TMPFILE | while read file; do
290
- # zip incorrectly stores the full path, so cd and then grow
291
- cd ` dirname " $file " `
292
- zip -g " $superfile " ` basename " $file " ` && rm -f " $file "
296
+ unzip -q " $file " && rm -f " $file "
293
297
done
294
- cd " $OLD_PWD "
298
+ zip --quiet --recurse-paths " $superfile " .
295
299
fi
296
300
297
301
echo " $superfile " > | $TMPFILE # clobber on purpose
You can’t perform that action at this time.
0 commit comments