mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
version checking using "done" files
This commit is contained in:
@@ -10,12 +10,18 @@ from http_host_lib.utils import download_file_aria2, get_remote_file_size
|
||||
def download_area_version(area: str, version: str) -> bool:
|
||||
"""
|
||||
Downloads and uncompresses tiles.btrfs files from the btrfs bucket
|
||||
|
||||
"latest" version means the latest in the remote bucket
|
||||
"deployed" version means to read the currently deployed version string from the config dir
|
||||
"""
|
||||
|
||||
if area not in config.areas:
|
||||
sys.exit(f' please specify area: {config.areas}')
|
||||
sys.exit(f' Please specify area: {config.areas}')
|
||||
|
||||
versions = get_versions_for_area(area)
|
||||
if not versions:
|
||||
print(f' No version found for {area}')
|
||||
return False
|
||||
|
||||
# latest version
|
||||
if version == 'latest':
|
||||
@@ -32,9 +38,10 @@ def download_area_version(area: str, version: str) -> bool:
|
||||
else:
|
||||
if version not in versions:
|
||||
available_versions_str = '\n'.join(versions)
|
||||
sys.exit(
|
||||
f'Requested version is not available.\nAvailable versions for {area}:\n{available_versions_str}'
|
||||
print(
|
||||
f' Requested version is not available.\nAvailable versions for {area}:\n{available_versions_str}'
|
||||
)
|
||||
return False
|
||||
selected_version = version
|
||||
|
||||
return download_and_extract_btrfs(area, selected_version)
|
||||
|
||||
@@ -19,11 +19,16 @@ class Configuration:
|
||||
certs_dir = Path('/data/nginx/certs')
|
||||
nginx_confs = Path(__file__).parent / 'nginx_confs'
|
||||
|
||||
ofm_config_dir = Path('/data/ofm/config')
|
||||
deployed_versions_dir = ofm_config_dir / 'deployed_versions'
|
||||
if Path('/data/ofm').exists():
|
||||
ofm_config_dir = Path('/data/ofm/config')
|
||||
else:
|
||||
repo_root = Path(__file__).parent.parent.parent.parent
|
||||
ofm_config_dir = repo_root / 'config'
|
||||
|
||||
ofm_config = json.loads((ofm_config_dir / 'config.json').read_text())
|
||||
|
||||
deployed_versions_dir = ofm_config_dir / 'deployed_versions'
|
||||
|
||||
rclone_config = ofm_config_dir / 'rclone.conf'
|
||||
rclone_bin = subprocess.run(['which', 'rclone'], capture_output=True, text=True).stdout.strip()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user