Skip to content

Commit

Permalink
extractor: pac & *.zip: handle file names with space in them
Browse files Browse the repository at this point in the history
Signed-off-by: ShivamKumarJha <[email protected]>
  • Loading branch information
ShivamKumarJha authored and erfanoabdi committed Jan 21, 2020
1 parent 053d600 commit 966a17f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- lz4
### Linux
```
apt install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller
apt install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller rename
apt install liblzma-dev python-pip brotli lz4
pip install backports.lzma protobuf pycrypto
```
Expand Down
5 changes: 3 additions & 2 deletions extractor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ elif [[ $(7z l -ba $romzip | grep "system.sin") ]]; then
elif [[ $(7z l -ba $romzip | grep ".*.pac") ]]; then
echo "pac detected"
cd $tmpdir
foundpac=$(7z l -ba $romzip | rev | gawk '{ print $1 }' | rev | grep ".*.pac")
7z e -y $romzip $foundpac dummypartition 2>/dev/null >> $tmpdir/zip.log
7z x -y $romzip 2>/dev/null >> $tmpdir/zip.log
find $tmpdir/ -name "* *" -type d,f | rename 's/ /_/g'
pac_list=`find $tmpdir/ -type f -name "*.pac" -printf '%P\n' | sort`
for file in $pac_list; do
$pacextractor $file
Expand Down Expand Up @@ -279,6 +279,7 @@ elif [[ $(7z l -ba $romzip | grep ".*.rar\|.*.zip") ]]; then
echo "Image zip firmware detected"
mkdir -p $tmpdir/zipfiles
7z e -y $romzip -o$tmpdir/zipfiles 2>/dev/null >> $tmpdir/zip.log
find $tmpdir/zipfiles -name "* *" -type d,f | rename 's/ /_/g'
zip_list=`find $tmpdir/zipfiles -type f -size +300M \( -name "*.rar*" -o -name "*.zip*" \) -printf '%P\n' | sort`
for file in $zip_list; do
"$LOCALDIR/extractor.sh" $tmpdir/zipfiles/$file "$outdir"
Expand Down

0 comments on commit 966a17f

Please sign in to comment.