Read distro repo branch from /etc and append it to the final vendor url

This commit is contained in:
Martinvlba 2023-06-30 23:30:18 +03:00
parent 4de25042c2
commit 138935f341

View File

@ -72,12 +72,31 @@ pk_alpm_pkg_build_urls (alpm_pkg_t *pkg)
{
gchar **urls = g_new0 (gchar *, 2);
urls[0] = g_strdup_printf ("https://files.martinvlba.eu/evolinx-staging/%s/packages/%s-%s-%s.pkg.tar.gz",
// Get the distro branch ( check if evolinx or -staging by reading /etc/os-branch )
char distro[15];
FILE* gdistro;
gdistro = fopen("/etc/os-branch", "r");
if (NULL == gdistro) {
// Print to systemctl status
printf("\n####\n");
printf("# EVOLINX: Please update youre base-(system,chroot,minimal) for new filesystem additions\n");
printf("####\n");
exit(1);
}
urls[0] = g_strdup_printf ("https://files.martinvlba.eu/%s/%s/packages/%s-%s-%s.pkg.tar.gz",
fgets(distro, 15, gdistro),
alpm_db_get_name (alpm_pkg_get_db (pkg)),
alpm_pkg_get_name (pkg),
alpm_pkg_get_version (pkg),
alpm_pkg_get_arch (pkg));
fclose(gdistro);
return urls;
}