diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-10-11 02:35:35 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-10-11 02:35:35 +0200 |
commit | fd54e438f44a1841e1bf7fb858bb77821c78324a (patch) | |
tree | a6ad8937bda6223ea5d58cb7501b8abf863196a3 | |
parent | 7f13a91e9c39dc70af12511443dceb6bf4dc80f4 (diff) | |
download | blogc-fd54e438f44a1841e1bf7fb858bb77821c78324a.tar.gz blogc-fd54e438f44a1841e1bf7fb858bb77821c78324a.tar.bz2 blogc-fd54e438f44a1841e1bf7fb858bb77821c78324a.zip |
git-receiver: detect if make/gmake is available
-rw-r--r-- | src/blogc-git-receiver/pre-receive.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c index 056ebf2..faa0c62 100644 --- a/src/blogc-git-receiver/pre-receive.c +++ b/src/blogc-git-receiver/pre-receive.c @@ -150,6 +150,21 @@ bgr_pre_receive_hook(int argc, char *argv[]) goto cleanup; } + const char *make_impl = NULL; + + if (127 != system("gmake -f /dev/null &> /dev/null")) { + make_impl = "gmake"; + } + else if (127 != system("make -f /dev/null &> /dev/null")) { + make_impl = "make"; + } + + if (make_impl == NULL) { + fprintf(stderr, "error: no 'make' implementation found\n"); + rv = 1; + goto cleanup; + } + unsigned long epoch = time(NULL); output_dir = bc_strdup_printf("%s/builds/%s-%lu", home, master, epoch); char *gmake_cmd = bc_strdup_printf( |