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