minetest-mods/update-mods.sh

24 lines
578 B
Bash

#!/bin/bash
echo "updating mod list"
wget -O mods.txt https://git.sp-codes.de/minetest/minetest-mods/raw/branch/master/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