mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-04 15:58:22 +00:00
Add mirror configuration for contenturl/versionurl
To allow swupd users located in geos far from the default Clear Linux CDN to get efficient download speeds, allow them to set a mirror content and version url under /etc/swupd/mirror_contenturl /etc/swupd/mirror_versionurl Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This commit is contained in:
@@ -315,6 +315,12 @@ int set_content_url(char *url)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check for mirror configuration first */
|
||||
if (set_url(&content_url, url, MIRROR_CONTENT_URL_PATH) == 0) {
|
||||
content_url_is_local = strncmp(content_url, "file://", 7) == 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ret = set_url(&content_url, url, DEFAULT_CONTENT_URL_PATH);
|
||||
if (ret == 0) {
|
||||
content_url_is_local = strncmp(content_url, "file://", 7) == 0;
|
||||
@@ -334,6 +340,11 @@ int set_version_url(char *url)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check for mirror configuration first */
|
||||
if (set_url(&version_url, url, MIRROR_VERSION_URL_PATH) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return set_url(&version_url, url, DEFAULT_VERSION_URL_PATH);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,9 @@ extern "C" {
|
||||
#define MIXED_FILE SWUPD_DEFAULTS "mixed"
|
||||
|
||||
#define DEFAULT_VERSION_URL_PATH "/usr/share/defaults/swupd/versionurl"
|
||||
#define MIRROR_VERSION_URL_PATH "/etc/swupd/mirror_versionurl"
|
||||
#define DEFAULT_CONTENT_URL_PATH "/usr/share/defaults/swupd/contenturl"
|
||||
#define MIRROR_CONTENT_URL_PATH "/etc/swupd/mirror_contenturl"
|
||||
#define DEFAULT_FORMAT_PATH "/usr/share/defaults/swupd/format"
|
||||
|
||||
#define DEFAULT_CONTENTURL "https://cdn.download.clearlinux.org/update/"
|
||||
|
||||
Reference in New Issue
Block a user