Fixed update

pull/6/head
Dominik Dzienia 8 months ago
parent 8b9df0f7e6
commit 58d45c9f8c

@ -1081,7 +1081,7 @@ extract_version() {
}
read_or_default() {
if [ -f $1 ]; then
if [ -f "$1" ]; then
cat "$1"
else
if [ $# -eq 2 ]; then
@ -1104,9 +1104,10 @@ download_updates() {
download_if_needed() {
local lastCheck=$(read_or_default "$UPDATES_DIR/timestamp")
local lastDownload=$(read_or_default "$UPDATES_DIR/downloaded" "")
local timestampNow=$(date +%s)
local updateCheck=$UPDATE_CHECK
if (((timestampNow - lastCheck) > updateCheck)) || [ $# -eq 1 ] || (( forceUpdateCheck == 1 )); then
if (((timestampNow - lastCheck) > updateCheck)) || [ "$lastDownload" == "" ] || ((forceUpdateCheck == 1)); then
echo "$timestampNow" >"$UPDATES_DIR/timestamp"
ohai "Checking if new version is available..."
local onlineUpdated="$(curl -fsSL "https://gitea.dzienia.pl/shared/mikrus-installer/raw/branch/$UPDATE_CHANNEL/updated")"
@ -1117,7 +1118,6 @@ download_if_needed() {
echo "$onlineUpdated" >"$UPDATES_DIR/downloaded"
download_updates
fi
else
msgok "Too soon to download update, skipping..."
fi

@ -1065,7 +1065,7 @@ extract_version() {
}
read_or_default() {
if [ -f $1 ]; then
if [ -f "$1" ]; then
cat "$1"
else
if [ $# -eq 2 ]; then
@ -1088,9 +1088,10 @@ download_updates() {
download_if_needed() {
local lastCheck=$(read_or_default "$UPDATES_DIR/timestamp")
local lastDownload=$(read_or_default "$UPDATES_DIR/downloaded" "")
local timestampNow=$(date +%s)
local updateCheck=$UPDATE_CHECK
if (((timestampNow - lastCheck) > updateCheck)) || [ $# -eq 1 ] || (( forceUpdateCheck == 1 )); then
if (((timestampNow - lastCheck) > updateCheck)) || [ "$lastDownload" == "" ] || ((forceUpdateCheck == 1)); then
echo "$timestampNow" >"$UPDATES_DIR/timestamp"
ohai "Checking if new version is available..."
local onlineUpdated="$(curl -fsSL "https://gitea.dzienia.pl/shared/mikrus-installer/raw/branch/$UPDATE_CHANNEL/updated")"
@ -1101,7 +1102,6 @@ download_if_needed() {
echo "$onlineUpdated" >"$UPDATES_DIR/downloaded"
download_updates
fi
else
msgok "Too soon to download update, skipping..."
fi

@ -1 +1 @@
2024-10-25T12:32:17.951Z
2024-10-25T13:51:37.691Z
Loading…
Cancel
Save