osuboot/osuboot.sh
2023-08-16 13:06:19 +02:00

79 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
##########################
## osu!boot ##
## Made by JeremyStarTM ##
## Licensed under the ##
## GNU GPL v3 ##
##########################
export "OSUBOOT_NETCONNECT=false"
function prepare(){
echo "Preparing osu!boot"
if [ -d "/tmp/osuboot/" ]; then
rm -rf "/tmp/osuboot/" &> /tmp/osuboot_rm.log
fi
mkdir "/tmp/osuboot" -p
if [ -f "/tmp/osuboot_rm.log" ]; then
mv "/tmp/osuboot_rm.log" "/tmp/osuboot/rm.log"
fi
sleep 1s
}
function checkInternet() {
ping 1.1.1.1 -c 1 &> /dev/null
if [ ! "$?" == "0" ]; then
echo "Checking internet connectivity: No internet (IPv4)"
return
fi
ping one.one.one.one -c 1 &> /dev/null
if [ ! "$?" == "0" ]; then
echo "Checking internet connectivity: No internet (DNS)"
return
fi
echo "Checking internet connectivity"
export "OSUBOOT_NETCONNECT=true"
}
function downloadGame(){
if [ "$OSUBOOT_NETCONNECT" == "false" ]; then
echo "Downloading osu!lazer: Skipping, no internet available"
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
}
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
fi
echo "Launching osu!lazer"
"$HOME"/.cache/osu.AppImage &> /tmp/osuboot/osu.proclog
}
function notice(){
if [ "$1" == "startup" ]; then
echo " _ _ _ "
echo " ___ ___ _ _| | |__ ___ ___ | |_ "
echo " / _ \/ __| | | | | '_ \ / _ \ / _ \| __|"
echo "| (_) \__ \ |_| |_| |_) | (_) | (_) | |_ "
echo " \___/|___/\__,_(_)_.__/ \___/ \___/ \__|"
echo ""
elif [ "$1" == "exit" ]; then
echo ""
echo "osu!boot is being developed by the StarOpenSource Project, is designed"
echo "to be used with osu!launcher and is maintained by JeremyStarTM."
else
echo "Invalid notice."
return
fi
}
function run() {
notice "startup"
prepare
checkInternet
downloadGame
runGame
notice "exit"
}
run