From 7266d65dfb46b47f6000dfc30e0a2fd168af3afc Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Thu, 14 Mar 2024 21:08:16 +0100 Subject: [PATCH] Add caching --- osuboot.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osuboot.sh b/osuboot.sh index 8bd8e26..b1664b5 100755 --- a/osuboot.sh +++ b/osuboot.sh @@ -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