Browse Source

Add 'update-mods.sh'

master
Samuel Philipp 1 year ago
parent
commit
d338c34677
  1. 23
      update-mods.sh

23
update-mods.sh

@ -0,0 +1,23 @@
#!/bin/bash
echo "updating mod list"
curl https://git.sp-codes.de/minetest/minetest-mods/raw/branch/master/mods.txt > mods.txt
BASE=mods
while IFS="" read -r line || [ -n "$line" ]
do
IFS=' ' read -ra mod <<< "$line"
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"
fi
echo "cleanup"
rm temp.zip
done < mods.txt
Loading…
Cancel
Save