Skip to content

Commit 7a0a103

Browse files
committed
Improve extract-archive script.
1 parent 678c2d2 commit 7a0a103

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
### Fixed
10+
11+
* Fixed a bug when downloading multiple archives.
12+
713
## [1.0.5] - 2021-05-19
814

915
### Added

bin/extract-archive

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@ dest=$1; shift
1313

1414
script=extract-archive-on-docker
1515

16+
tmpdir=/tmp/mt-dev-extract-archive-$$
17+
mkdir $tmpdir
1618
for f in "$@"; do
1719
if echo "$f" | egrep -q "^https?://"; then
1820
name=$(basename $f)
19-
mkdir /tmp/$$
20-
path=/tmp/$$/$name
21-
curl -L -o $path $f
21+
path=$tmpdir/$name
22+
curl -s -L -o $path $f
2223
else
2324
name=$f
2425
path=$base/$f
2526
fi
2627
$md5 $path
2728
docker run --rm -v $dest:/dest -v $path:/archive/$name -v $script_dir/$script:/usr/local/bin/$script -w /dest busybox:uclibc /usr/local/bin/$script /dest /archive/$name
2829
done
30+
rm -fr $tmpdir
2931

3032
docker run --rm -v $dest:/dest busybox:uclibc ls /dest/mt.cgi > /dev/null

bin/extract-archive-on-docker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ file=$2
55

66
cd `mktemp -d`
77

8-
unzip -q $file || tar zxf $file
8+
( unzip -q $file || tar zxf $file ) 2>&1 | grep -v 'unzip: short read'
99

1010
if [ `ls | wc -l` -eq "1" ] && ls | egrep -v '^(addons|mt-static|php|alt-tmpl|plugins|default_templates|search_templates|extlib|themes|import|tmpl|tools|lib|.*\.cgi)$' >/dev/null 2>&1; then
1111
cd `ls`

0 commit comments

Comments
 (0)