diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/instance/s6-instance-create.c | 19 | ||||
-rw-r--r-- | src/instance/s6-instance-maker.c | 4 | ||||
-rw-r--r-- | src/libs6/s6_servicedir_file_list.c | 3 |
3 files changed, 20 insertions, 6 deletions
diff --git a/src/instance/s6-instance-create.c b/src/instance/s6-instance-create.c index 5c25433..b1d2c65 100644 --- a/src/instance/s6-instance-create.c +++ b/src/instance/s6-instance-create.c @@ -55,6 +55,21 @@ int main (int argc, char const *const *argv) namelen = strlen(argv[1]) ; if (!argv[1][0] || argv[1][0] == '.' || byte_in(argv[1], namelen, " \t\f\r\n", 5) < namelen) strerr_dief1x(100, "invalid instance name") ; + + { + mode_t m = umask(0) ; + size_t svlen = strlen(argv[0]) ; + char fn[svlen + 11] ; + memcpy(fn, argv[0], svlen) ; + memcpy(fn + svlen, "/instances", 11) ; + if (mkdir(fn, 0755) == -1 && errno != EEXIST) + strerr_diefu2sys(111, "mkdir ", fn) ; + fn[svlen + 9] = 0 ; + if (mkdir(fn, 0755) == -1 && errno != EEXIST) + strerr_diefu2sys(111, "mkdir ", fn) ; + umask(m) ; + } + s6_instance_chdirservice(argv[0]) ; tain_now_set_stopwatch_g() ; @@ -75,10 +90,10 @@ int main (int argc, char const *const *argv) else if (errno != ENOENT) strerr_diefu3sys(111, "stat ", argv[0], sv+2) ; } - if (!hiercopy("../instances/.template", sv)) + if (!hiercopy("../template", sv)) { cleanup(sv) ; - strerr_diefu5sys(111, "copy ", argv[0], "/instances/.template to ", argv[0], sv+2) ; + strerr_diefu5sys(111, "copy ", argv[0], "/template to ", argv[0], sv+2) ; } if (s6_supervise_link_names_g(".", &p, argv + 1, 1, options, &tto) == -1) { diff --git a/src/instance/s6-instance-maker.c b/src/instance/s6-instance-maker.c index 8a82157..fcb67ac 100644 --- a/src/instance/s6-instance-maker.c +++ b/src/instance/s6-instance-maker.c @@ -62,7 +62,7 @@ static void write_service (char const *dir, char const *template, char const *us svinfo data = { .user = user, .maxinstances = maxinstances } ; size_t dirlen = strlen(dir) ; mode_t m ; - char fn[dirlen + 21] ; + char fn[dirlen + 11] ; s6_auto_write_service(dir, 3, &write_run, &data, logger) ; memcpy(fn, dir, dirlen) ; memcpy(fn + dirlen, "/instance", 10) ; @@ -71,7 +71,7 @@ static void write_service (char const *dir, char const *template, char const *us memcpy(fn + dirlen + 9, "s", 2) ; if (mkdir(fn, 0755) == -1) strerr_diefu2sys(111, "mkdir ", fn) ; umask(m) ; - memcpy(fn + dirlen + 10, "/.template", 11) ; + memcpy(fn + dirlen, "/template", 10) ; if (!hiercopy_tmp(template, fn, &sa)) strerr_diefu4sys(111, "copy file hierarchy from ", template, " to ", fn) ; } diff --git a/src/libs6/s6_servicedir_file_list.c b/src/libs6/s6_servicedir_file_list.c index b01a59f..6460426 100644 --- a/src/libs6/s6_servicedir_file_list.c +++ b/src/libs6/s6_servicedir_file_list.c @@ -12,8 +12,7 @@ static s6_servicedir_desc const s6_servicedir_file_list_[] = { .name = "timeout-finish", .type = S6_FILETYPE_UINT, .options = 0 }, { .name = "max-death-tally", .type = S6_FILETYPE_UINT, .options = 0 }, { .name = "down-signal", .type = S6_FILETYPE_NORMAL, .options = 0 }, - { .name = "instance", .type = S6_FILETYPE_DIR, .options = 0 }, - { .name = "instances", .type = S6_FILETYPE_DIR, .options = 0 }, + { .name = "template", .type = S6_FILETYPE_DIR, .options = 0 }, { .name = "data", .type = S6_FILETYPE_DIR, .options = 0 }, { .name = "env", .type = S6_FILETYPE_DIR, .options = 0 }, { .name = 0, .options = 0 } |