@synopackageland/cli 0.52.7 → 0.52.9
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.
- package/CHANGELOG.md +16 -0
- package/assets/go/compose-admin/go.mod +22 -0
- package/assets/go/compose-admin/go.sum +40 -0
- package/assets/go/compose-admin/main.go +443 -0
- package/assets/go/compose-admin/main_test.go +173 -0
- package/dist/build-spk/delegate-scope.js +2 -2
- package/dist/build-spk/install-wizard.d.ts +1 -0
- package/dist/build-spk/resource-worker.d.ts +3 -0
- package/dist/build-spk/resource-worker.js +20 -1
- package/dist/build-spk/share-combobox.d.ts +7 -0
- package/dist/build-spk/share-combobox.js +13 -10
- package/dist/cli.js +9 -0
- package/dist/host/catalog-install.d.ts +1 -0
- package/dist/host/catalog-install.js +113 -6
- package/dist/host/compose-admin-build.d.ts +6 -0
- package/dist/host/compose-admin-build.js +17 -0
- package/dist/host/compose-admin.d.ts +22 -0
- package/dist/host/compose-admin.js +119 -0
- package/dist/host/compose-project-recovery.d.ts +2 -0
- package/dist/host/compose-project-recovery.js +2 -0
- package/dist/host/package-commands.d.ts +1 -1
- package/dist/host/package-commands.js +32 -2
- package/dist/load-env.js +1 -1
- package/dist/native-http-schema/source.json +1 -1
- package/dist/runtime/sdk-source.d.ts +1 -1
- package/dist/runtime/sdk-source.js +1 -1
- package/dist/standalone/inspect-spk.js +2 -1
- package/dist/standalone/shared-folder.js +8 -5
- package/docs/compose-admin.md +82 -0
- package/docs/shared-folders.md +6 -3
- package/package.json +3 -2
- package/schema/dsm-api-contract.json +23 -4
- package/skills/reference/install.md +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createInterface } from 'node:readline';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { mkdirSync, writeFileSync, rmSync } from 'node:fs';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { CtlError } from '../ctl/errors.js';
|
|
8
|
+
import { dsmOperationTimeoutMs } from '../nas/timeouts.js';
|
|
9
|
+
export const COMPOSE_ADMIN_GUIDANCE = 'Configure SYNOPKGLAND_COMPOSE_ADMIN_COMMAND as a JSON argv array for the CLI native helper on this NAS (see docs/compose-admin.md).';
|
|
10
|
+
const failure = (code) => new CtlError(code, code, COMPOSE_ADMIN_GUIDANCE);
|
|
11
|
+
/** An absent/empty command keeps normal DSM lifecycle behavior. A configured
|
|
12
|
+
* command, including an invalid one, must pass the strict adapter checks. */
|
|
13
|
+
export const composeAdminConfigured = (command = process.env.SYNOPKGLAND_COMPOSE_ADMIN_COMMAND) => Boolean(command);
|
|
14
|
+
export const composeAdminWarning = (pkg) => `Warning: ${pkg}: continuing the standard DSM lifecycle without verified container/profile cleanup; stale Container Manager profiles may remain. ${COMPOSE_ADMIN_GUIDANCE}`;
|
|
15
|
+
/** Explicit trusted root channel; never run an App-supplied executable. The
|
|
16
|
+
* configured command receives the origin and package, but no DSM credentials. */
|
|
17
|
+
export async function openComposeAdmin(options) {
|
|
18
|
+
const configured = options.command ?? process.env.SYNOPKGLAND_COMPOSE_ADMIN_COMMAND;
|
|
19
|
+
if (!configured)
|
|
20
|
+
throw failure('COMPOSE_ADMIN_REQUIRED');
|
|
21
|
+
let argv;
|
|
22
|
+
try {
|
|
23
|
+
argv = JSON.parse(configured);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw failure('COMPOSE_ADMIN_REQUIRED');
|
|
27
|
+
}
|
|
28
|
+
if (!Array.isArray(argv) || !argv.length || argv.some(v => typeof v !== 'string' || !v || /[\r\n\0]/.test(v)))
|
|
29
|
+
throw failure('COMPOSE_ADMIN_REQUIRED');
|
|
30
|
+
const child = spawn(argv[0], argv.slice(1), { stdio: ['pipe', 'pipe', 'pipe'], env: process.env });
|
|
31
|
+
// Never print administrator output, which may include private diagnostics.
|
|
32
|
+
child.stderr.resume();
|
|
33
|
+
const lines = createInterface({ input: child.stdout, crlfDelay: Infinity });
|
|
34
|
+
let pending;
|
|
35
|
+
let closed = false;
|
|
36
|
+
const fail = () => { closed = true; pending?.reject(failure('COMPOSE_ADMIN_UNCONFIRMED')); pending = undefined; };
|
|
37
|
+
child.on('error', fail);
|
|
38
|
+
child.on('exit', fail);
|
|
39
|
+
child.stdin.on('error', fail);
|
|
40
|
+
lines.on('line', line => {
|
|
41
|
+
if (!pending || line.length > 1 << 20) {
|
|
42
|
+
fail();
|
|
43
|
+
child.kill();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const p = pending;
|
|
47
|
+
pending = undefined;
|
|
48
|
+
try {
|
|
49
|
+
const value = JSON.parse(line);
|
|
50
|
+
if (value.ok !== true) {
|
|
51
|
+
const code = typeof value.error === 'string' ? /\b(COMPOSE_[A-Z_]+|PACKAGE_BUSY)\b/.exec(value.error)?.[1] : undefined;
|
|
52
|
+
p.reject(failure(code ?? 'COMPOSE_ADMIN_UNCONFIRMED'));
|
|
53
|
+
}
|
|
54
|
+
else
|
|
55
|
+
p.resolve(value.data);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
p.reject(failure('COMPOSE_ADMIN_UNCONFIRMED'));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const abort = () => { fail(); child.kill(); };
|
|
62
|
+
options.signal?.addEventListener('abort', abort, { once: true });
|
|
63
|
+
const call = async (action) => {
|
|
64
|
+
if (closed || pending || options.signal?.aborted)
|
|
65
|
+
throw failure('COMPOSE_ADMIN_UNCONFIRMED');
|
|
66
|
+
let timer;
|
|
67
|
+
try {
|
|
68
|
+
return await new Promise((resolve, reject) => {
|
|
69
|
+
pending = { resolve, reject };
|
|
70
|
+
timer = setTimeout(abort, dsmOperationTimeoutMs());
|
|
71
|
+
child.stdin.write(JSON.stringify({ action, package: options.packageId, project: options.project ?? '', origin: new URL(options.origin).origin }) + '\n');
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
if (timer)
|
|
76
|
+
clearTimeout(timer);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const dispose = () => { options.signal?.removeEventListener('abort', abort); lines.close(); child.stdin.end(); child.kill(); };
|
|
80
|
+
try {
|
|
81
|
+
const opened = await call('open');
|
|
82
|
+
if (opened?.compose !== true || opened?.sdk !== '0.53.11')
|
|
83
|
+
throw failure('COMPOSE_ADMIN_UNCONFIRMED');
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
dispose();
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
return { remove: async () => { await call('remove'); }, refresh: async () => { const value = await call('refresh'); if (typeof value?.changed !== 'boolean')
|
|
90
|
+
throw failure('COMPOSE_ADMIN_UNCONFIRMED'); return value.changed; }, close: async () => { try {
|
|
91
|
+
if (!closed)
|
|
92
|
+
await call('close');
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
dispose();
|
|
96
|
+
} } };
|
|
97
|
+
}
|
|
98
|
+
/** Excludes CLI races for every package operation. The NAS helper additionally
|
|
99
|
+
* holds its flock across installed inventory capture, stop, reconcile and write. */
|
|
100
|
+
export async function withComposeLifecycleLock(origin, pkg, work) {
|
|
101
|
+
const root = process.env.SYNOPKGLAND_OPERATIONS_DIR ?? join(homedir(), '.cache/synopkgland/operations');
|
|
102
|
+
mkdirSync(root, { recursive: true, mode: 0o700 });
|
|
103
|
+
const key = createHash('sha256').update(new URL(origin).origin + '\0' + pkg).digest('hex');
|
|
104
|
+
const path = join(root, key + '.lock');
|
|
105
|
+
try {
|
|
106
|
+
mkdirSync(path, { mode: 0o700 });
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
throw failure('PACKAGE_BUSY');
|
|
110
|
+
}
|
|
111
|
+
// Deliberately do not steal stale locks automatically after uncertain writes.
|
|
112
|
+
writeFileSync(join(path, 'owner.json'), JSON.stringify({ pid: process.pid, package: pkg }), { mode: 0o600 });
|
|
113
|
+
try {
|
|
114
|
+
return await work();
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
rmSync(path, { recursive: true, force: true });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -6,6 +6,8 @@ interface RecoveryOptions {
|
|
|
6
6
|
projectName: string;
|
|
7
7
|
/** Healthy upgrades retain the worker's existing registration. */
|
|
8
8
|
reclaim: boolean;
|
|
9
|
+
/** A fresh install has no trusted prior installed-container inventory. */
|
|
10
|
+
requireAbsent?: boolean;
|
|
9
11
|
signal?: AbortSignal;
|
|
10
12
|
onProgress?: (message: string) => void;
|
|
11
13
|
}
|
|
@@ -36,6 +36,8 @@ export async function reclaimOwnedComposeProject(options) {
|
|
|
36
36
|
return;
|
|
37
37
|
if (found.length !== 1 || !owned(found[0]))
|
|
38
38
|
throw fail('COMPOSE_PROJECT_CONFLICT', `Container Manager project ${projectName} cannot be proved to belong to ${packageId}; it was left untouched`);
|
|
39
|
+
if (options.requireAbsent)
|
|
40
|
+
throw fail('COMPOSE_PROJECT_INVENTORY_REQUIRED', 'An existing Compose registration needs trusted installed inventory before cleanup; no install request was sent');
|
|
39
41
|
if (!options.reclaim)
|
|
40
42
|
return;
|
|
41
43
|
const project = found[0];
|
|
@@ -5,6 +5,8 @@ import { createInterface } from "node:readline/promises";
|
|
|
5
5
|
import { CtlError } from "../ctl/errors.js";
|
|
6
6
|
import { inspectAnySpk } from "../spk/inspect.js";
|
|
7
7
|
import { containerImageReferences } from './container-pull.js';
|
|
8
|
+
import { composeAdminConfigured, composeAdminWarning } from './compose-admin.js';
|
|
9
|
+
import { progressReporter } from '../terminal-output.js';
|
|
8
10
|
import { appUrlFromPackageInfo } from './open-url.js';
|
|
9
11
|
import { connectNas, requireAdministrator, } from "./connection.js";
|
|
10
12
|
import { fetchPackageSource } from "../package-source.js";
|
|
@@ -213,9 +215,9 @@ export async function installPackage(spec, options = {}, connection) {
|
|
|
213
215
|
rmSync(stage, { recursive: true, force: true });
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
|
-
export async function uninstallPackage(id, options = {}) {
|
|
218
|
+
export async function uninstallPackage(id, options = {}, connection) {
|
|
217
219
|
packageId(id);
|
|
218
|
-
const nas = await connectNas(options.host);
|
|
220
|
+
const nas = connection ?? await connectNas(options.host);
|
|
219
221
|
const state = await fetchInstalledPackageState(nas.session.origin, nas.session.cookie, id);
|
|
220
222
|
if (!state)
|
|
221
223
|
throw fail('PACKAGE_STATUS_UNKNOWN', 'DSM did not return a verifiable package state');
|
|
@@ -228,7 +230,35 @@ export async function uninstallPackage(id, options = {}) {
|
|
|
228
230
|
return { dryRun: true, host: nas.name, package: id, action: "uninstall" };
|
|
229
231
|
await requireAdministrator(nas);
|
|
230
232
|
await confirm(`Uninstall ${id} (package uninstall hooks may remove data)`, options.yes);
|
|
233
|
+
let composeProject;
|
|
234
|
+
try {
|
|
235
|
+
const packages = await inventory(nas);
|
|
236
|
+
if (packages.has('ContainerManager')) {
|
|
237
|
+
const projects = await nas.call('SYNO.Docker.Project', 'list', 1);
|
|
238
|
+
if (!projects || typeof projects !== 'object' || Array.isArray(projects))
|
|
239
|
+
throw fail('COMPOSE_PROJECT_INVENTORY_INVALID', 'Cannot verify installed Compose project inventory');
|
|
240
|
+
const matches = Object.values(projects).filter((p) => p?.package_name === id ||
|
|
241
|
+
p?.path === `/var/packages/${id}/target/compose` ||
|
|
242
|
+
typeof p?.path === 'string' && /^\/volume[1-9][0-9]*\/@appstore\/([^/]+)\/compose$/.exec(p.path)?.[1] === id);
|
|
243
|
+
if (matches.length > 1)
|
|
244
|
+
throw fail('COMPOSE_PROJECT_CONFLICT', 'Ambiguous installed Compose project');
|
|
245
|
+
if (matches.length) {
|
|
246
|
+
const p = matches[0];
|
|
247
|
+
if (p.is_package !== true || typeof p.name !== 'string' || !/^[a-z0-9][a-z0-9_-]*$/.test(p.name))
|
|
248
|
+
throw fail('COMPOSE_PROJECT_CONFLICT', 'Cannot verify installed Compose project');
|
|
249
|
+
composeProject = p.name;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
// Without a native channel this optional lookup must not block the normal
|
|
255
|
+
// DSM uninstall path. Configured channels retain strict inventory checks.
|
|
256
|
+
if (composeAdminConfigured())
|
|
257
|
+
throw error;
|
|
258
|
+
progressReporter()(composeAdminWarning(id));
|
|
259
|
+
}
|
|
231
260
|
await uninstallPackageFromDsm({
|
|
261
|
+
composeProject,
|
|
232
262
|
dsmOrigin: nas.session.origin,
|
|
233
263
|
cookieHeader: nas.session.cookie,
|
|
234
264
|
packageId: id,
|
package/dist/load-env.js
CHANGED
|
@@ -19,7 +19,7 @@ export function loadDotEnv(fromDir = process.cwd()) {
|
|
|
19
19
|
}
|
|
20
20
|
const key = trimmed.slice(0, eq).trim();
|
|
21
21
|
const value = trimmed.slice(eq + 1).trim();
|
|
22
|
-
if (DOTENV_KEY.test(key) && process.env[key] === undefined) {
|
|
22
|
+
if (DOTENV_KEY.test(key) && key !== 'SYNOPKGLAND_COMPOSE_ADMIN_COMMAND' && process.env[key] === undefined) {
|
|
23
23
|
process.env[key] = value;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.
|
|
1
|
+
{"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.11","local":false}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { goPrivateCovers } from './go-env.js';
|
|
2
2
|
import { type ExecutorManifest } from './sdk-executor-manifest.js';
|
|
3
3
|
/** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
|
|
4
|
-
export declare const DEFAULT_SDK_VERSION = "0.53.
|
|
4
|
+
export declare const DEFAULT_SDK_VERSION = "0.53.11";
|
|
5
5
|
export declare const SDK_PACKAGE = "@synopackageland/sdk";
|
|
6
6
|
export declare const SDK_MODULE = "github.com/synopackageland/syno-pkg-land-sdk";
|
|
7
7
|
export declare const EXECUTOR_MODULE = "github.com/synopackageland/syno-pkg-land-sdk/executor";
|
|
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os';
|
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { readExecutorManifest, predatesExecutorManifest } from './sdk-executor-manifest.js';
|
|
7
7
|
/** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
|
|
8
|
-
export const DEFAULT_SDK_VERSION = '0.53.
|
|
8
|
+
export const DEFAULT_SDK_VERSION = '0.53.11';
|
|
9
9
|
export const SDK_PACKAGE = '@synopackageland/sdk';
|
|
10
10
|
export const SDK_MODULE = 'github.com/synopackageland/syno-pkg-land-sdk';
|
|
11
11
|
export const EXECUTOR_MODULE = `${SDK_MODULE}/executor`;
|
|
@@ -43,6 +43,7 @@ import { DELETE_STATE_KEY } from "../build-spk/uninstall-wizard.js";
|
|
|
43
43
|
import { readUninstallRecord, stateItemTexts } from "./uninstall.js";
|
|
44
44
|
import { DSM_LANGS } from "./i18n.js";
|
|
45
45
|
import { BACKGROUND_UNIT_DIR, BACKGROUND_WORKER_PAYLOAD, BRIDGE_WORKER_ARGS, backgroundUnitName, renderBackgroundUnit, } from "./background.js";
|
|
46
|
+
import { matchesComposeWorkerResource } from '../build-spk/resource-worker.js';
|
|
46
47
|
import { renderStandaloneResource } from "./resource.js";
|
|
47
48
|
import { recoverSharedFolder, renderUpgradeWizardFiles, sharedFolderInstallSteps, SHARED_FOLDER_MARKER, } from "./shared-folder.js";
|
|
48
49
|
import { renderInstallWizardFiles, integrationWizardSteps, renderNativeInstallWizard, } from "../build-spk/install-wizard.js";
|
|
@@ -859,7 +860,7 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings) {
|
|
|
859
860
|
throw new Error(`unexpected WIZARD_UIFILES/${name}; native share selection must match the declaration`);
|
|
860
861
|
}
|
|
861
862
|
const resource = renderStandaloneResource(manifest);
|
|
862
|
-
if (readOptional(join(dir, "conf/resource"))
|
|
863
|
+
if (!matchesComposeWorkerResource(readOptional(join(dir, "conf/resource")), resource))
|
|
863
864
|
throw new Error("unexpected worker resource; unapproved Shares must never auto-acquire");
|
|
864
865
|
if (readdirSync(join(dir, "conf")).some((n) => !["privilege", ...(resource ? ["resource"] : [])].includes(n)))
|
|
865
866
|
throw new Error("unexpected Compose resource");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DSM_LANGS, LOCALES } from "./i18n.js";
|
|
2
2
|
import { existingShareValidator } from "../build-spk/share-validation.js";
|
|
3
|
-
import { sharedFolderCombobox } from "../build-spk/share-combobox.js";
|
|
3
|
+
import { sharedFolderActivation, sharedFolderCombobox } from "../build-spk/share-combobox.js";
|
|
4
4
|
import { renderWizardFiles, translator } from "../build-spk/wizard-i18n.js";
|
|
5
5
|
import { integrationWizardSteps } from "../build-spk/install-wizard.js";
|
|
6
6
|
const FIELDS = new Set(["mode", "key", "name", "permission"]);
|
|
@@ -138,7 +138,10 @@ export function renderSharedFolderWizardFiles(pkg, folder) {
|
|
|
138
138
|
}
|
|
139
139
|
/** The install wizard steps that ask for the shared folder, for static or dynamic wizards. */
|
|
140
140
|
export function sharedFolderInstallSteps(pkg, folder) {
|
|
141
|
-
return t => [
|
|
141
|
+
return t => [sharedFolderStep(t("install.step"), installItems(t, pkg, folder), folder)];
|
|
142
|
+
}
|
|
143
|
+
function sharedFolderStep(title, items, folder) {
|
|
144
|
+
return { step_title: title, items, ...(folder.mode !== "create" ? { activeate: sharedFolderActivation(folder.key) } : {}) };
|
|
142
145
|
}
|
|
143
146
|
/** The upgrade wizard files that let the administrator keep or change the shared folder. */
|
|
144
147
|
export function renderSharedFolderUpgradeWizardFiles(pkg, folder) {
|
|
@@ -152,19 +155,19 @@ export function renderUpgradeWizardFiles(pkg, folder, integrations = []) {
|
|
|
152
155
|
if (!folder && !integrations.length)
|
|
153
156
|
return {};
|
|
154
157
|
const files = renderWizardFiles("upgrade_uifile", t => [
|
|
155
|
-
...(folder ? [
|
|
158
|
+
...(folder ? [sharedFolderStep(t("upgrade.step"), upgradeItems(t, pkg, folder), folder)] : []),
|
|
156
159
|
...integrationWizardSteps(t, integrations),
|
|
157
160
|
]);
|
|
158
161
|
if (folder && folder.mode !== "create") {
|
|
159
162
|
for (const locale of LOCALES) {
|
|
160
163
|
const t = translator(locale);
|
|
161
|
-
const steps = [
|
|
164
|
+
const steps = [sharedFolderStep(t("upgrade.step"), upgradeItems(t, pkg, folder), folder), ...integrationWizardSteps(t, integrations)];
|
|
162
165
|
const field = steps[0].items[1].subitems[0];
|
|
163
166
|
field.defaultValue = "__SYNOPKGLAND_RETAINED_SHARE__";
|
|
164
167
|
const invalid = JSON.stringify(steps, null, 2).replace('"__SYNOPKGLAND_RETAINED_SHARE__"', '""');
|
|
165
168
|
field.validator = { allowBlank: false, fn: existingShareValidator(validationMessages(t), false, folder.name) };
|
|
166
169
|
const retained = JSON.stringify(steps, null, 2);
|
|
167
|
-
const fresh = JSON.stringify([
|
|
170
|
+
const fresh = JSON.stringify([sharedFolderStep(t("upgrade.step"), installItems(t, pkg, folder), folder), ...integrationWizardSteps(t, integrations)], null, 2);
|
|
168
171
|
const name = locale === "en" ? "upgrade_uifile.sh" : `upgrade_uifile_${DSM_LANGS[locale]}.sh`;
|
|
169
172
|
files[name] = sharedFolderUpgradeScript(pkg, folder.key, retained, fresh, invalid);
|
|
170
173
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Compose administrator helper
|
|
2
|
+
|
|
3
|
+
Compose install, upgrade and uninstall work with the normal DSM administrator
|
|
4
|
+
HTTP session. When `SYNOPKGLAND_COMPOSE_ADMIN_COMMAND` is unset or empty, the CLI
|
|
5
|
+
continues the standard DSM lifecycle and prints one warning: verified
|
|
6
|
+
container/profile cleanup is disabled, so stale Container Manager profiles may
|
|
7
|
+
remain. The warning points here to enable verified cleanup and profile recovery.
|
|
8
|
+
No native helper or root/SSH channel is required for the standard workflow.
|
|
9
|
+
|
|
10
|
+
An explicitly configured native administrator channel enables installed ownership
|
|
11
|
+
inspection, SDK reconciliation and exact orphan cleanup. The HTTP APIs do not
|
|
12
|
+
expose trustworthy stored profile IDs. Once configured, invalid commands,
|
|
13
|
+
missing evidence and helper failures stop the operation; the CLI does not fall
|
|
14
|
+
back after an administrator action may have started. App hooks stay nonroot.
|
|
15
|
+
|
|
16
|
+
Build the adapter with the CLI and Go toolchain:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
synopkgland compose-admin-helper --arch x86_64 --output ./compose-admin
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use `aarch64` for that NAS architecture. Install the reviewed executable in a
|
|
23
|
+
root-owned directory on the intended NAS. Configure an existing authenticated
|
|
24
|
+
administrator channel that executes it as root, for example an SSH alias with
|
|
25
|
+
key authentication and a restricted, passwordless sudo rule:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
export SYNOPKGLAND_COMPOSE_ADMIN_COMMAND='["ssh","-T","my-nas","sudo","-n","/opt/synopkgland/compose-admin","--origin","https://my-nas.example:5001"]'
|
|
29
|
+
synopkgland install ./MyApp.spk --yes
|
|
30
|
+
synopkgland uninstall MyApp --yes
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The configured command is a JSON argument array, never a shell fragment. The
|
|
34
|
+
helper's `--origin` must exactly match the DSM origin used for the operation.
|
|
35
|
+
Supply this setting through the administrator's process environment; project
|
|
36
|
+
`.env` files cannot set it. Use a channel scoped to that specific NAS. The CLI
|
|
37
|
+
sends no DSM credentials to this command. Authenticate SSH/sudo through your
|
|
38
|
+
existing credential mechanism; never put passwords in command arguments.
|
|
39
|
+
The CLI does not install an SSH server, change accounts or create sudo rules.
|
|
40
|
+
|
|
41
|
+
The helper is shipped as locked Go source in the CLI package and uses the same
|
|
42
|
+
pinned SDK release as the CLI. Build it for the NAS separately from an App; do
|
|
43
|
+
not put it in the SPK. Keep Container Manager edits and other package tools idle
|
|
44
|
+
during the operation. The helper holds a NAS package lock until the CLI completes
|
|
45
|
+
or closes the channel; concurrent CLI operations also share a local
|
|
46
|
+
origin/package lock.
|
|
47
|
+
|
|
48
|
+
With the native channel enabled, the helper captures the installed package
|
|
49
|
+
target, Compose lock services, CM package/project association and full container
|
|
50
|
+
labels before STOP. The CLI stops the package, waits for stopped readback, then
|
|
51
|
+
invokes `RemoveStoppedWorkerContainers` before upload/upgrade or uninstall.
|
|
52
|
+
Writable container layers are replaced; declared volumes and bind data are
|
|
53
|
+
retained. The worker uses `force_recreate: false`; image/config changes still
|
|
54
|
+
cause normal replacement. This flag alone does not repair existing profile
|
|
55
|
+
damage.
|
|
56
|
+
|
|
57
|
+
For a docker-project worker failure with code 272 and no native channel, the CLI
|
|
58
|
+
reports the original DSM error with channel-enablement guidance. It does not
|
|
59
|
+
infer that a profile is missing or attempt `RefreshWorkerProfiles` or a recovery
|
|
60
|
+
start. Enable the channel above, inspect the package's current state, then retry
|
|
61
|
+
the same-version repair with the inspected SPK or store release:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
synopkgland status MyApp
|
|
65
|
+
synopkgland install ./MyApp.spk --yes
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
With the channel enabled, only a confirmed docker-project worker failure, the
|
|
69
|
+
selected installed version and verified lower-level missing/stale profile
|
|
70
|
+
evidence can invoke `RefreshWorkerProfiles`. After successful profile readback,
|
|
71
|
+
the CLI starts that version once. It never retries an uncertain write. Project
|
|
72
|
+
get error 2105, foreign ownership, unknown paths, unreadable profiles and
|
|
73
|
+
incomplete inventory stop the operation. Check DSM state before retrying after
|
|
74
|
+
any such failure.
|
|
75
|
+
|
|
76
|
+
Orphan cleanup only considers containers completely inspected earlier in the
|
|
77
|
+
same locked helper session. It checks their exact prior profile IDs and a full
|
|
78
|
+
all-container inventory to exclude any same-name resource, then uses Container
|
|
79
|
+
delete with `force=false` and `preserve_profile=false`, followed by readback.
|
|
80
|
+
It does not scan name prefixes or remove CM configuration files directly.
|
|
81
|
+
Existing orphan profiles without this prior inventory require administrator
|
|
82
|
+
investigation; the CLI cannot infer ownership from a filename.
|
package/docs/shared-folders.md
CHANGED
|
@@ -18,8 +18,10 @@ compose:
|
|
|
18
18
|
|
|
19
19
|
Use the app's package name for `name` (1–32 safe characters). The install wizard
|
|
20
20
|
prefills this dedicated name. Keep it to let DSM create or reuse that folder, or
|
|
21
|
-
select a supported existing share.
|
|
22
|
-
|
|
21
|
+
select a supported existing share. Loading the share list keeps this name, even
|
|
22
|
+
when other shares appear first; an existing share with the same name is reused.
|
|
23
|
+
A fresh install does not need an existing package account or a permission grant
|
|
24
|
+
prepared by an administrator.
|
|
23
25
|
|
|
24
26
|
Selecting a folder authorizes DSM's `data-share` worker to grant exactly the
|
|
25
27
|
manifest's RO or RW to the package account on installation, upgrade, repair and
|
|
@@ -51,7 +53,8 @@ upgrade answers reuse DSM's saved installer variables; when migrating an older
|
|
|
51
53
|
installation without those values, explicitly submit the recorded folder.
|
|
52
54
|
|
|
53
55
|
`mode: create` creates a fixed folder without a picker. `mode: select` requires
|
|
54
|
-
an existing folder and uses the same DSM grant and validation.
|
|
56
|
+
an existing folder and uses the same DSM grant and validation. Its picker starts
|
|
57
|
+
empty and never selects the first available share automatically. `key` and
|
|
55
58
|
`permission` must match `compose.shares`; host paths are never wizard answers.
|
|
56
59
|
The package-account preinst still refuses missing, ambiguous or symlinked
|
|
57
60
|
existing sources. The dedicated default alone may be materialized on DSM's
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.9",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"docs/path-ingress.md",
|
|
22
22
|
"skills",
|
|
23
23
|
"docs/shared-folders.md",
|
|
24
|
-
"docs/daemon-nofile.md"
|
|
24
|
+
"docs/daemon-nofile.md",
|
|
25
|
+
"docs/compose-admin.md"
|
|
25
26
|
],
|
|
26
27
|
"scripts": {
|
|
27
28
|
"check:docs": "node --test scripts/check-doc-versions.test.mjs && node scripts/check-doc-versions.mjs",
|
|
@@ -421,6 +421,25 @@
|
|
|
421
421
|
"7.4"
|
|
422
422
|
]
|
|
423
423
|
},
|
|
424
|
+
{
|
|
425
|
+
"api": "SYNO.Core.Package.Control",
|
|
426
|
+
"method": "start",
|
|
427
|
+
"version": 1,
|
|
428
|
+
"dsm": {
|
|
429
|
+
"7.2": "unverified",
|
|
430
|
+
"7.3": "unverified",
|
|
431
|
+
"7.4": "confirmed"
|
|
432
|
+
},
|
|
433
|
+
"parameters": {
|
|
434
|
+
"id": {}
|
|
435
|
+
},
|
|
436
|
+
"sources": [
|
|
437
|
+
"host/catalog-install.ts"
|
|
438
|
+
],
|
|
439
|
+
"hubConfirmed": [
|
|
440
|
+
"7.4"
|
|
441
|
+
]
|
|
442
|
+
},
|
|
424
443
|
{
|
|
425
444
|
"api": "SYNO.Core.Package.Uninstallation",
|
|
426
445
|
"method": "uninstall",
|
|
@@ -1114,7 +1133,7 @@
|
|
|
1114
1133
|
"sourceAudit": {
|
|
1115
1134
|
"build-spk/share-combobox.ts": "797cd3eea347e7fe57946f9584f725d6faef79fe9c56b690e1199ea7489fa973",
|
|
1116
1135
|
"build-spk/share-validation.ts": "a51b160cea9bea096e6efb45879abbf6d0dfecf21c761dca7cd06647d44cef62",
|
|
1117
|
-
"cli.ts": "
|
|
1136
|
+
"cli.ts": "61cd00cb0f7dc1836717cc2ee666e93c3396ba79bc3bc30aad2a4fec85a661ad",
|
|
1118
1137
|
"ctl/cli.ts": "97d218069c6fac42f64573c68c354d7a0e549ca2900b9d8b2935c9786bc5d11d",
|
|
1119
1138
|
"ctl/external.ts": "f66490ded838f934a0cf373f284418d4d02441edc8c8365066fc45b898ba81dc",
|
|
1120
1139
|
"ctl/flows.ts": "0f35d03176655bfe1d1df5d02ea36199e05973634dffcc6710112b7c8ce78b7e",
|
|
@@ -1127,13 +1146,13 @@
|
|
|
1127
1146
|
"e2e/certificates.ts": "e9801e5f4d326d31c3c281e5106f34138493e26cd7f0ad2b1dd3f6a566832389",
|
|
1128
1147
|
"e2e/dsm.ts": "66c9b3f6d907a8069202c5f88f13f8051c07b099de66d3ebce5de51c6374201f",
|
|
1129
1148
|
"error-registry.ts": "91f2de89bf98750a09fce54420e3a25e3527980be175ed704890a520181f1dc9",
|
|
1130
|
-
"host/catalog-install.ts": "
|
|
1131
|
-
"host/compose-project-recovery.ts": "
|
|
1149
|
+
"host/catalog-install.ts": "13908fd47d75f8a2f4ed412c9310b80b2d0a1d190ce46db34f15850c2ed45578",
|
|
1150
|
+
"host/compose-project-recovery.ts": "51f93197898677b5daebd745ef848e07b7d6454fc86b5d4e1fa210fe089ac414",
|
|
1132
1151
|
"host/container-pull.ts": "09908f48133ecc2580001afb4f7f0b6a949e4f35df1229e1e0860e37f2aa9a46",
|
|
1133
1152
|
"host/dsm-client.ts": "52c34d520154e43d823a64dbb0ff7f3ae40e427fb835a5136ab6d847827a4b7a",
|
|
1134
1153
|
"host/dsm-compound.ts": "5674b6f11d2b36a86a97ac7edf590abb34bd72f441c1f43ab057a43cfb5d7e88",
|
|
1135
1154
|
"host/dsm-port-profile.ts": "9ebd06bbbc918267ef2d8a4ff9737b9d35579e45224dd4de362389921446ae8d",
|
|
1136
|
-
"host/package-commands.ts": "
|
|
1155
|
+
"host/package-commands.ts": "8a171c2ac3613697f52d81af3469250b7b28b190fcb7e863368876e056d189e7",
|
|
1137
1156
|
"host/port-info-lookup.ts": "b7af19dd8194bc424eb2100ce5953cf0737e8158da373e93b66627c6a7028c8e",
|
|
1138
1157
|
"host/port-info.ts": "9ab70c37860df681bee70039aebda9ad974fbd2e200fc2741daf9aacf7943905",
|
|
1139
1158
|
"host/share-lookup.ts": "c158baffc774cb7b5b36a82b633bc48f7b8522f67972ef09ab1a15a8b4609196",
|
|
@@ -17,7 +17,7 @@ identity_gateway:
|
|
|
17
17
|
listen: {https: 28443}
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
For every App needing shared data, name the dedicated share after the package. The wizard defaults to that name and also accepts a supported existing share. Selecting a folder authorizes DSM's `data-share` worker to grant the declared RO/RW to the package account on install, upgrade/repair and starts. No pre-existing account or permission grant is required. Validation checks the name, existence and supported local mounted folder type, never package-account access. Local tiered/S2S shares are accepted; remote/C2, tiering buckets, WORM, unmounted, unavailable, moving, external and forced-read-only shares are refused. Runtime kernel checks still report the share, required access and recovery action when permission is revoked. No App root or ACL writer is generated.
|
|
20
|
+
For every App needing shared data, name the dedicated share after the package. The wizard defaults to that name, keeps it when the share list loads, and reuses the matching share if it exists. It also accepts a supported existing share. `mode: select` starts empty and requires an explicit choice; `mode: create` has no picker. Selecting a folder authorizes DSM's `data-share` worker to grant the declared RO/RW to the package account on install, upgrade/repair and starts. No pre-existing account or permission grant is required. Validation checks the name, existence and supported local mounted folder type, never package-account access. Local tiered/S2S shares are accepted; remote/C2, tiering buckets, WORM, unmounted, unavailable, moving, external and forced-read-only shares are refused. Runtime kernel checks still report the share, required access and recovery action when permission is revoked. No App root or ACL writer is generated.
|
|
21
21
|
|
|
22
22
|
The upgrade wizard prefills and submits the recorded folder without a separate change checkbox. Keep the dedicated name rather than clearing it. CLI automation uses `--param media=Media` on install and `--param CHANGE_media=true --param media=OtherMedia` to change it on upgrade/repair. Explicitly submit the saved folder when migrating older installations without saved DSM installer values.
|
|
23
23
|
|