From cc6bd084e7ae41fce141d01c9cc6c38c53ba621f Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 3 Sep 2021 00:58:55 +1000 Subject: Don't open excess tmux panes and start the web server if BUILD. --- src/sledjchisl/sledjchisl.c | 75 +++++++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index fb4eb96..633979f 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -8457,29 +8457,58 @@ Build the OpenSim. // 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. pre = xmprintf("sudo -Hu %s ", scUser); } - snprintf(toybuf, sizeof(toybuf), - "%s %s %s/%s set-option -g default-command 'export PATH=%s:$PATH; bash'\\; " - // Set x,y to huge values, to work around an OpenSim bug. - "new-session -d -x 256 -y 420 -s %s -n '%s' bash -c 'export PATH=%s:$PATH; printf \"\\033]0;SledjChisl\\007\"; " - "/usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s %s; cd %s; bash' \\; " - "split-window -vp 50 -d -t '%s:0.0' \\; " - "split-window -hp 50 -d -t '%s:0.1' \\; " - "split-window -hp 50 -d -t '%s:0.0' " - // TODO - remove this once we handle the fcgi stuff ourselves. - // Make the FCGI socket world read / write, coz we can't set it to group www-data, since -G only works for root, and we ain't root. - // TODO - BIG SECURITY HOLE??? - "bash -c 'export PATH=%s:$PATH; printf \"\\033]0;FCGI web server\\007\"; sleep 2;" // The sleep is so that both are not creating the .shini files at the same time. - "spawn-fcgi -n -u %s -s %s/sledjchisl.socket -M 0666 -G www-data -- /usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s; " - "cd %s; bash'" - , - pre, Tcmd, scRun, Tsocket, scBin, - Tconsole, Ttab, scBin, - scRoot, modeStrings[currentMode], FLAG(v) ? "-v" : "", scRoot, - Tconsole, - Tconsole, - Tconsole, - scBin, - scUser, scRun, scRoot, FLAG(v) ? "-v" : "", scRoot); + if (BUILD == currentMode) + snprintf(toybuf, sizeof(toybuf), + "%s %s %s/%s set-option -g default-command 'export PATH=%s:$PATH; bash'\\; " + // Set x,y to huge values, to work around an OpenSim bug. + "new-session -d -x 256 -y 420 -s %s -n '%s' bash -c 'export PATH=%s:$PATH; printf \"\\033]0;SledjChisl\\007\"; " + "/usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s %s; cd %s; bash' \\; " +// "split-window -vp 50 -d -t '%s:0.0' \\; " +// "split-window -hp 50 -d -t '%s:0.1' \\; " +// "split-window -hp 50 -d -t '%s:0.0' " + // TODO - remove this once we handle the fcgi stuff ourselves. + // Make the FCGI socket world read / write, coz we can't set it to group www-data, since -G only works for root, and we ain't root. + // TODO - BIG SECURITY HOLE??? +// "bash -c 'export PATH=%s:$PATH; printf \"\\033]0;FCGI web server\\007\"; sleep 2;" // The sleep is so that both are not creating the .shini files at the same time. +// "spawn-fcgi -n -u %s -s %s/sledjchisl.socket -M 0666 -G www-data -- /usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s; " +// "cd %s; bash'" + , + pre, Tcmd, scRun, Tsocket, scBin, + Tconsole, Ttab, scBin, + scRoot, modeStrings[currentMode], FLAG(v) ? "-v" : "", scRoot +// Tconsole, +// Tconsole, +// Tconsole, +// scBin, +// scUser, scRun, scRoot, FLAG(v) ? "-v" : "", +// scRoot + ); + else + snprintf(toybuf, sizeof(toybuf), + "%s %s %s/%s set-option -g default-command 'export PATH=%s:$PATH; bash'\\; " + // Set x,y to huge values, to work around an OpenSim bug. + "new-session -d -x 256 -y 420 -s %s -n '%s' bash -c 'export PATH=%s:$PATH; printf \"\\033]0;SledjChisl\\007\"; " + "/usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s %s; cd %s; bash' \\; " + "split-window -vp 50 -d -t '%s:0.0' \\; " + "split-window -hp 50 -d -t '%s:0.1' \\; " + "split-window -hp 50 -d -t '%s:0.0' " + // TODO - remove this once we handle the fcgi stuff ourselves. + // Make the FCGI socket world read / write, coz we can't set it to group www-data, since -G only works for root, and we ain't root. + // TODO - BIG SECURITY HOLE??? + "bash -c 'export PATH=%s:$PATH; printf \"\\033]0;FCGI web server\\007\"; sleep 2;" // The sleep is so that both are not creating the .shini files at the same time. + "spawn-fcgi -n -u %s -s %s/sledjchisl.socket -M 0666 -G www-data -- /usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s; " + "cd %s; bash'" + , + pre, Tcmd, scRun, Tsocket, scBin, + Tconsole, Ttab, scBin, + scRoot, modeStrings[currentMode], FLAG(v) ? "-v" : "", scRoot, + Tconsole, + Tconsole, + Tconsole, + scBin, + scUser, scRun, scRoot, FLAG(v) ? "-v" : "", + scRoot + ); free(pre); if (shellMeFail(toybuf)) E("tmux new-session command failed! %s", toybuf); -- cgit v1.1