umoria: refactor and extend
- Simplify some symlinking - Don't remove the temporary run directory: umoria allows for dumping character info, which would be in there and inaccessible after saving the game otherwise. The system takes care of cleaning up the temporary directory anyway. - Allow passing arguments to the wrapped executable, allowing using different save directories, passing game seeds, checking out highscores, etc.
This commit is contained in:
parent
bfc755d4d0
commit
acf302428e
1 changed files with 10 additions and 12 deletions
|
@ -38,24 +38,22 @@ gcc9Stdenv.mkDerivation rec {
|
||||||
|
|
||||||
RUNDIR=\$(mktemp -d)
|
RUNDIR=\$(mktemp -d)
|
||||||
|
|
||||||
cleanup() {
|
# Print the directory, so users have access to dumps, and let the system
|
||||||
rm -rf \$RUNDIR
|
# take care of cleaning up temp files.
|
||||||
}
|
echo "Running umoria in \$RUNDIR"
|
||||||
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
cd \$RUNDIR
|
cd \$RUNDIR
|
||||||
mkdir data
|
ln -sn $out/data \$RUNDIR/data
|
||||||
|
|
||||||
for i in $out/data/*; do
|
|
||||||
ln -s \$i "data/\$(basename \$i)"
|
|
||||||
done
|
|
||||||
|
|
||||||
mkdir -p ${savesDir}
|
mkdir -p ${savesDir}
|
||||||
[[ ! -f ${savesDir}/scores.dat ]] && touch ${savesDir}/scores.dat
|
[[ ! -f ${savesDir}/scores.dat ]] && touch ${savesDir}/scores.dat
|
||||||
ln -s ${savesDir}/scores.dat scores.dat
|
ln -s ${savesDir}/scores.dat scores.dat
|
||||||
|
|
||||||
$out/.umoria-unwrapped ${savesDir}/game.sav
|
if [ \$# -eq 0 ]; then
|
||||||
|
$out/.umoria-unwrapped ${savesDir}/game.sav
|
||||||
|
else
|
||||||
|
$out/.umoria-unwrapped "\$@"
|
||||||
|
fi
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x $out/bin/umoria
|
chmod +x $out/bin/umoria
|
||||||
|
@ -74,7 +72,7 @@ gcc9Stdenv.mkDerivation rec {
|
||||||
'';
|
'';
|
||||||
platforms = platforms.unix;
|
platforms = platforms.unix;
|
||||||
badPlatforms = [ "aarch64-darwin" ];
|
badPlatforms = [ "aarch64-darwin" ];
|
||||||
maintainers = [ maintainers.aciceri ];
|
maintainers = with maintainers; [ aciceri kenran ];
|
||||||
license = licenses.gpl3Plus;
|
license = licenses.gpl3Plus;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue