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

46
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

Download Jar. Libraryless. Click here for Pure Java version (10095L/65K).

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  
  File outFile = newFile("/tmp/" + now() + ".log");
22  
  S msg = "Starting JavaX Super User VM...";
23  
  
24  
  // the actual command executed as root
25  
  
26  
  S cmd3 = "whoami; nohup "
27  
    + relativeCmdToAbsoluteUsingPath(_javaCommand())
28  
    + " " + javaxDefaultVMArgs()
29  
    + " -jar " + pathToJavaxJar()
30  
    + " " + appendSpaceIfNempty(javaxOptions)
31  
    + psI(#1009053)
32  
    + " " + bashQuote(userHome())
33  
    + " >" + bashQuote(outFile) + " 2>&1 &";
34  
    
35  
  print(+cmd3);
36  
  
37  
  S cmd2 = "echo " + bashQuote(msg) + "; echo; sudo "
38  
    + (preserveEnvironment ? "-E " : "") + "/bin/bash -c " + bashQuote(cmd3) + "; sleep 2";
39  
  print(+cmd2);
40  
  S cmd = "/bin/bash -c " + bashQuote(cmd2);
41  
  print(+cmd);
42  
  
43  
  nohup("x-terminal-emulator -e " + bashQuote(cmd));
44  
  
45  
  print("\nWatch " + outFile + " to check progress");
46  
}

Author comment

Began life as a copy of #1009051

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, snaazhdonpnp, tslmcundralx, tvejysmllsmz, vouqrxazstgt, 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/28
Text MD5: 40a4d785801b5e59ee974a403ef8bdd0
Transpilation MD5: b98a1cc3232be4c986e18f0de0aef029
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-20 17:22:54
Source code size: 1244 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 566 / 1625
Version history: 27 change(s)
Referenced in: [show references]