Add step to download mods through zenity.

This commit is contained in:
Auke Kok 2016-03-26 22:26:12 -07:00
parent fccd3a4525
commit 92396cf007

View File

@ -7,7 +7,7 @@
cd `dirname $0`
if [ ! -f map_content.txt ]; then
zenity --info --text "Unable to locate \"map_content.txt\" file - this is a critical error, and this program is unable to continue."
zenity --info --width=800 --text "Unable to locate \"map_content.txt\" file - this is a critical error, and this program is unable to continue."
exit 1
fi
@ -17,16 +17,16 @@ while true; do
IN="`dirname "$IN"`"
fi
if [ ! -d "$IN" ]; then
zenity --info --text "The chosen entry \"$IN\" is not a folder. Try selecting a folder that has a \"level.dat\" file inside."
zenity --width=800 --info --text "The chosen entry \"$IN\" is not a folder. Try selecting a folder that has a \"level.dat\" file inside."
exit 1
fi
break
done
OUT=`zenity --entry --entry-text="$(basename "$IN")" --text="Type the output name of the converted world:"`
OUT=`zenity --width=800 --entry --entry-text="$(basename "$IN")" --text="Type the output name of the converted world:"`
if [ -d "${HOME}/.minetest/worlds/$OUT" ]; then
if ! `zenity --question --title="Overwrite existing world?" --text="The world \"$OUT\" already exists, do you want to overwrite it?" --default-cancel`; then
if ! `zenity --question --width=800 --title="Overwrite existing world?" --text="The world \"$OUT\" already exists, do you want to overwrite it?" --default-cancel`; then
exit 1
fi
rm -rf "${HOME}/.minetest/worlds/$OUT"
@ -36,3 +36,19 @@ zenity --info --width=800 --title="Conversion in progress" --text="The conversio
python3 mcimport.py "$IN" "${HOME}/.minetest/worlds/$OUT"
if [ $? == 0 ]; then
if ! zenity --width=800 --question --title="Download required mods?" --text="The world was succesfully converted. Do you want me to download and install all the required mods now?"; then
exit 0
fi
cd "${HOME}/.minetest/worlds/$OUT"
(
bash get-mods.sh
echo "====================="
echo "Finished! You can now close this window!"
) | zenity --text-info --width=800 --height=600 --title='Downloading required mods.' --text='Downloading...'
else
zenity --info --width=800 --text "Conversion didn't finish normally, the resulting world may not be playable."
exit 1
fi
zenity --width=800 --info --text "Conversion finished! Your world should now be playable in Minetest."