new: add pool path option

This commit is contained in:
ngn 2024-08-10 23:56:33 +03:00
parent 9f18a78aa0
commit a93feb77d0
4 changed files with 27 additions and 15 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-08 15:46+0300\n"
"POT-Creation-Date: 2024-08-10 23:56+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,27 +17,27 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/config.c:125
#: src/config.c:130
#, c-format
msgid "Unknown configuration option: %s"
msgstr ""
#: src/config.c:127
#: src/config.c:132
#, c-format
msgid "Unknown configuration option: %s/%s"
msgstr ""
#: src/config.c:135
#: src/config.c:140
#, fuzzy, c-format
msgid "Failed to access the configuration file: %s"
msgstr "Kayıt dosyasını açmak başarısız oldu: %s"
#: src/config.c:140
#: src/config.c:145
#, fuzzy
msgid "Failed to parse the configuration"
msgstr "Kayıt dosyasını açmak başarısız oldu: %s"
#: src/config.c:147
#: src/config.c:152
#, fuzzy, c-format
msgid "Hostname not specified for the pool: %s"
msgstr "Ana makine adı havuz konfigürasyonunda belirtilmedi, geçiliyor: %s"
@ -118,37 +118,37 @@ msgstr "%s: havuz bilgisi başarıyla yüklendi"
msgid "%s: hostname not specified for pool, skipping"
msgstr "Ana makine adı havuz konfigürasyonunda belirtilmedi, geçiliyor: %s"
#: src/main.c:157
#: src/main.c:163
#, fuzzy, c-format
msgid "%s: failed access the pool directory (%s)"
msgstr "Havuz dizinine erişilemiyor: %s"
#: src/main.c:162
#: src/main.c:168
#, fuzzy, c-format
msgid "%s: failed to add pool to the list (%s)"
msgstr "Havuzu listeye eklemek başarısız oldu: %s"
#: src/main.c:170
#: src/main.c:176
#, c-format
msgid "Failed to sync the pools: %s"
msgstr "Havuzları sekronize etmek başarısız oldu: %s"
#: src/main.c:175
#: src/main.c:181
#, fuzzy
msgid "None of the pools is available for serving"
msgstr "Havuzların hiçbiri sunmak için müsait değil"
#: src/main.c:179
#: src/main.c:185
#, c-format
msgid "Serving %lu pool on %s"
msgstr "%lu tane havuz %s adresinde sunuluyor"
#: src/main.c:179
#: src/main.c:185
#, c-format
msgid "Serving %lu pools on %s"
msgstr "%lu tane havuz %s adresinde sunuluyor"
#: src/main.c:182
#: src/main.c:188
#, c-format
msgid "Failed to start the server: %s"
msgstr "Sunucuyu başlatmak başarısız oldu: %s"

View File

@ -110,6 +110,11 @@ int config_load_handler(void *data, const char *_section, const char *_key, cons
config.pools->host = strdup(value);
}
else if (eq(key, "path")) {
free(config.pools->path);
config.pools->path = strdup(value);
}
else if (eq(key, "dir")) {
free(config.pools->dir);
config.pools->dir = strdup(value);

View File

@ -23,6 +23,7 @@ typedef struct pool_config {
struct pool_config *next;
char *name;
char *host;
char *path;
char *dir;
} pool_config_t;

View File

@ -150,8 +150,14 @@ int main(int argc, char *argv[]) {
goto end_ctx;
}
char url[strlen(pool->host) + 20];
sprintf(url, "mptp://%s", pool->host);
char url[strlen(pool->host) + 20 + (pool->path == NULL ? 0 : strlen(pool->path))];
if (NULL == pool->path)
sprintf(url, "mptp://%s/", pool->host);
else if (pool->path[0] == '/')
sprintf(url, "mptp://%s%s", pool->host, pool->path);
else
sprintf(url, "mptp://%s/%s", pool->host, pool->path);
if (!file_canread(pool->dir)) {
error(_("%s: failed access the pool directory (%s)"), pool->name, pool->dir);