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).

!7

sbool preserveEnvironment = true;
sS javaxOptions = "-verbose -dontcompilethroughport5000";

p {
  if (hasSuperUserVM()) {
    print("Super User VM already running!");
    ret;
  }
  
  doIt();
  cleanKill();
}

svoid doIt ctex {
  if (!isOnPATH("x-terminal-emulator"))
    fail("x-terminal-emulator not on PATH. Your Linux is weird");
    
  File outFile = File.createTempFile("suvm_", ".out");
  S msg = "Starting JavaX Super User VM...";
  S cmd3 = "nohup "
    + _javaCommand()
    + " " + javaxDefaultVMArgs()
    + " -jar " + pathToJavaxJar()
    + " " + appendSpaceIfNempty(javaxOptions)
    + psI(#1009053)
    + " " + bashQuote(userHome())
    + " >" + bashQuote(outFile) + " 2>&1 &";
  S cmd2 = "echo " + bashQuote(msg) + "; echo; sudo "
    + (preserveEnvironment ? "-E " : "") + "/bin/bash -c " + bashQuote(cmd3) + "; sleep 2";
  S cmd = "/bin/bash -c " + bashQuote(cmd2);
  print(cmd);
  
  nohup("x-terminal-emulator -e " + bashQuote(cmd));
  
  print("\nWatch " + outFile + " to check progress");
}

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: 390 / 870
Version history: 24 change(s)
Referenced in: #1009053 #1009065

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