summaryrefslogtreecommitdiff
path: root/src/instance
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-01-31 12:06:01 +0000
committerLaurent Bercot <ska@appnovation.com>2023-01-31 12:06:01 +0000
commit80d231165357cf0d57b23dfe3b0aa16c7cb79545 (patch)
tree6f24601042b3088ff89a6f34788db6406806be00 /src/instance
parentae972753206764373d4bce367e642eb31f0df68c (diff)
downloads6-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')
-rw-r--r--src/instance/s6-instance-create.c19
-rw-r--r--src/instance/s6-instance-maker.c4
2 files changed, 19 insertions, 4 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) ;
}