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

53
LINES

< > BotCompany Repo | #1009053 // JavaX Super User VM - start using #1009062 on Linux

JavaX module (desktop) [tags: use-pretranspiled]

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (14320L/99K).

1  
!7
2  
3  
p-magellan-thread { // Magellan is a pretty face
4  
  tt(); // type writer font
5  
  centerHigherConsole();
6  
  consoleIcon(#1101431);
7  
  hideFrameOnMinimize(consoleFrame());
8  
  installTrayIcon(#1101431, "JavaX Super User VM", r showConsole,
9  
    "Exit JavaX Super User VM", rThread cleanKill);
10  
  
11  
  // Figure out where we come from
12  
  
13  
  File originalHomeDir = newFile(first(args));
14  
  
15  
  // Show who we are
16  
  
17  
  S user = systemUserName();
18  
  print("User: " + user);
19  
  print("Home: " + userHome());
20  
  if (neq(user, "root")) {
21  
    print("Failure: I'm not root!");
22  
    ret;
23  
  }
24  
  
25  
  // Copy VM arguments from last home
26  
  
27  
  if (fileExists(originalHomeDir)) {
28  
    File out = getProgramFile(#1005850, "default-vm-args");
29  
    File in = newFile(javaxDataDirForUserHome(originalHomeDir), #1005850, "default-vm-args");
30  
    if (!out.exists() && in.exists())
31  
      copyFile(in, out);
32  
  }
33  
  
34  
  // Rename ourselves & be open for business
35  
  
36  
  renameVM("Super User VM.");
37  
  consoleTitle("JavaX Super User VM [" + user + "]");
38  
  bot("Super User VM.");
39  
  print("\nType Linux commands here to execute them.\n");
40  
  focusConsole();
41  
  sleep();
42  
}
43  
44  
answer {
45  
  if "ready" ret "yes";
46  
  if "backtick *" ret format("OK *", backtick_verbose($1));
47  
  if "backtick uninterruptible *" {
48  
    temp tempSetTL(backtick_uninterruptable, true);
49  
    ret format("OK *", backtick_verbose($1));
50  
  }
51  
  if "program *" { directNohupJavax($1); ret "OK, starting " + $1; }
52  
  try answer "Exit code: " + backtickToConsole_returnExitCode(s);
53  
}

Author comment

Began life as a copy of #1001710

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, bvpoyihotdib, cbybwowwnfue, cfunsshuasjs, emufipobbhmk, fonkrhpcolwg, gwrvuhgaqvyk, hzfkhshlejco, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009053
Snippet name: JavaX Super User VM - start using #1009062 on Linux
Eternal ID of this version: #1009053/36
Text MD5: 249ba77beeb09526647754c761353b85
Transpilation MD5: 17d5aa370a9b31456dddedfa314bde9d
Author: stefan
Category: javax
Type: JavaX module (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-20 17:46:52
Source code size: 1538 bytes / 53 lines
Pitched / IR pitched: No / No
Views / Downloads: 814 / 2978
Version history: 35 change(s)
Referenced in: [show references]