#!/bin/bash #Dependencies : you'll need a dmenu-like to run this script. #On debian and debian-like distros (ubuntu, mint...), simply run: # sudo apt install dmenu #Edit this line to meet your installation factorio_dir="/DATA/Games/factorio" cd $factorio_dir/saves #Ask the user to select a save save=$(ls -t *.zip | grep -v autosave | rev | cut -d "." -f 2- | rev | dmenu) test $? -ne 0 && echo "No save selected" && exit 1 #Check if a modlist exists for that save if test -s mod-list.json_$save ; then modlist=$save else #Otherwise, prompt to load another modlist modlist=$(ls -t mod-list.json_* | cut -d "_" -f 2- | dmenu -p "No mod list found for savegame $save. Select mod list from available: ") test $? -ne 0 && echo "No modlist selected" && exit 1 #And prompt to save it for later echo -e "yes\nno" | dmenu -p "Save selected modlist for savegame $save ?" | grep "yes" && cp mod-list.json_$modlist mod-list.json_$save && modlist=$save fi #Link that modlist to the file read by factorio ln -fs ../saves/mod-list.json_$modlist ../mods/mod-list.json #Launch the game and the requested save cd .. echo "$factorio_dir/bin/x64/factorio --load-game $factorio_dir/saves/$save.zip" $factorio_dir/bin/x64/factorio --load-game $factorio_dir/saves/$save.zip