Update 'update-mods.sh'

This commit is contained in:
Samuel Philipp 2021-02-20 21:52:20 +00:00
parent af610ae82d
commit e9d69622b3

View file

@ -11,13 +11,15 @@ do
echo "downloading ${mod[0]}"
wget -q "${mod[1]}" -O temp.zip
echo "extracting ${mod[0]}"
unzip -oq temp.zip -d "$BASE/${mod[0]}"
FIRST=$(zipinfo -1 temp.zip | head -n 1)
if [[ "$FIRST" == */ ]]
then
cp -r "$BASE/${mod[0]}/$FIRST"* "$BASE/${mod[0]}/"
rm -r "$BASE/${mod[0]}/$FIRST"
unzip -oq temp.zip -d temp
rm -rf "$BASE/${mod[0]}/"
mkdir -p "$BASE/${mod[0]}/"
if [[ $(find temp/* -maxdepth 0 -type d | wc -l) == 1 ]]; then
cp -r temp/*/* "$BASE/${mod[0]}"
else
cp -r temp/* "$BASE/${mod[0]}"
fi
echo "cleanup"
rm -rf temp
rm temp.zip
done < mods.txt