Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

38
LINES

< > BotCompany Repo | #1009062 - Linux: Start JavaX Super User VM v2 [prompts for password]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (9005L/62K).

1  
!7
2  
3  
sbool preserveEnvironment = true;
4  
sS javaxOptions = "-verbose -dontcompilethroughport5000";
5  
6  
p {
7  
  if (hasSuperUserVM()) {
8  
    print("Super User VM already running!");
9  
    ret;
10  
  }
11  
  
12  
  doIt();
13  
  cleanKill();
14  
}
15  
16  
svoid doIt ctex {
17  
  if (!isOnPATH("x-terminal-emulator"))
18  
    fail("x-terminal-emulator not on PATH. Your Linux is weird");
19  
    
20  
  File outFile = File.createTempFile("suvm_", ".out");
21  
  S msg = "Starting JavaX Super User VM...";
22  
  S cmd3 = "nohup "
23  
    + _javaCommand()
24  
    + " " + javaxDefaultVMArgs()
25  
    + " -jar " + pathToJavaxJar()
26  
    + " " + appendSpaceIfNempty(javaxOptions)
27  
    + psI(#1009053)
28  
    + " " + bashQuote(userHome())
29  
    + " >" + bashQuote(outFile) + " 2>&1 &";
30  
  S cmd2 = "echo " + bashQuote(msg) + "; echo; sudo "
31  
    + (preserveEnvironment ? "-E " : "") + "/bin/bash -c " + bashQuote(cmd3) + "; sleep 2";
32  
  S cmd = "/bin/bash -c " + bashQuote(cmd2);
33  
  print(cmd);
34  
  
35  
  nohup("x-terminal-emulator -e " + bashQuote(cmd));
36  
  
37  
  print("\nWatch " + outFile + " to check progress");
38  
}

Author comment

Began life as a copy of #1009051

download  show line numbers  debug dex   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, snaazhdonpnp, tslmcundralx, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1009062
Snippet name: Linux: Start JavaX Super User VM v2 [prompts for password]
Eternal ID of this version: #1009062/25
Text MD5: 5367f5282b9c171b9f6279d4b088c9fc
Transpilation MD5: c544958892abba06fecb7ba3292f2fa2
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-12 18:37:15
Source code size: 1054 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 391 / 871
Version history: 24 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1009062 & http://1009062.tinybrain.de