Add caching

This commit is contained in:
JeremyStar™ 2024-03-14 21:08:16 +01:00
parent 39406477fe
commit 7266d65dfb

View file

@ -37,13 +37,14 @@ function downloadGame(){
return
fi
echo "Downloading osu!lazer"
wget "https://github.com/ppy/osu/releases/latest/download/osu.AppImage" -O /tmp/osuboot/osu.AppImage &> /tmp/osuboot/download.log
chmod +x /tmp/osuboot/osu.AppImage
if [ ! -f "$HOME/.cache/osu.AppImage" ] || [[ $(find "$HOME/.cache/osu.AppImage" -mtime +1 -print) ]]; then
wget "https://github.com/ppy/osu/releases/latest/download/osu.AppImage" -O "$HOME/.cache/osu.AppImage" &> /tmp/osuboot/download.log
else
echo "Downloading osu!lazer: Skipping, download is not yet a day old"
fi
chmod +x "$HOME/.cache/osu.AppImage"
}
function runGame(){
if [ -f "/tmp/osuboot/osu.AppImage" ]; then
mv "/tmp/osuboot/osu.AppImage" "$HOME/.cache/osu.AppImage"
fi
if [ ! -f "$HOME/.cache/osu.AppImage" ]; then
echo "Launching osu!lazer: osu!lazer is missing and can't be launched."
return