@infernetprotocol/cli 0.1.25 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/commands/setup.js +15 -3
  2. package/package.json +6 -6
package/commands/setup.js CHANGED
@@ -172,13 +172,25 @@ async function startOllama({ yes }) {
172
172
  // /run/systemd/system probe.
173
173
  const isMac = process.platform === "darwin";
174
174
  const hasSystemd = !isMac && fsSync.existsSync("/run/systemd/system");
175
+ // user-systemd is available when /run/user/<uid> exists — every modern
176
+ // login session sets this up, including non-root logins on systemd
177
+ // hosts. Try it between sudo (system unit) and the nohup fallback,
178
+ // because operators on shared boxes may have ollama enabled as a
179
+ // --user service or simply lack passwordless sudo.
180
+ const uid = process.getuid?.() ?? null;
181
+ const userBus = uid != null && fsSync.existsSync(`/run/user/${uid}/bus`);
182
+ const NOHUP = "(nohup ollama serve > /tmp/ollama.log 2>&1 < /dev/null &)";
175
183
  let cmd;
176
184
  if (isMac) {
177
- cmd = "open -a Ollama || (nohup ollama serve > /tmp/ollama.log 2>&1 < /dev/null &)";
185
+ cmd = `open -a Ollama || ${NOHUP}`;
186
+ } else if (hasSystemd && userBus) {
187
+ cmd = `sudo systemctl start ollama 2>/dev/null`
188
+ + ` || systemctl --user start ollama 2>/dev/null`
189
+ + ` || ${NOHUP}`;
178
190
  } else if (hasSystemd) {
179
- cmd = "sudo systemctl start ollama || (nohup ollama serve > /tmp/ollama.log 2>&1 < /dev/null &)";
191
+ cmd = `sudo systemctl start ollama 2>/dev/null || ${NOHUP}`;
180
192
  } else {
181
- cmd = "nohup ollama serve > /tmp/ollama.log 2>&1 < /dev/null &";
193
+ cmd = NOHUP;
182
194
  }
183
195
  return confirmRun({
184
196
  label: "Start Ollama now",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infernetprotocol/cli",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "GPU-node CLI / daemon for the Infernet Protocol — register a GPU server with a Supabase control plane and start earning.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,11 +30,11 @@
30
30
  "ora": "^9.4.0",
31
31
  "react": "^17.0.2",
32
32
  "react-blessed": "^0.7.2",
33
- "@infernetprotocol/auth": "0.1.25",
34
- "@infernetprotocol/config": "0.1.25",
35
- "@infernetprotocol/engine": "0.1.25",
36
- "@infernetprotocol/deploy-providers": "0.1.25",
37
- "@infernetprotocol/gpu": "0.1.25"
33
+ "@infernetprotocol/auth": "0.1.27",
34
+ "@infernetprotocol/deploy-providers": "0.1.27",
35
+ "@infernetprotocol/config": "0.1.27",
36
+ "@infernetprotocol/gpu": "0.1.27",
37
+ "@infernetprotocol/engine": "0.1.27"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",