diff options
author | onefang | 2021-07-30 08:08:00 +1000 |
---|---|---|
committer | onefang | 2021-07-30 08:08:00 +1000 |
commit | e6ddb3bd9e8992bba6aef63ac9db5701649e564f (patch) | |
tree | 609ed1710fa40a734d75c9fe2e1ce8062151da79 | |
parent | A memset I forgot to remove. (diff) | |
download | opensim-SC-e6ddb3bd9e8992bba6aef63ac9db5701649e564f.zip opensim-SC-e6ddb3bd9e8992bba6aef63ac9db5701649e564f.tar.gz opensim-SC-e6ddb3bd9e8992bba6aef63ac9db5701649e564f.tar.bz2 opensim-SC-e6ddb3bd9e8992bba6aef63ac9db5701649e564f.tar.xz |
Put the grids own bin directory in the path.
Diffstat (limited to '')
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index b81a054..16876f0 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -7032,9 +7032,11 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7032 | isTmux = TRUE; | 7032 | isTmux = TRUE; |
7033 | } | 7033 | } |
7034 | else | 7034 | else |
7035 | I("Not running inside the proper tmux server, starting it. %s == %s", eTMUX, toybuf); | 7035 | I("Not running inside the proper tmux server. %s == %s", eTMUX, toybuf); |
7036 | } | 7036 | } |
7037 | 7037 | ||
7038 | // Note this block of code assumes we are running inside current/bin. Which RunIt.sh does for us. | ||
7039 | // TODO - get rid of RunIt.sh as well. | ||
7038 | if (!isTmux) | 7040 | if (!isTmux) |
7039 | { // Let's see if the proper tmux server is even running. | 7041 | { // Let's see if the proper tmux server is even running. |
7040 | memset(toybuf, 0, sizeof(toybuf)); | 7042 | memset(toybuf, 0, sizeof(toybuf)); |
@@ -7047,17 +7049,21 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7047 | memset(toybuf, 0, sizeof(toybuf)); | 7049 | memset(toybuf, 0, sizeof(toybuf)); |
7048 | if (strcmp(pw->pw_name, scUser) == 0) | 7050 | if (strcmp(pw->pw_name, scUser) == 0) |
7049 | { | 7051 | { |
7052 | I("Not running inside the proper tmux server, starting it."); | ||
7050 | snprintf(toybuf, sizeof(toybuf), | 7053 | snprintf(toybuf, sizeof(toybuf), |
7051 | "%s %s/%s new-session -d -s %s -n '%s' \\; split-window -vp 50 -t '%s:' bash -c '/usr/bin/valgrind --leak-check=full ./sledjchisl; cd %s; bash'", | 7054 | "export PATH='%s:$PATH'; %s %s/%s new-session -d -s %s -n '%s' bash -c 'export PATH=%s:$PATH; bash' \\; split-window -vp 50 -t '%s:' " |
7052 | Tcmd, scRun, Tsocket, Tconsole, Ttab, Tconsole, scRoot); | 7055 | "bash -c 'export PATH=%s:$PATH; /usr/bin/valgrind --leak-check=full ./sledjchisl; cd %s; bash'", |
7056 | scBin, Tcmd, scRun, Tsocket, Tconsole, Ttab, scBin, Tconsole, scBin, scBin, scRoot); | ||
7053 | } | 7057 | } |
7054 | else | 7058 | else |
7055 | { | 7059 | { |
7060 | I("Not running inside the proper tmux server, starting it with sudo."); | ||
7056 | // The sudo is only so that the session is owned by opensim, otherwise it's owned by whoever ran this script, which is a likely security hole. | 7061 | // The sudo is only so that the session is owned by opensim, otherwise it's owned by whoever ran this script, which is a likely security hole. |
7057 | // After the session is created, we rely on the scRun directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. | 7062 | // After the session is created, we rely on the scRun directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. |
7058 | snprintf(toybuf, sizeof(toybuf), | 7063 | snprintf(toybuf, sizeof(toybuf), |
7059 | "sudo -Hu %s %s %s/%s new-session -d -s %s -n '%s' \\; split-window -vp 50 -t '%s:' bash -c '/usr/bin/valgrind --leak-check=full ./sledjchisl; cd %s; bash'", | 7064 | "sudo -Hu %s %s %s/%s new-session -d -s %s -n '%s' bash -c 'export PATH=%s:$PATH; bash' \\; split-window -vp 50 -t '%s:' " |
7060 | scUser, Tcmd, scRun, Tsocket, Tconsole, Ttab, Tconsole, scRoot); | 7065 | "bash -c 'export PATH=%s:$PATH; /usr/bin/valgrind --leak-check=full ./sledjchisl; cd %s; bash'", |
7066 | scUser, Tcmd, scRun, Tsocket, Tconsole, Ttab, scBin, Tconsole, scBin, scRoot); | ||
7061 | } | 7067 | } |
7062 | i = system(toybuf); | 7068 | i = system(toybuf); |
7063 | if (!WIFEXITED(i)) | 7069 | if (!WIFEXITED(i)) |
@@ -7107,6 +7113,14 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7107 | if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); | 7113 | if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); |
7108 | free(tmp); | 7114 | free(tmp); |
7109 | 7115 | ||
7116 | char *newPath = xmprintf("%s/current/bin/sledjchisl", scRoot); | ||
7117 | tmp = xmprintf("%s/sledjchisl", scBin); | ||
7118 | I("Symlinking %s to %s", newPath, tmp); | ||
7119 | if (0 != symlink(newPath, tmp)) | ||
7120 | perror_msg("Symlinking %s to %s", newPath, tmp); | ||
7121 | free(tmp); | ||
7122 | free(newPath); | ||
7123 | |||
7110 | 7124 | ||
7111 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 7125 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
7112 | // Other start up stuff. | 7126 | // Other start up stuff. |
@@ -7785,24 +7799,25 @@ sims = -- Note these are .shini / tmux tab short names. | |||
7785 | char *newPath = xmprintf("%s/sim%d/%s.ini", scTemp, count, nm); // Coz OpenSim. | 7799 | char *newPath = xmprintf("%s/sim%d/%s.ini", scTemp, count, nm); // Coz OpenSim. |
7786 | char *cmd; | 7800 | char *cmd; |
7787 | 7801 | ||
7802 | // The bash invocations are so that the PATH is properly propagated. | ||
7788 | if (0 == panes) | 7803 | if (0 == panes) |
7789 | doTmuxCmd("split-window -hp 50 -d -t '%s:0.1'", Tconsole); | 7804 | doTmuxCmd("split-window -hp 50 -d -t '%s:0.1' bash", Tconsole); |
7790 | else if (0 == pane) | 7805 | else if (0 == pane) |
7791 | { | 7806 | { |
7792 | doTmuxCmd("new-window -dc '%s/current/bin' -n '%s' -t '%s:%d'", scRoot, type, Tconsole, window); | 7807 | doTmuxCmd("new-window -dc '%s/current/bin' -n '%s' -t '%s:%d' bash", scRoot, type, Tconsole, window); |
7793 | if (2 <= panes) | 7808 | if (2 <= panes) |
7794 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.0'", Tconsole, window); | 7809 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.0' bash", Tconsole, window); |
7795 | if (4 <= panes) | 7810 | if (4 <= panes) |
7796 | { | 7811 | { |
7797 | doTmuxCmd("split-window -vp 50 -d -t '%s:%d.1'", Tconsole, window); | 7812 | doTmuxCmd("split-window -vp 50 -d -t '%s:%d.1' bash", Tconsole, window); |
7798 | doTmuxCmd("split-window -vp 50 -d -t '%s:%d.0'", Tconsole, window); | 7813 | doTmuxCmd("split-window -vp 50 -d -t '%s:%d.0' bash", Tconsole, window); |
7799 | } | 7814 | } |
7800 | if (8 <= panes) | 7815 | if (8 <= panes) |
7801 | { | 7816 | { |
7802 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.3'", Tconsole, window); | 7817 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.3' bash", Tconsole, window); |
7803 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.2'", Tconsole, window); | 7818 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.2' bash", Tconsole, window); |
7804 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.1'", Tconsole, window); | 7819 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.1' bash", Tconsole, window); |
7805 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.0'", Tconsole, window); | 7820 | doTmuxCmd("split-window -hp 50 -d -t '%s:%d.0' bash", Tconsole, window); |
7806 | } | 7821 | } |
7807 | /* TODO - | 7822 | /* TODO - |
7808 | IDs={ | 7823 | IDs={ |
@@ -7995,10 +8010,11 @@ nextSim: | |||
7995 | // Start up the web stuff. TODO - remove this once we handle the fcgi stuff ourselves. | 8010 | // Start up the web stuff. TODO - remove this once we handle the fcgi stuff ourselves. |
7996 | I("Starting the web stuff."); | 8011 | I("Starting the web stuff."); |
7997 | char *d = xmprintf("%s.{bottom}", Ttab); | 8012 | char *d = xmprintf("%s.{bottom}", Ttab); |
8013 | // TODO - not sure why this needs to start in current/src. | ||
7998 | char *c = xmprintf("cd %s/current/src;" | 8014 | char *c = xmprintf("cd %s/current/src;" |
7999 | " spawn-fcgi -n -u %s -s %s/sledjchisl.socket -M 0660 -G www-data -- " | 8015 | " spawn-fcgi -n -u %s -s %s/sledjchisl.socket -M 0660 -G www-data -- " |
8000 | "/usr/bin/valgrind --leak-check=full build/toybox/generated/unstripped/toybox sledjchisl", | 8016 | "/usr/bin/valgrind --leak-check=full sledjchisl; cd %s; bash'", |
8001 | scRoot, scUser, scCache); | 8017 | scRoot, scUser, scCache, scRoot); |
8002 | sendTmuxCmd(d, c); | 8018 | sendTmuxCmd(d, c); |
8003 | free(c); | 8019 | free(c); |
8004 | free(d); | 8020 | free(d); |