2021-02-20 16:30:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
echo "updating mod list"
|
2021-02-20 16:43:14 +00:00
|
|
|
wget -O mods.txt https://git.sp-codes.de/minetest/minetest-mods/raw/branch/master/mods.txt
|
2021-02-20 16:30:10 +00:00
|
|
|
|
|
|
|
BASE=mods
|
|
|
|
|
|
|
|
while IFS="" read -r line || [ -n "$line" ]
|
|
|
|
do
|
|
|
|
IFS=' ' read -ra mod <<< "$line"
|
|
|
|
echo "downloading ${mod[0]}"
|
2021-03-06 21:37:36 +00:00
|
|
|
sleep 1
|
2021-02-20 16:30:10 +00:00
|
|
|
wget -q "${mod[1]}" -O temp.zip
|
|
|
|
echo "extracting ${mod[0]}"
|
2021-02-20 21:52:20 +00:00
|
|
|
unzip -oq temp.zip -d temp
|
|
|
|
rm -rf "$BASE/${mod[0]}/"
|
|
|
|
mkdir -p "$BASE/${mod[0]}/"
|
2021-03-06 21:37:36 +00:00
|
|
|
if [[ $(find temp/* -maxdepth 0 | wc -l) == 1 ]]; then
|
2021-02-20 21:52:20 +00:00
|
|
|
cp -r temp/*/* "$BASE/${mod[0]}"
|
|
|
|
else
|
|
|
|
cp -r temp/* "$BASE/${mod[0]}"
|
2021-02-20 16:30:10 +00:00
|
|
|
fi
|
|
|
|
echo "cleanup"
|
2021-02-20 21:52:20 +00:00
|
|
|
rm -rf temp
|
2021-02-20 16:30:10 +00:00
|
|
|
rm temp.zip
|
|
|
|
done < mods.txt
|