Add $OSUBOOT_MAX_CACHE_TIME config variable
This commit is contained in:
parent
615a0f781e
commit
9c14e94090
1 changed files with 12 additions and 1 deletions
13
osuboot.sh
13
osuboot.sh
|
@ -17,6 +17,7 @@
|
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Process environment variables
|
||||
# COLORLESS
|
||||
if [ -z "${OSUBOOT_COLORLESS}" ]; then
|
||||
COLOR_SPECIAL="\e[0;35m"
|
||||
COLOR_DEFAULT="\e[0;37m"
|
||||
|
@ -25,6 +26,16 @@ if [ -z "${OSUBOOT_COLORLESS}" ]; then
|
|||
COLOR_OTHER="\e[0;33m"
|
||||
RESET="\e[0m"
|
||||
fi
|
||||
# MAX_CACHE_TIME
|
||||
if [ -z "${OSUBOOT_MAX_CACHE_TIME}" ]; then
|
||||
OSUBOOT_MAX_CACHE_TIME=1
|
||||
elif [[ ! ${OSUBOOT_MAX_CACHE_TIME} == ?(-)+([0-9]) ]]; then
|
||||
echo "Initialization error: \$OSUBOOT_MAX_CACHE_TIME is not a valid integer"
|
||||
exit 1
|
||||
elif [ "${OSUBOOT_MAX_CACHE_TIME}" -lt "1" ]; then
|
||||
echo "Initialization error: \$OSUBOOT_MAX_CACHE_TIME must be at least 1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Display startup messages
|
||||
echo -en "${COLOR_SPECIAL}"
|
||||
|
@ -87,7 +98,7 @@ fi
|
|||
# Download osu!lazer
|
||||
echo -en "${COLOR_DEFAULT}:: Downloading osu!lazer"
|
||||
if [ -z "${OSUBOOT_DRYRUN}" ]; then
|
||||
if [ ! -f "$HOME/.cache/osu.AppImage" ] || [ -n "$(find "$HOME/.cache/osu.AppImage" -ctime +1 2>/dev/null)" ]; then
|
||||
if [ ! -f "$HOME/.cache/osu.AppImage" ] || [ -n "$(find "$HOME/.cache/osu.AppImage" -ctime "+${OSUBOOT_MAX_INITIALIZATION_TIME}" 2>/dev/null)" ]; then
|
||||
echo -e "${RESET}"
|
||||
wget --quiet --show-progress -O "$HOME/.cache/osu.AppImage.tmp" "https://github.com/ppy/osu/releases/latest/download/osu.AppImage"
|
||||
mv "${HOME}/.cache/osu.AppImage.tmp" "${HOME}/.cache/osu.AppImage"
|
||||
|
|
Loading…
Reference in a new issue