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:
Matthew Johnson
2018-04-30 14:25:57 -07:00
parent 15e66263bf
commit efca683d10
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -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);
}
+2
View File
@@ -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/"