@hivemagnus/magnus 4.2.3 → 4.3.1

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/dist/project.js +13 -11
  2. package/package.json +9 -9
package/dist/project.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * units/ generated systemd units (or compose.yml)
13
13
  */
14
14
  import { randomBytes } from 'node:crypto';
15
- import { chownSync, closeSync, copyFileSync, existsSync, fsyncSync, linkSync, mkdirSync, openSync, readFileSync, readlinkSync, renameSync, rmSync, statSync, symlinkSync, writeSync, } from 'node:fs';
15
+ import { closeSync, copyFileSync, existsSync, fchmodSync, fchownSync, fsyncSync, linkSync, mkdirSync, openSync, readFileSync, readlinkSync, renameSync, rmSync, statSync, symlinkSync, writeSync, } from 'node:fs';
16
16
  import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
17
17
  export const PROJECT_FILE = 'magnus-project.json';
18
18
  export const DEFAULT_KEEP_BACKUPS = 5;
@@ -140,23 +140,25 @@ function fsyncPath(path, flags) {
140
140
  export function writeAtomic(path, content, mode, owner) {
141
141
  mkdirSync(dirname(path), { recursive: true });
142
142
  const temporary = `${path}.${process.pid}.tmp`;
143
- const fd = openSync(temporary, 'w', mode);
143
+ const fd = openSync(temporary, 'w', owner ? 0o600 : mode);
144
144
  try {
145
145
  writeSync(fd, content);
146
+ if (owner) {
147
+ try {
148
+ // Only root can give a file away; elsewhere the owner already matches.
149
+ if (typeof process.geteuid === 'function' && process.geteuid() === 0) {
150
+ fchownSync(fd, owner.uid, owner.gid);
151
+ }
152
+ }
153
+ catch { /* keep the writer as owner */ }
154
+ // Restore an existing file's mode even when the current umask is stricter.
155
+ fchmodSync(fd, mode);
156
+ }
146
157
  fsyncSync(fd);
147
158
  }
148
159
  finally {
149
160
  closeSync(fd);
150
161
  }
151
- if (owner) {
152
- try {
153
- // Only root can give a file away; elsewhere the owner already matches.
154
- if (typeof process.geteuid === 'function' && process.geteuid() === 0) {
155
- chownSync(temporary, owner.uid, owner.gid);
156
- }
157
- }
158
- catch { /* keep the writer as owner */ }
159
- }
160
162
  renameSync(temporary, path);
161
163
  fsyncPath(dirname(path), 'r');
162
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hivemagnus/magnus",
3
- "version": "4.2.3",
3
+ "version": "4.3.1",
4
4
  "description": "Install, upgrade and roll back a Magnus server and console with one command: `npx @hivemagnus/magnus init`, then `magnus upgrade`. Pins exact, tested component versions, backs up PostgreSQL before every migration and reverts automatically when the new version fails its health check.",
5
5
  "keywords": [
6
6
  "magnus",
@@ -47,7 +47,7 @@
47
47
  "clean": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});fs.rmSync('tsconfig.tsbuildinfo',{force:true})\""
48
48
  },
49
49
  "dependencies": {
50
- "@hivemagnus/magnus-contracts": "4.2.3"
50
+ "@hivemagnus/magnus-contracts": "4.3.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^24.19.2",
@@ -56,15 +56,15 @@
56
56
  },
57
57
  "magnusRelease": {
58
58
  "schema": 1,
59
- "version": "4.2.3",
59
+ "version": "4.3.1",
60
60
  "engines": {
61
61
  "node": "^24.22.3 || ^26.13.1"
62
62
  },
63
63
  "components": {
64
- "@hivemagnus/magnus-server": "4.2.3",
65
- "@hivemagnus/magnus-ui": "4.2.3",
66
- "@hivemagnus/magnus-contracts": "4.2.3",
67
- "@hivemagnus/magnus-agent": "4.2.3"
64
+ "@hivemagnus/magnus-server": "4.3.1",
65
+ "@hivemagnus/magnus-ui": "4.3.1",
66
+ "@hivemagnus/magnus-contracts": "4.3.1",
67
+ "@hivemagnus/magnus-agent": "4.3.1"
68
68
  },
69
69
  "breaking": false,
70
70
  "minUpgradeFrom": "4.0.0",
@@ -77,8 +77,8 @@
77
77
  "selfUpgradeProtocol": 1,
78
78
  "minLauncher": 1
79
79
  },
80
- "summary": "Ardent 3.8.3 (Lucent 0.2 status tables idle-safe for native backups) and an explicit 0600 package receipt.",
81
- "notesUrl": "https://github.com/ChefTaco/magnus/releases/tag/v4.2.3",
80
+ "summary": "Resource enrollment for nodes with settled console history, and scheduler discovery of timers that run large executables or the Raspberry Pi OS zram writeback.",
81
+ "notesUrl": "https://github.com/ChefTaco/magnus/releases/tag/v4.3.1",
82
82
  "allowScripts": {
83
83
  "@prisma/engines": true,
84
84
  "argon2": true,