Skip to content

Commit

Permalink
base: Add support for Zip file
Browse files Browse the repository at this point in the history
- Now in the lnls-get-n-unpack function it is possible to download and unzip .zip files.
  • Loading branch information
guirodrigueslima committed Jul 30, 2024
1 parent fb01279 commit 6291836
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN apt update -y && \
libxml2-dev \
libssl-dev \
re2c \
unzip \
wget \
python3-dev \
python3-numpy \
Expand Down
12 changes: 11 additions & 1 deletion base/lnls-get-n-unpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ for url; do

echo Downloading "$url"...
wget -P $download_dir -o /tmp/wget.log "$url" || (cat /tmp/wget.log && false)
tar --no-same-owner -xf $download_dir/* -C $dest

filename=`ls $download_dir/*`
filename=${filename//$download_dir"/"}

if [[ $filename == *".zip" ]]; then
unzip $download_dir/* -d "${dest}/${filename%.zip}"
elif [[ $filename == *".tar.gz" ]]; then
tar --no-same-owner -xf $download_dir/* -C $dest
fi

rm -rf $download_dir /tmp/wget.log

done

0 comments on commit 6291836

Please sign in to comment.