Merge pull request #178141 from kenranunderscore/continue-umoria-characters

umoria: fix savefile persistence (#178136); refactor and extend

authored by Guillaume Girol and committed by GitHub 2417363a a4716292

+11 -13
+11 -13
pkgs/games/umoria/default.nix
··· 8 }: 9 10 let 11 - savesDir = "~/.umoria/"; 12 in 13 gcc9Stdenv.mkDerivation rec { 14 pname = "umoria"; ··· 38 39 RUNDIR=\$(mktemp -d) 40 41 - cleanup() { 42 - rm -rf \$RUNDIR 43 - } 44 - 45 - trap cleanup EXIT 46 47 cd \$RUNDIR 48 - mkdir data 49 - 50 - for i in $out/data/*; do 51 - ln -s \$i "data/\$(basename \$i)" 52 - done 53 54 mkdir -p ${savesDir} 55 [[ ! -f ${savesDir}/scores.dat ]] && touch ${savesDir}/scores.dat 56 ln -s ${savesDir}/scores.dat scores.dat 57 58 - $out/.umoria-unwrapped 59 EOF 60 61 chmod +x $out/bin/umoria ··· 74 ''; 75 platforms = platforms.unix; 76 badPlatforms = [ "aarch64-darwin" ]; 77 - maintainers = [ maintainers.aciceri ]; 78 license = licenses.gpl3Plus; 79 }; 80 }
··· 8 }: 9 10 let 11 + savesDir = "~/.umoria"; 12 in 13 gcc9Stdenv.mkDerivation rec { 14 pname = "umoria"; ··· 38 39 RUNDIR=\$(mktemp -d) 40 41 + # Print the directory, so users have access to dumps, and let the system 42 + # take care of cleaning up temp files. 43 + echo "Running umoria in \$RUNDIR" 44 45 cd \$RUNDIR 46 + ln -sn $out/data \$RUNDIR/data 47 48 mkdir -p ${savesDir} 49 [[ ! -f ${savesDir}/scores.dat ]] && touch ${savesDir}/scores.dat 50 ln -s ${savesDir}/scores.dat scores.dat 51 52 + if [ \$# -eq 0 ]; then 53 + $out/.umoria-unwrapped ${savesDir}/game.sav 54 + else 55 + $out/.umoria-unwrapped "\$@" 56 + fi 57 EOF 58 59 chmod +x $out/bin/umoria ··· 72 ''; 73 platforms = platforms.unix; 74 badPlatforms = [ "aarch64-darwin" ]; 75 + maintainers = with maintainers; [ aciceri kenran ]; 76 license = licenses.gpl3Plus; 77 }; 78 }