aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-git-receiver
diff options
context:
space:
mode:
Diffstat (limited to 'src/blogc-git-receiver')
-rw-r--r--src/blogc-git-receiver/pre-receive.c9
-rw-r--r--src/blogc-git-receiver/settings.c19
-rw-r--r--src/blogc-git-receiver/settings.h3
-rw-r--r--src/blogc-git-receiver/shell.c2
4 files changed, 23 insertions, 10 deletions
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c
index 897e8f0..9611567 100644
--- a/src/blogc-git-receiver/pre-receive.c
+++ b/src/blogc-git-receiver/pre-receive.c
@@ -199,15 +199,16 @@ default_sym:
goto cleanup;
}
- const char *bd = bgr_settings_get_basedir();
- if (bd == NULL) {
- fprintf(stderr, "error: failed to find user base directory path\n");
+ char *buildsd = bgr_settings_get_builds_dir();
+ if (buildsd == NULL) {
+ fprintf(stderr, "error: failed to find builds directory path\n");
rv = 3;
goto cleanup;
}
unsigned long epoch = time(NULL);
- output_dir = bc_strdup_printf("%s/builds/%s-%lu", bd, master, epoch);
+ output_dir = bc_strdup_printf("%s/%s-%lu", buildsd, master, epoch);
+ free(buildsd);
if (0 == access(output_dir, F_OK)) {
char *tmp = output_dir;
diff --git a/src/blogc-git-receiver/settings.c b/src/blogc-git-receiver/settings.c
index 514fcdf..4cfcaf7 100644
--- a/src/blogc-git-receiver/settings.c
+++ b/src/blogc-git-receiver/settings.c
@@ -20,9 +20,9 @@
const char*
-bgr_settings_get_basedir(void)
+bgr_settings_get_base_dir(void)
{
- char *rv = getenv("BLOGC_GIT_RECEIVER_BASEDIR");
+ char *rv = getenv("BLOGC_GIT_RECEIVER_BASE_DIR");
if (rv != NULL) {
return rv;
}
@@ -31,9 +31,20 @@ bgr_settings_get_basedir(void)
char*
+bgr_settings_get_builds_dir(void)
+{
+ char *rv = getenv("BLOGC_GIT_RECEIVER_BUILDS_DIR");
+ if (rv != NULL) {
+ return bc_strdup(rv);
+ }
+ return bc_strdup_printf("%s/builds", bgr_settings_get_base_dir());
+}
+
+
+char*
bgr_settings_get_section(bc_config_t *config, const char *repo_path)
{
- const char *bd = bgr_settings_get_basedir();
+ const char *bd = bgr_settings_get_base_dir();
if (bd == NULL) {
return NULL;
}
@@ -62,7 +73,7 @@ bgr_settings_get_section(bc_config_t *config, const char *repo_path)
bc_config_t*
bgr_settings_parse(void)
{
- const char *bd = bgr_settings_get_basedir();
+ const char *bd = bgr_settings_get_base_dir();
if (bd == NULL) {
return NULL;
}
diff --git a/src/blogc-git-receiver/settings.h b/src/blogc-git-receiver/settings.h
index 1b89d0f..bb6649a 100644
--- a/src/blogc-git-receiver/settings.h
+++ b/src/blogc-git-receiver/settings.h
@@ -11,7 +11,8 @@
#include "../common/config-parser.h"
-const char* bgr_settings_get_basedir(void);
+const char* bgr_settings_get_base_dir(void);
+char* bgr_settings_get_builds_dir(void);
char* bgr_settings_get_section(bc_config_t *config, const char *repo_path);
bc_config_t* bgr_settings_parse(void);
diff --git a/src/blogc-git-receiver/shell.c b/src/blogc-git-receiver/shell.c
index f2eaf32..8c45b54 100644
--- a/src/blogc-git-receiver/shell.c
+++ b/src/blogc-git-receiver/shell.c
@@ -36,7 +36,7 @@ bgr_shell(int argc, char *argv[])
}
// get base dir path
- const char *bd = bgr_settings_get_basedir();
+ const char *bd = bgr_settings_get_base_dir();
if (bd == NULL) {
fprintf(stderr, "error: failed to find base directory path\n");
rv = 3;