diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-01-31 12:06:01 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-01-31 12:06:01 +0000 |
commit | 80d231165357cf0d57b23dfe3b0aa16c7cb79545 (patch) | |
tree | 6f24601042b3088ff89a6f34788db6406806be00 /src/instance/s6-instance-create.c | |
parent | ae972753206764373d4bce367e642eb31f0df68c (diff) | |
download | s6-80d231165357cf0d57b23dfe3b0aa16c7cb79545.tar.xz |
Prepare for 2.11.2.1, move template location, change file list
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/instance/s6-instance-create.c')
-rw-r--r-- | src/instance/s6-instance-create.c | 19 |
1 files changed, 17 insertions, 2 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) { |