Fix update check

This commit is contained in:
Aaron Dewes 2022-02-02 19:13:20 +01:00
parent c12fdf794b
commit d44bf72b93
12 changed files with 73 additions and 25 deletions

View File

@ -1,11 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "app.yml specification v1",
"description": "The app.yml format, cleaned up. This format should be used for new apps, but the autoconverter can only convert to v0, so v0 will be kept for some time.",
"title": "Citadel app.yml v1",
"description": "The first draft of Citadel's app.yml format",
"type": "object",
"properties": {
"version": {
"type": ["string", "number"],
"type": [
"string",
"number"
],
"description": "The version of the app.yml format you're using."
},
"metadata": {
@ -111,13 +114,22 @@
"type": "array",
"items": {
"type": "string",
"enum": ["lnd", "bitcoind", "electrum", "root", "hw"]
"enum": [
"lnd",
"bitcoind",
"electrum",
"root",
"hw"
]
}
},
"ports": {
"type": "array",
"items": {
"type": ["string", "number"]
"type": [
"string",
"number"
]
}
},
"port": {
@ -125,7 +137,7 @@
"description": "If this is the main container, the port inside the container which will be exposed to the outside as the port specified in metadata."
},
"environment": {
"type": ["object", "array"]
"type": "object"
},
"data": {
"type": "array",
@ -147,11 +159,21 @@
"description": "The services the container depends on"
},
"entrypoint": {
"type": ["string", "array"],
"type": [
"string",
"array"
],
"description": "The entrypoint for the container"
},
"bitcoin_mount_dir": {
"type": "string",
"description": "Where to mount the bitcoin dir"
},
"command": {
"type": ["string", "array"],
"type": [
"string",
"array"
],
"description": "The command for the container"
},
"init": {
@ -179,17 +201,30 @@
"description": "Set this to a map of service names to hidden service ports if your container exposes multiple ports, and all of them should be hidden services.",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": ["number", "array"]
"type": [
"number",
"array"
]
}
}
},
"restart": {
"type": "string",
"description": "When the container should restart. Can be 'always' or 'on-failure'."
}
},
"additionalProperties": false
"additionalProperties": false,
"required": [
"name",
"image"
]
},
"required": ["name", "image"],
"additionalProperties": false
}
},
"required": ["metadata", "containers"],
"required": [
"metadata",
"containers"
],
"additionalProperties": false
}

View File

@ -5,7 +5,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import json
from lib.manage import compose, createDataDir, deleteData, getUserData, setInstalled, setRemoved, startInstalled, stopInstalled, update, deriveEntropy, updateRepos, download
from lib.manage import compose, createDataDir, deleteData, getUserData, setInstalled, setRemoved, startInstalled, stopInstalled, update, deriveEntropy, updateRepos, download, getAvailableUpdates
from lib.validate import findAndValidateApps
import os
import argparse
@ -47,8 +47,7 @@ if args.action == 'list':
exit(0)
elif args.action == "list-updates":
availableUpdates = getAvailableUpdates()
for app in availableUpdates:
print(app)
print(json.dumps(availableUpdates))
exit(0)
elif args.action == 'download':
updateRepos()

View File

@ -5,6 +5,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import stat
import sys
import tempfile
import threading
from typing import List
@ -124,9 +125,10 @@ def getAvailableUpdates():
for app in apps:
try:
if checkUpdateAvailable(app):
availableUpdates.push(app)
availableUpdates.append(app)
except Exception:
print("Can't check app {} yet".format(app))
print("Warning: Can't check app {} yet".format(app), file=sys.stderr)
return availableUpdates
def startInstalled():
# If userfile doesn't exist, just do nothing

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020 Umbrel. https://getumbrel.com
# SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@web.de>
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
# SPDX-FileCopyrightText: 2021 https://github.com/o3o3o
#
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020 Umbrel. https://getumbrel.com
# SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@web.de>
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
# SPDX-FileCopyrightText: 2021 https://github.com/o3o3o
#
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@web.de>
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later

12
events/triggers/get-app-updates Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
CITADEL_ROOT="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../..)"
OUTPUT_FILE="${CITADEL_ROOT}/statuses/available-updates.json"
echo "false" > "${OUTPUT_FILE}"
"${CITADEL_ROOT}/scripts/app" list-updates > "${OUTPUT_FILE}"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@web.de>
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020 Umbrel. https://getumbrel.com
# SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@web.de>
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020 Umbrel. https://getumbrel.com
# SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@web.de>
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020 Umbrel. https://getumbrel.com
# SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@web.de>
# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 Aaron Dewes <aaron.dewes@web.de>
SPDX-FileCopyrightText: 2021-2022 Citadel and contributors
SPDX-License-Identifier: GPL-3.0-or-later