@synopackageland/cli 0.52.14 → 0.52.16
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/folder-picker.js +16 -2
- package/dist/build-spk/folder-picker.d.ts +2 -2
- package/dist/build-spk/folder-picker.js +13 -3
- package/dist/runtime/approval-diff.js +1 -1
- package/dist/runtime/sdk-source.d.ts +1 -1
- package/dist/runtime/sdk-source.js +1 -1
- package/dist/spk/inspect.d.ts +3 -1
- package/dist/spk/inspect.js +2 -2
- package/dist/standalone/compose.js +3 -2
- package/dist/standalone/inspect-spk.d.ts +3 -1
- package/dist/standalone/inspect-spk.js +20 -15
- package/dist/standalone/install-settings.d.ts +6 -0
- package/dist/standalone/install-settings.js +18 -3
- package/dist/standalone/lifecycle.js +12 -3
- package/dist/standalone/manifest.js +7 -3
- package/dist/standalone/shared-folder.d.ts +1 -1
- package/dist/standalone/shared-folder.js +16 -7
- package/dist/standalone/spk.js +4 -2
- package/docs/shared-folders.md +54 -14
- package/package.json +1 -1
- package/skills/SKILL.md +2 -2
- package/skills/reference/approval-upgrades.md +5 -0
- package/skills/reference/compose.md +39 -0
- package/skills/reference/install.md +23 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.52.16 (2026-11-09)
|
|
4
|
+
|
|
5
|
+
- Pin SDK 0.53.25 for Compose planning.
|
|
6
|
+
- Refuse undeclared Compose tmpfs mounts and unlimited tmpfs, with registered errors that point to disk scratch.
|
|
7
|
+
- Document `compose.services.<service>.scratch` (disk temporary files, with `TMPDIR`) and the bounded `tmpfs` opt-in, which require SDK 0.53.25.
|
|
8
|
+
- Document `storage_init` on administrator-owned Shared Folders and runtime-only `storage_init`.
|
|
9
|
+
|
|
10
|
+
## 0.52.15 (2026-11-09)
|
|
11
|
+
|
|
12
|
+
- Support installer folder selection in native packages using the existing wizard, record, SDK controller and startup permission recovery.
|
|
13
|
+
- Allow dedicated folder selection and document Go, Node and Python SDK APIs.
|
|
14
|
+
- Add a minimal native daemon fixture and strict artifact/lifecycle coverage.
|
|
15
|
+
- Keep share-only legacy selections as the share root in wizard and silent upgrades.
|
|
16
|
+
- Compare historical baseline wizard data without applying the current renderer.
|
|
17
|
+
- Follow Package Center UI language for folder wizard headings and introductions.
|
|
18
|
+
|
|
3
19
|
## 0.52.14
|
|
4
20
|
|
|
5
21
|
- Add an opt-in folder picker to native Compose installation selections with SDK 0.53.22.
|
package/assets/folder-picker.js
CHANGED
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
var component = {
|
|
6
6
|
props: Object.assign({}, hook.props),
|
|
7
7
|
setup: function (props) {
|
|
8
|
+
// Package Center can select a server-side file using the account's saved
|
|
9
|
+
// language while its UI uses another language. The public custom-step
|
|
10
|
+
// headline hook follows the UI session; browser locale is the fallback.
|
|
11
|
+
var aliases = {en:'enu', 'zh-tw':'cht', 'zh-hant':'cht', 'zh-cn':'chs', 'zh-hans':'chs', ja:'jpn', ko:'krn', de:'ger', fr:'fre', es:'spn', it:'ita'};
|
|
12
|
+
var language = typeof _S === 'function' ? _S('lang') : '';
|
|
13
|
+
if (!language) language = typeof document !== 'undefined' ? document.documentElement.lang : '';
|
|
14
|
+
if (!language) language = typeof navigator !== 'undefined' ? navigator.language : '';
|
|
15
|
+
language = String(language || '').toLowerCase();
|
|
16
|
+
language = aliases[language] || aliases[language.split('-')[0]] || language;
|
|
17
|
+
options = Object.assign({}, options, options.i18n && (options.i18n[language] || options.i18n.enu));
|
|
8
18
|
function request(url, options) {
|
|
9
19
|
var controller = new AbortController();
|
|
10
20
|
var timer = setTimeout(function () { controller.abort(); }, 10000);
|
|
@@ -19,7 +29,10 @@
|
|
|
19
29
|
var body = new URLSearchParams(Object.assign({ api: name, method: method, version: version }, params));
|
|
20
30
|
return request('/webapi/entry.cgi', { method: 'POST', credentials: 'same-origin', headers: { 'X-SYNO-TOKEN': login.SynoToken }, body: body });
|
|
21
31
|
}).then(function (r) { if (!r.ok) throw Error(options.unavailable); return r.json(); })
|
|
22
|
-
.then(function (j) { if (j.success !== true)
|
|
32
|
+
.then(function (j) { if (j.success !== true) {
|
|
33
|
+
if (name === 'SYNO.Core.Share' && method === 'get' && options.dedicatedName === params.name && value.value === '/' + params.name && j.error?.code === 402) return { dedicatedMissing: true };
|
|
34
|
+
throw Error(options.unavailable);
|
|
35
|
+
} return j.data; });
|
|
23
36
|
};
|
|
24
37
|
var value = Vue.ref(options.share ? '/' + options.share + (options.subpath ? '/' + options.subpath : '') : '');
|
|
25
38
|
var error = Vue.ref('');
|
|
@@ -32,7 +45,7 @@
|
|
|
32
45
|
if (wizard.setNextStepDisable) wizard.setNextStepDisable(state);
|
|
33
46
|
else wizard.getButton('next').setDisabled(state);
|
|
34
47
|
}
|
|
35
|
-
function checkState() { disable(!valid || busy.value); return
|
|
48
|
+
function checkState() { disable(!valid || busy.value); return valid && !busy.value; }
|
|
36
49
|
function check() {
|
|
37
50
|
var current = ++sequence;
|
|
38
51
|
valid = false; busy.value = true; error.value = ''; checkState();
|
|
@@ -43,6 +56,7 @@
|
|
|
43
56
|
}
|
|
44
57
|
return api('SYNO.Core.Share', 'get', 1, { name: share, additional: JSON.stringify(['encryption','is_aclmode','is_force_readonly','is_share_moving','is_missing_share','is_offline_share','is_c2_share','load_worm_attr','load_tiering_attr','is_tiering_bucket','is_cluster_share','is_cold_storage_share']) })
|
|
45
58
|
.then(function (s) {
|
|
59
|
+
if (s?.dedicatedMissing) { if (current === sequence) valid = true; return; }
|
|
46
60
|
if (!s || s.name !== share || !/^\/volume[0-9]+$/.test(s.vol_path) || ![0,1,2].includes(s.encryption)) throw Error(options.unavailable);
|
|
47
61
|
if (/^(homes?|users|ftp|root|admin|guest|system|volume[0-9]*|(usb|sata|sd)share[0-9]*|ActiveBackupforBusiness|surveillance|docker|web_packages)$/i.test(share) || /^[.@]/.test(share) || share.indexOf('..') !== -1 || share.length > 32 || s.is_aclmode !== true || s.encryption === 2 || s.is_remote_share || s.is_cluster_share || s.is_cold_storage_share || s.is_usb_share || s.is_force_readonly || s.is_share_moving || s.is_missing_share || s.is_offline_share || s.is_c2_share || s.is_worm_share || s.worm_state || s.is_tiering_bucket || (s.worm_subvol_mode && s.worm_subvol_mode !== 'normal')) throw Error(options.unsupported);
|
|
48
62
|
return api('SYNO.FileStation.List','getinfo',2,{ path: JSON.stringify([path]), additional: JSON.stringify(['real_path','perm','mount_point_type']) }).then(function (d) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SharedFolder } from '../standalone/shared-folder.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type Translate } from './wizard-i18n.js';
|
|
3
3
|
export declare function validFolderSubpath(path: string): boolean;
|
|
4
|
-
export declare function folderSubpathItem(t: Translate, key: string): Record<string, unknown>;
|
|
4
|
+
export declare function folderSubpathItem(t: Translate, key: string, dedicatedName?: string): Record<string, unknown>;
|
|
5
5
|
/** Static files remain legacy compatible. Only the NAS-side script emits custom JS. */
|
|
6
6
|
export declare function folderPickerWizardFiles(pkg: string, folder: SharedFolder | undefined, files: Record<string, string>): Record<string, string>;
|
|
7
7
|
export declare function folderUpgradeScript(pkg: string, key: string, json: string): string;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { translator } from './wizard-i18n.js';
|
|
3
|
+
import { LOCALES, DSM_LANGS } from '../standalone/i18n.js';
|
|
2
4
|
export function validFolderSubpath(path) {
|
|
3
5
|
return path.length <= 1024 && !/[\\"\x00-\x1f\x7f]/.test(path) &&
|
|
4
6
|
(path === '' || path.split('/').every(p => p !== '' && p !== '.' && p !== '..'));
|
|
5
7
|
}
|
|
6
|
-
export function folderSubpathItem(t, key) {
|
|
8
|
+
export function folderSubpathItem(t, key, dedicatedName) {
|
|
7
9
|
const invalid = JSON.stringify(t('nativeShare.selectionInvalid'));
|
|
8
10
|
const unavailable = JSON.stringify(t('nativeShare.selectionUnavailable'));
|
|
9
11
|
return { type: 'textfield', desc: 'Folder path within the shared folder (leave empty for the root)', subitems: [{
|
|
10
12
|
key: key + '_subpath', desc: '', defaultValue: '', validator: { allowBlank: true, maxLength: 1024,
|
|
11
|
-
fn: `{var path=arguments[0];if(path&&(/^[\\/]|[\\/]$|[\\\\"\\x00-\\x1f\\x7f]/.test(path)||path.split('/').some(function(p){return !p||p==='.'||p==='..'})))return ${invalid};try{var field=arguments[1],panel=field.findParentBy(function(p){return typeof p.getForm==='function'}),share=panel.getForm().findField(${JSON.stringify(key)}).getValue();if(!share)return ${unavailable};var login=new XMLHttpRequest();login.open('GET','/webman/login.cgi?enable_syno_token=yes',false);login.send();var token=JSON.parse(login.responseText).SynoToken;if(!token)return ${unavailable};var x=new XMLHttpRequest();x.open('POST','/webapi/entry.cgi',false);x.setRequestHeader('Content-Type','application/x-www-form-urlencoded');x.setRequestHeader('X-SYNO-TOKEN',token);var full='/'+share+(path?'/'+path:'');x.send('api=SYNO.FileStation.List&method=getinfo&version=2&path='+encodeURIComponent(JSON.stringify([full]))+'&additional='+encodeURIComponent(JSON.stringify(['real_path','mount_point_type'])));var j=JSON.parse(x.responseText),f=j.data&&j.data.files&&j.data.files[0];return x.status===200&&j.success===true&&f&&f.isdir&&f.path===full&&!f.code?true:${unavailable}}catch(e){return ${unavailable}}}`,
|
|
13
|
+
fn: `{var path=arguments[0];if(path&&(/^[\\/]|[\\/]$|[\\\\"\\x00-\\x1f\\x7f]/.test(path)||path.split('/').some(function(p){return !p||p==='.'||p==='..'})))return ${invalid};try{var field=arguments[1],panel=field.findParentBy(function(p){return typeof p.getForm==='function'}),share=panel.getForm().findField(${JSON.stringify(key)}).getValue();if(!share)return ${unavailable};var login=new XMLHttpRequest();login.open('GET','/webman/login.cgi?enable_syno_token=yes',false);login.send();var token=JSON.parse(login.responseText).SynoToken;if(!token)return ${unavailable};var x=new XMLHttpRequest();x.open('POST','/webapi/entry.cgi',false);x.setRequestHeader('Content-Type','application/x-www-form-urlencoded');x.setRequestHeader('X-SYNO-TOKEN',token);if(!path&&share===${JSON.stringify(dedicatedName ?? '')}){x.send('api=SYNO.Core.Share&method=get&version=1&name='+encodeURIComponent(share));var shareResult=JSON.parse(x.responseText);if(x.status===200&&shareResult.success===false&&shareResult.error&&shareResult.error.code===402)return true;x.open('POST','/webapi/entry.cgi',false);x.setRequestHeader('Content-Type','application/x-www-form-urlencoded');x.setRequestHeader('X-SYNO-TOKEN',token);}var full='/'+share+(path?'/'+path:'');x.send('api=SYNO.FileStation.List&method=getinfo&version=2&path='+encodeURIComponent(JSON.stringify([full]))+'&additional='+encodeURIComponent(JSON.stringify(['real_path','mount_point_type'])));var j=JSON.parse(x.responseText),f=j.data&&j.data.files&&j.data.files[0];return x.status===200&&j.success===true&&f&&f.isdir&&f.path===full&&!f.code?true:${unavailable}}catch(e){return ${unavailable}}}`,
|
|
12
14
|
},
|
|
13
15
|
}] };
|
|
14
16
|
}
|
|
@@ -29,8 +31,14 @@ export function folderPickerWizardFiles(pkg, folder, files) {
|
|
|
29
31
|
const subpath = step.items.find((i) => i.subitems?.[0]?.key === folder.key + '_subpath');
|
|
30
32
|
const options = {
|
|
31
33
|
name: `synopkgland_folder_${pkg}_${folder.key}`, key: folder.key, title: step.step_title,
|
|
32
|
-
share: box.subitems[0].defaultValue ?? '', subpath: subpath?.subitems[0].defaultValue ?? '',
|
|
34
|
+
dedicatedName: folder.mode === 'dedicated' ? folder.name : undefined, share: box.subitems[0].defaultValue ?? '', subpath: subpath?.subitems[0].defaultValue ?? '',
|
|
33
35
|
intro: step.items.filter((i) => !i.type).map((i) => i.desc).join(' '),
|
|
36
|
+
i18n: Object.fromEntries(LOCALES.map(locale => {
|
|
37
|
+
const t = translator(locale), permission = t(`nativeShare.permission.${folder.permission}`);
|
|
38
|
+
const intro = folder.mode === 'select' ? t('nativeShare.selectIntro', { account: pkg, permission }) : t('nativeShare.createIntro', { name: folder.name, permission });
|
|
39
|
+
return [DSM_LANGS[locale], { title: t(name.startsWith('upgrade') ? 'upgrade.step' : 'install.step'),
|
|
40
|
+
intro: [...(step.items.filter((i) => !i.type).length > 1 ? [t('install.reuseData', { package: pkg })] : []), intro].join(' ') }];
|
|
41
|
+
})),
|
|
34
42
|
label: 'Folder', browse: 'Browse', checking: 'Checking folder',
|
|
35
43
|
invalid: 'Choose a valid folder path', unavailable: 'Folder unavailable or access denied. Choose an existing local folder.',
|
|
36
44
|
unsupported: 'This shared folder type is not supported. Choose a mounted local ACL shared folder.',
|
|
@@ -55,6 +63,8 @@ share=''
|
|
|
55
63
|
subpath=''
|
|
56
64
|
if [ -f "$config" ]; then
|
|
57
65
|
valid=$(sed -n 's/^{"schema":1,"shared_folders":{"${key}":"[^"\\\\]*"},"shared_folder_paths":{"${key}":"[^"\\\\]*"}}$/yes/p' "$config")
|
|
66
|
+
legacy=$(sed -n 's/^{"schema":1,"shared_folders":{"${key}":"[^"\\\\]*"}}$/yes/p' "$config")
|
|
67
|
+
if [ "$legacy" = yes ]; then valid=yes; fi
|
|
58
68
|
share=$(sed -n 's/^.*"shared_folders":{"${key}":"\\([^"\\\\]*\\)"}.*$/\\1/p' "$config")
|
|
59
69
|
subpath=$(sed -n 's/^.*"shared_folder_paths":{"${key}":"\\([^"\\\\]*\\)"}.*$/\\1/p' "$config")
|
|
60
70
|
if [ "$valid" != yes ]; then share=''; subpath=''; fi
|
|
@@ -52,7 +52,7 @@ export async function spkApprovalDiff(current, baseline, report) {
|
|
|
52
52
|
if (!baseline)
|
|
53
53
|
return noApproval(nextReport) ? notRequired() : approvalDiff(undefined, undefined);
|
|
54
54
|
const next = inventory(nextReport);
|
|
55
|
-
const old = await inspectAnySpk(baseline);
|
|
55
|
+
const old = await inspectAnySpk(baseline, { baseline: true });
|
|
56
56
|
if (!old.dsm.ok || old.findings.length)
|
|
57
57
|
throw new Error('[APPROVAL_BASELINE_INVALID] Baseline SPK failed inspection: ' + [...old.findings, ...old.dsm.errors.map(e => e.message)].join('; '));
|
|
58
58
|
if (old.package === nextReport.package && old.arch === nextReport.arch && noApproval(old) && noApproval(nextReport))
|
|
@@ -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.23";
|
|
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.23';
|
|
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`;
|
package/dist/spk/inspect.d.ts
CHANGED
|
@@ -16,4 +16,6 @@ export interface SpkReport extends SpkInspection {
|
|
|
16
16
|
* synopkgland build marker is also checked against the build contract;
|
|
17
17
|
* others are never held to it.
|
|
18
18
|
*/
|
|
19
|
-
export declare function inspectAnySpk(spkPath: string
|
|
19
|
+
export declare function inspectAnySpk(spkPath: string, options?: {
|
|
20
|
+
baseline?: boolean;
|
|
21
|
+
}): Promise<SpkReport>;
|
package/dist/spk/inspect.js
CHANGED
|
@@ -14,12 +14,12 @@ const CONTAINER_MARKER = "synology-app.yaml";
|
|
|
14
14
|
* synopkgland build marker is also checked against the build contract;
|
|
15
15
|
* others are never held to it.
|
|
16
16
|
*/
|
|
17
|
-
export async function inspectAnySpk(spkPath) {
|
|
17
|
+
export async function inspectAnySpk(spkPath, options = {}) {
|
|
18
18
|
const validation = await validateSpk(spkPath, { sourceMaps: false });
|
|
19
19
|
const dsm = { ok: validation.ok, errors: validation.errors, warnings: validation.warnings };
|
|
20
20
|
const facts = await readFacts(spkPath);
|
|
21
21
|
if (BUILD_MARKERS.some((name) => facts.top.has(name)) || facts.payload.some((entry) => entry.path === CONTAINER_MARKER)) {
|
|
22
|
-
return { ...(await inspectSpk(spkPath)), publicUi: validation.publicUi, synopkgland: true, info: validation.info, dsm };
|
|
22
|
+
return { ...(await inspectSpk(spkPath, undefined, options)), publicUi: validation.publicUi, synopkgland: true, info: validation.info, dsm };
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
25
|
publicUi: validation.publicUi,
|
|
@@ -109,8 +109,9 @@ export function readComposeApp(value, root, arches, fail, context = {}) {
|
|
|
109
109
|
const sdk = typeof value.sdk === "string" ? value.sdk : (context.sdk ?? DEFAULT_SDK_VERSION);
|
|
110
110
|
if (context.sharedFolder?.picker === "folder") {
|
|
111
111
|
const [major, minor, patch] = sdk.split('.').map(Number);
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
const minimumPatch = context.sharedFolder.mode === 'dedicated' ? 23 : 22;
|
|
113
|
+
if (major === 0 && (minor < 53 || minor === 53 && patch < minimumPatch))
|
|
114
|
+
return invalid(`Folder selection requires SDK 0.53.${minimumPatch} or later.`, 'SDK_COMPOSE_UNSUPPORTED');
|
|
114
115
|
}
|
|
115
116
|
let targets = {};
|
|
116
117
|
if (value.helpers !== undefined) {
|
|
@@ -88,5 +88,7 @@ export interface SpkInspection {
|
|
|
88
88
|
/** Reads an SPK without installing it and reports how it would run on DSM. */
|
|
89
89
|
export declare function inspectStandaloneSpk(spkPath: string): Promise<SpkInspection>;
|
|
90
90
|
/** Auto-detect the generated runtime; retain strict native-go inspection when requested. */
|
|
91
|
-
export declare function inspectSpk(spkPath: string, expectedKind?: SpkKind
|
|
91
|
+
export declare function inspectSpk(spkPath: string, expectedKind?: SpkKind, options?: {
|
|
92
|
+
baseline?: boolean;
|
|
93
|
+
}): Promise<SpkInspection>;
|
|
92
94
|
export declare function listPayload(packageTgz: string, findings: string[]): Promise<SpkInspection["payload"]>;
|
|
@@ -8,7 +8,7 @@ import { renderGatewayIngressCheck } from './native-gateway.js';
|
|
|
8
8
|
import { portDefaults, portInstallSteps } from "./install-ports.js";
|
|
9
9
|
import { readMinMemoryMb, renderMemoryHook } from "./install-memory.js";
|
|
10
10
|
import { inspectPackageDependencies, dependencyInfo } from "./package-dependencies.js";
|
|
11
|
-
import { readInstallSettings, settingsInstallSteps, settingsConfig, renderSettingsHook } from './install-settings.js';
|
|
11
|
+
import { readInstallSettings, settingsInstallSteps, settingsConfig, renderSettingsHook, renderNativeFolderHook, nativeFolderConfig } from './install-settings.js';
|
|
12
12
|
import { MODULE_UI_ENTRY, uiTreeDigest } from "./ui-assets.js";
|
|
13
13
|
import { minifyUi, isUiBundle } from "./public-ui.js";
|
|
14
14
|
import { nativePortal } from "./portal.js";
|
|
@@ -75,7 +75,7 @@ export async function inspectStandaloneSpk(spkPath) {
|
|
|
75
75
|
return inspectSpk(spkPath, "native-go");
|
|
76
76
|
}
|
|
77
77
|
/** Auto-detect the generated runtime; retain strict native-go inspection when requested. */
|
|
78
|
-
export async function inspectSpk(spkPath, expectedKind) {
|
|
78
|
+
export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
79
79
|
const dir = mkdtempSync(join(tmpdir(), "syno-inspect-spk-"));
|
|
80
80
|
try {
|
|
81
81
|
const findings = (await archiveInventory(spkPath, true)).map(formatArchiveIssue);
|
|
@@ -202,7 +202,7 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
202
202
|
const integrations = metadata.integrations ?? [];
|
|
203
203
|
await inspectCtlArtifacts(dir, paths, metadata.ctl, metadata.entry, findings);
|
|
204
204
|
if (metadata.compose !== undefined) {
|
|
205
|
-
const result = await inspectUnifiedCompose(dir, payload, { ...metadata, installSettings, minMemoryMb }, findings);
|
|
205
|
+
const result = await inspectUnifiedCompose(dir, payload, { ...metadata, installSettings, minMemoryMb }, findings, options.baseline);
|
|
206
206
|
if (dependencies) {
|
|
207
207
|
result.dependencies = dependencies;
|
|
208
208
|
}
|
|
@@ -351,7 +351,7 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
351
351
|
? await inspectLoginStyle(dir, info.package, Boolean(portal || executor?.policy.portal), findings)
|
|
352
352
|
: undefined;
|
|
353
353
|
if (standalone)
|
|
354
|
-
checkSharedFolder(dir, findings, info.package, sharedFolder, executor?.policy.scope === "install-selected", portal, hasExecutor, nativeGateway, info.os_min_ver, installSettings, integrations, metadata.installPorts, minMemoryMb);
|
|
354
|
+
checkSharedFolder(dir, findings, info.package, sharedFolder, executor?.policy.scope === "install-selected", portal, hasExecutor, nativeGateway, info.os_min_ver, installSettings, integrations, metadata.installPorts, minMemoryMb, options.baseline);
|
|
355
355
|
const icon = inspectPackageIcons(dir, findings);
|
|
356
356
|
const cgiEntry = payload.find((entry) => entry.path === CGI_PAYLOAD_PATH);
|
|
357
357
|
if (standalone && !cgiEntry) {
|
|
@@ -761,7 +761,7 @@ async function checkArch(dir, info, kind, hasCgi, findings) {
|
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
/** Replay the SDK planner over archived source bytes, not merely a mutable lock. */
|
|
764
|
-
async function inspectUnifiedCompose(dir, payload, metadata, findings) {
|
|
764
|
+
async function inspectUnifiedCompose(dir, payload, metadata, findings, baseline = false) {
|
|
765
765
|
const info = readInfo(join(dir, "INFO"), findings, "binary", true, undefined, inspectPackageDependencies(metadata.dependencies, findings));
|
|
766
766
|
const base = {
|
|
767
767
|
kind: "container",
|
|
@@ -860,7 +860,7 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings) {
|
|
|
860
860
|
throw new Error("gateway configuration differs from the declared package contract");
|
|
861
861
|
if (readOptional(join(dir, "conf/privilege")) !== renderNativePrivilege())
|
|
862
862
|
throw new Error("Compose hooks must run as the package account");
|
|
863
|
-
if (manifest.sharedFolder || metadata.installSettings || metadata.installPorts || metadata.minMemoryMb !== undefined) {
|
|
863
|
+
if (!baseline && (manifest.sharedFolder || metadata.installSettings || metadata.installPorts || metadata.minMemoryMb !== undefined)) {
|
|
864
864
|
for (const [name, text] of Object.entries(expectedWizardFiles(info.package, manifest.sharedFolder, false, undefined, metadata.installSettings, [], manifest.identityGateway?.listen.https, metadata.installPorts, metadata.minMemoryMb)))
|
|
865
865
|
if (readOptional(join(dir, "WIZARD_UIFILES", name)) !== text)
|
|
866
866
|
throw new Error(`unexpected WIZARD_UIFILES/${name}; native share selection must match the declaration`);
|
|
@@ -883,7 +883,7 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings) {
|
|
|
883
883
|
composeData: c.plan.app_data,
|
|
884
884
|
portal: Boolean(nativePortal(manifest)),
|
|
885
885
|
}))) {
|
|
886
|
-
if (readOptional(join(dir, "WIZARD_UIFILES", name)) !== text)
|
|
886
|
+
if (!baseline && readOptional(join(dir, "WIZARD_UIFILES", name)) !== text)
|
|
887
887
|
throw new Error(`unexpected WIZARD_UIFILES/${name}; retained-volume guidance must match the plan`);
|
|
888
888
|
}
|
|
889
889
|
manifest.appScripts = undefined;
|
|
@@ -1516,7 +1516,7 @@ function checkBackground(dir, info, payload, findings, executor, daemon, bridge
|
|
|
1516
1516
|
* declaration (without one, any present file must be the default native
|
|
1517
1517
|
* install wizard), and no other install/upgrade wizard file may exist.
|
|
1518
1518
|
*/
|
|
1519
|
-
function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal, executor = false, nativeGateway, osMinVer, installSettings, integrations = [], installPortDefinitions = {}, minMemoryMb) {
|
|
1519
|
+
function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal, executor = false, nativeGateway, osMinVer, installSettings, integrations = [], installPortDefinitions = {}, minMemoryMb, baseline = false) {
|
|
1520
1520
|
const wizardDir = join(dir, "WIZARD_UIFILES");
|
|
1521
1521
|
const present = (existsSync(wizardDir) ? readdirSync(wizardDir) : [])
|
|
1522
1522
|
.filter((name) => /^(install|upgrade)_uifile(_|\.|$)/.test(name))
|
|
@@ -1554,13 +1554,13 @@ function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal,
|
|
|
1554
1554
|
? "the integrations declaration"
|
|
1555
1555
|
: "the native-go default install wizard";
|
|
1556
1556
|
// The default native wizard is optional; a declared shared folder or portal needs all of its files.
|
|
1557
|
-
for (const name of folder || selected || portal || installSettings || Object.keys(installPortDefinitions).length || integrations.length || minMemoryMb !== undefined
|
|
1557
|
+
for (const name of baseline ? [] : folder || selected || portal || installSettings || Object.keys(installPortDefinitions).length || integrations.length || minMemoryMb !== undefined
|
|
1558
1558
|
? Object.keys(wizards)
|
|
1559
1559
|
: present.filter((n) => n in wizards)) {
|
|
1560
1560
|
if (readOptional(join(wizardDir, name)) !== wizards[name])
|
|
1561
1561
|
findings.push(`WIZARD_UIFILES/${name} does not match ${source}`);
|
|
1562
1562
|
}
|
|
1563
|
-
for (const name of present.filter((n) => !(n in wizards)))
|
|
1563
|
+
for (const name of baseline ? [] : present.filter((n) => !(n in wizards)))
|
|
1564
1564
|
findings.push(`WIZARD_UIFILES/${name} is not a wizard file produced by ${source}`);
|
|
1565
1565
|
if (selected) {
|
|
1566
1566
|
for (const hook of ["preinst", "postinst"]) {
|
|
@@ -1604,7 +1604,8 @@ async function inspectInstallSettings(dir, payload, metadata, findings) {
|
|
|
1604
1604
|
const settings = readInstallSettings(metadata.installSettings, e => findings.push(e.message));
|
|
1605
1605
|
const present = payload.filter(p => p.path.startsWith('install/'));
|
|
1606
1606
|
const ports = metadata.installPorts;
|
|
1607
|
-
|
|
1607
|
+
const folder = recoverSharedFolder(readOptional(join(dir, 'scripts/postinst')));
|
|
1608
|
+
if (!settings && !ports && (metadata.compose || folder?.picker !== 'folder')) {
|
|
1608
1609
|
if (present.length)
|
|
1609
1610
|
findings.push('INSTALL_SETTINGS_INVALID unexpected installation settings payload');
|
|
1610
1611
|
return;
|
|
@@ -1614,11 +1615,13 @@ async function inspectInstallSettings(dir, payload, metadata, findings) {
|
|
|
1614
1615
|
await extractSpkArchive({ file: join(dir, 'package.tgz'), cwd: root });
|
|
1615
1616
|
const info = readInfo(join(dir, 'INFO'), findings, 'binary', Boolean(metadata.compose), undefined, inspectPackageDependencies(metadata.dependencies, findings));
|
|
1616
1617
|
const gateway = metadata.compose?.gateway ?? metadata.native_gateway;
|
|
1617
|
-
const m = { package: info.package, os_min_ver: info.os_min_ver, capabilities: {}, installSettings: settings, identityGateway: gateway, ...(ports ? { installPorts: true } : {}) };
|
|
1618
|
+
const m = { package: info.package, os_min_ver: info.os_min_ver, capabilities: {}, installSettings: settings, identityGateway: gateway, sharedFolder: folder, ...(metadata.compose ? { compose: metadata.compose } : {}), ...(ports ? { installPorts: true } : {}) };
|
|
1618
1619
|
try {
|
|
1619
1620
|
if (settings && readOptional(join(root, 'install/settings.json')) !== JSON.stringify(settingsConfig(m), null, 2) + '\n')
|
|
1620
1621
|
throw new Error('settings inventory differs from its declaration or gateway port');
|
|
1621
|
-
|
|
1622
|
+
if (!metadata.compose && folder?.picker === 'folder' && readOptional(join(root, 'install/folder.json')) !== JSON.stringify(nativeFolderConfig(m), null, 2) + '\n')
|
|
1623
|
+
throw new Error('native folder inventory differs from installer declaration');
|
|
1624
|
+
const allowed = ['install/control', ...(!metadata.compose && folder?.picker === 'folder' ? ['install/folder.json'] : []), ...(settings ? ['install/settings.json'] : []), ...(ports ? ['install/ports.json', `install/${info.package}.sc`] : [])];
|
|
1622
1625
|
if (present.length !== allowed.length || !present.some(p => p.path === 'install/control' && p.mode === '0755') || present.some(p => !allowed.includes(p.path)))
|
|
1623
1626
|
throw new Error('only SDK control and declarations may be packaged; values must never ship');
|
|
1624
1627
|
if (ports) {
|
|
@@ -1644,8 +1647,10 @@ async function inspectInstallSettings(dir, payload, metadata, findings) {
|
|
|
1644
1647
|
if (error)
|
|
1645
1648
|
throw new Error(error.message);
|
|
1646
1649
|
// App wrappers remain intact here; remove exactly the SDK prefix within them.
|
|
1647
|
-
for (const name of ['preinst', 'postinst', 'postupgrade', 'preuninst']) {
|
|
1648
|
-
const file = join(dir, 'scripts', name), text = readOptional(file), prefix = renderSettingsHook(name, m);
|
|
1650
|
+
for (const name of ['preinst', 'postinst', 'postupgrade', 'preuninst', 'start-stop-status']) {
|
|
1651
|
+
const file = join(dir, 'scripts', name), text = readOptional(file), prefix = renderSettingsHook(name, m) + renderNativeFolderHook(name, m);
|
|
1652
|
+
if (!prefix)
|
|
1653
|
+
continue;
|
|
1649
1654
|
const sdk = text && sdkScriptOf(name, text)?.sdk;
|
|
1650
1655
|
if (!sdk || !matchesStandaloneScriptPrefix(name, m, sdk) || text.split(prefix).length !== 2)
|
|
1651
1656
|
throw new Error(`scripts/${name} lacks the exact SDK settings hook`);
|
|
@@ -34,3 +34,9 @@ export declare function settingsConfig(m: Pick<StandaloneManifest, 'package' | '
|
|
|
34
34
|
};
|
|
35
35
|
export declare function renderSettingsHook(name: string, m: StandaloneManifest): string;
|
|
36
36
|
export declare function buildInstallSettings(m: StandaloneManifest, arch: NativeArchFamily, work: string, run: CommandRunner): Promise<string | undefined>;
|
|
37
|
+
export declare function nativeFolderConfig(m: Pick<StandaloneManifest, 'package' | 'sharedFolder'>): {
|
|
38
|
+
schema: number;
|
|
39
|
+
package: string;
|
|
40
|
+
sharedFolder: import("./shared-folder.js").SharedFolder | undefined;
|
|
41
|
+
};
|
|
42
|
+
export declare function renderNativeFolderHook(name: string, m: StandaloneManifest): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { sdkSource } from '../runtime/sdk-source.js';
|
|
4
|
-
import { DEFAULT_SDK_VERSION } from '../runtime/sdk-source.js';
|
|
4
|
+
import { DEFAULT_SDK_VERSION, appSdkVersion } from '../runtime/sdk-source.js';
|
|
5
5
|
import { goChildEnv } from '../runtime/go-env.js';
|
|
6
6
|
import { pinnedGoBuildEnv, pinnedGoProblem } from '../build-spk/go-toolchain.js';
|
|
7
7
|
import { checkCgiBinary } from './binary.js';
|
|
@@ -47,13 +47,15 @@ export function renderSettingsHook(name, m) {
|
|
|
47
47
|
return `"${root}/install/control" ${action} --root "${root}" --package '${m.package}' || exit $?\n`;
|
|
48
48
|
}
|
|
49
49
|
export async function buildInstallSettings(m, arch, work, run) {
|
|
50
|
-
if (!m.installSettings && !m.installPorts)
|
|
50
|
+
if (!m.installSettings && !m.installPorts && (m.compose || m.sharedFolder?.picker !== 'folder'))
|
|
51
51
|
return;
|
|
52
|
-
const sdk = m.compose?.sdk ?? m.identityGateway?.sdk ?? DEFAULT_SDK_VERSION, source = sdkSource(sdk);
|
|
52
|
+
const sdk = m.compose?.sdk ?? m.identityGateway?.sdk ?? (m.backend.kind !== "binary" ? appSdkVersion(m.backend) : undefined) ?? DEFAULT_SDK_VERSION, source = sdkSource(sdk);
|
|
53
53
|
if (!existsSync(join(source.goDir, 'installsettings/cmd/control/main.go')))
|
|
54
54
|
throw new StandaloneBuildError('SDK_INSTALL_SETTINGS_UNSUPPORTED', 'Use an SDK release with native install.settings support.');
|
|
55
55
|
if (m.installPorts && !existsSync(join(source.goDir, 'installsettings/ports.go')))
|
|
56
56
|
throw new StandaloneBuildError('SDK_PORT_SETTINGS_UNSUPPORTED', 'Use an SDK release with install.ports support');
|
|
57
|
+
if (!m.compose && m.sharedFolder?.picker === 'folder' && !existsSync(join(source.goDir, 'internal/sharepreflight/native.go')))
|
|
58
|
+
throw new StandaloneBuildError('SDK_SHARED_FOLDER_UNSUPPORTED', 'Use SDK 0.53.23 or later for folder selection.');
|
|
57
59
|
const out = join(work, `install-settings-${arch}`);
|
|
58
60
|
const result = await run('go', ['build', '-trimpath', '-buildvcs=false', '-ldflags', '-s -w -buildid=', '-o', out, './installsettings/cmd/control'], { cwd: source.goDir, env: goChildEnv({ ...process.env, ...pinnedGoBuildEnv(arch) }) });
|
|
59
61
|
if (result.status !== 0)
|
|
@@ -63,3 +65,16 @@ export async function buildInstallSettings(m, arch, work, run) {
|
|
|
63
65
|
throw new StandaloneBuildError('SDK_INSTALL_SETTINGS_BUILD_FAILED', error?.message ?? toolchain);
|
|
64
66
|
return out;
|
|
65
67
|
}
|
|
68
|
+
export function nativeFolderConfig(m) {
|
|
69
|
+
return { schema: 1, package: m.package, sharedFolder: m.sharedFolder };
|
|
70
|
+
}
|
|
71
|
+
export function renderNativeFolderHook(name, m) {
|
|
72
|
+
if (m.compose || m.sharedFolder?.picker !== 'folder')
|
|
73
|
+
return '';
|
|
74
|
+
const root = `\${SYNOPKG_PKGDEST:-/var/packages/${m.package}/target}`;
|
|
75
|
+
if (name === 'preinst')
|
|
76
|
+
return `"\${SYNOPKG_PKGINST_TEMP_DIR:?}/install/control" folder-prepare --root "\${SYNOPKG_PKGINST_TEMP_DIR:?}" --package '${m.package}' || exit $?\n`;
|
|
77
|
+
if (name !== 'start-stop-status')
|
|
78
|
+
return '';
|
|
79
|
+
return `case "$1" in prestart|start|restart)\n synopkgland_folder_result=0\n "${root}/install/control" folder-check --root "${root}" --package '${m.package}' || synopkgland_folder_result=$?\n if [ "$synopkgland_folder_result" != 0 ]; then\n case "\${SYNOPKG_PKG_STATUS:-}:$synopkgland_folder_result" in INSTALL:2|UPGRADE:2) exit 0 ;; esac\n exit "$synopkgland_folder_result"\n fi ;;\nesac\n`;
|
|
80
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderGatewayIngressCheck } from './native-gateway.js';
|
|
2
2
|
import { renderMemoryHook } from './install-memory.js';
|
|
3
|
-
import { renderSettingsHook } from './install-settings.js';
|
|
3
|
+
import { renderSettingsHook, renderNativeFolderHook } from './install-settings.js';
|
|
4
4
|
import { renderComposeRetainedData } from "../build-spk/compose-retained-data.js";
|
|
5
5
|
import { renderNativeGatewayDiagnostic, renderNativeGatewayPortWait, renderNativeGatewayPrepare } from './native-gateway.js';
|
|
6
6
|
import { renderComposeDiagnosis } from "../build-spk/compose-diagnosis.js";
|
|
@@ -25,7 +25,7 @@ export function renderStandaloneScript(name, manifest) {
|
|
|
25
25
|
}
|
|
26
26
|
function renderStandaloneScriptPrefix(name, manifest) {
|
|
27
27
|
const prepared = ['postinst', 'postupgrade'].includes(name) ? renderNativeGatewayPrepare(manifest) : '';
|
|
28
|
-
return (name === 'preinst' ? renderMemoryHook(manifest.minMemoryMb) : '') + renderGatewayIngressCheck(manifest, name) + renderNativeGatewayDiagnostic(manifest, name) + renderNativeGatewayPortWait(manifest, name) + renderSettingsHook(name, manifest) + prepared;
|
|
28
|
+
return (name === 'preinst' ? renderMemoryHook(manifest.minMemoryMb) : '') + renderGatewayIngressCheck(manifest, name) + renderNativeGatewayDiagnostic(manifest, name) + renderNativeGatewayPortWait(manifest, name) + renderSettingsHook(name, manifest) + renderNativeFolderHook(name, manifest) + prepared;
|
|
29
29
|
}
|
|
30
30
|
/** Settings inspection peels its hook only at the position build's renderer writes.
|
|
31
31
|
* The backend inspector then replays the entire remaining lifecycle script. */
|
|
@@ -39,13 +39,18 @@ export function matchesStandaloneScriptPrefix(name, manifest, actual) {
|
|
|
39
39
|
/** Accept the exact current, diagnostic-only, and released lifecycle variants. */
|
|
40
40
|
export function matchesStandaloneScript(name, manifest, actual, settingsPeeled = false) {
|
|
41
41
|
const expected = renderStandaloneScript(name, manifest);
|
|
42
|
-
return actual !== undefined && standaloneScriptVariants(name, manifest, settingsPeeled ? expected.replace(renderSettingsHook(name, manifest), '') : expected).includes(actual);
|
|
42
|
+
return actual !== undefined && standaloneScriptVariants(name, manifest, settingsPeeled ? expected.replace(renderSettingsHook(name, manifest), '').replace(renderNativeFolderHook(name, manifest), '') : expected).includes(actual);
|
|
43
43
|
}
|
|
44
44
|
function standaloneScriptVariants(name, manifest, expected) {
|
|
45
45
|
const diagnostic = renderNativeGatewayDiagnostic(manifest, name);
|
|
46
46
|
const wait = renderNativeGatewayPortWait(manifest, name);
|
|
47
47
|
const diagnosticOnly = wait ? expected.replace(wait, '') : expected;
|
|
48
48
|
const variants = [expected, ...(wait ? [diagnosticOnly] : []), ...(diagnostic ? [diagnosticOnly.replace(diagnostic, '')] : [])];
|
|
49
|
+
if (manifest.compose && manifest.sharedFolder?.picker === 'folder' && ['postinst', 'postupgrade'].includes(name)) {
|
|
50
|
+
const current = renderSharedFolderScript(manifest.package, manifest.sharedFolder, true).slice('#!/bin/sh\n'.length);
|
|
51
|
+
const released = renderSharedFolderScript(manifest.package, manifest.sharedFolder, true, true).slice('#!/bin/sh\n'.length);
|
|
52
|
+
variants.push(...variants.map(script => script.replace(current, () => released)));
|
|
53
|
+
}
|
|
49
54
|
// One released renderer added daemon bookkeeping even without a daemon.
|
|
50
55
|
// Replay that exact variant, retaining the complete lifecycle comparison.
|
|
51
56
|
if (name === 'start-stop-status' && !manifest.daemon &&
|
|
@@ -67,6 +72,10 @@ function renderStandaloneScriptInternal(name, manifest) {
|
|
|
67
72
|
let body = name === "preinst"
|
|
68
73
|
? renderComposeInstall(manifest.package).replace("#!/bin/sh\n", () => "#!/bin/sh\n" + renderSharedFolderPreparation(manifest.sharedFolder))
|
|
69
74
|
: renderStandaloneScriptInternal(name, { ...native, appScripts: undefined });
|
|
75
|
+
if (manifest.sharedFolder && ["postinst", "postupgrade"].includes(name)) {
|
|
76
|
+
// Preserve the released Compose hook while native Apps use install/control.
|
|
77
|
+
body = body.replace(renderSharedFolderScript(manifest.package, manifest.sharedFolder).slice("#!/bin/sh\n".length), () => renderSharedFolderScript(manifest.package, manifest.sharedFolder, true).slice("#!/bin/sh\n".length));
|
|
78
|
+
}
|
|
70
79
|
if (name === "start-stop-status" && !manifest.identityGateway) {
|
|
71
80
|
// Report real local teardown failures. Container Manager may remove
|
|
72
81
|
// profiles on STOP and recreate them in its START worker; neither
|
|
@@ -40,7 +40,7 @@ import { PORTAL_REQUIRES_EXECUTOR, portalEntryProblem, readPortalDeclaration, }
|
|
|
40
40
|
import { renderPackageIcons } from "../build-spk/dsm-icons.js";
|
|
41
41
|
import { LOGIN_COLOR, loginImageProblem, } from "../build-spk/login-style.js";
|
|
42
42
|
import { validateReproducible } from "../reproducible-config.js";
|
|
43
|
-
import { appSdkVersion, SDK_MODULE, sdkSource, } from "../runtime/sdk-source.js";
|
|
43
|
+
import { DEFAULT_SDK_VERSION, appSdkVersion, SDK_MODULE, sdkSource, } from "../runtime/sdk-source.js";
|
|
44
44
|
import { sdkProblems } from "./sdk-check.js";
|
|
45
45
|
import { portalSdkVersion } from "./portal.js";
|
|
46
46
|
import { readWindowSize } from "./window-size.js";
|
|
@@ -304,8 +304,12 @@ function readManifest(raw, c) {
|
|
|
304
304
|
const sharedFolder = raw.install === undefined
|
|
305
305
|
? undefined
|
|
306
306
|
: readSharedFolder(raw.install, (e) => c.fail(e.code, e.message));
|
|
307
|
-
if (sharedFolder?.picker === "folder" && raw.compose === undefined)
|
|
308
|
-
|
|
307
|
+
if (sharedFolder?.picker === "folder" && raw.compose === undefined) {
|
|
308
|
+
const sdk = (typeof gatewayRaw.sdk === "string" ? gatewayRaw.sdk : undefined) ?? (backend && backend.kind !== "binary" ? appSdkVersion(backend) : undefined) ?? DEFAULT_SDK_VERSION;
|
|
309
|
+
const [major, minor, patch] = sdk.split('.').map(Number);
|
|
310
|
+
if (!Number.isInteger(major) || major === 0 && (minor < 53 || minor === 53 && patch < 23))
|
|
311
|
+
c.fail("SDK_SHARED_FOLDER_UNSUPPORTED", "Native folder selection requires SDK 0.53.23 or later; align the App and identity gateway SDK pins.");
|
|
312
|
+
}
|
|
309
313
|
const installPorts = isRecord(raw.install) && raw.install.ports === true ? true : undefined;
|
|
310
314
|
const minMemoryMb = readMinMemoryMb(isRecord(raw.install) ? raw.install.min_memory_mb : undefined, e => c.fail(e.code, e.message));
|
|
311
315
|
if (isRecord(raw.install) && raw.install.ports !== undefined && raw.install.ports !== true)
|
|
@@ -27,7 +27,7 @@ export declare const SHARED_FOLDER_MARKER = "# synopkgland:install.sharedFolder
|
|
|
27
27
|
* in `$SYNOPKG_PKGVAR/config.json`. The volume path is resolved at run time,
|
|
28
28
|
* so a moved folder keeps working. Runs as the package account.
|
|
29
29
|
*/
|
|
30
|
-
export declare function renderSharedFolderScript(pkg: string, folder: SharedFolder): string;
|
|
30
|
+
export declare function renderSharedFolderScript(pkg: string, folder: SharedFolder, compose?: boolean, legacyFolderUpgrade?: boolean): string;
|
|
31
31
|
/** Adapt the wizard answer to the existing SDK preinst selection contract. */
|
|
32
32
|
export declare function renderSharedFolderPreparation(folder: SharedFolder | undefined): string;
|
|
33
33
|
/** `install_uifile` and `upgrade_uifile`, English plus one file per DSM language. */
|
|
@@ -27,8 +27,8 @@ export function readSharedFolder(value, fail) {
|
|
|
27
27
|
return refuse(" accepts only mode, key, name, permission and picker.");
|
|
28
28
|
}
|
|
29
29
|
const { mode, key, name, permission, picker } = folder;
|
|
30
|
-
if (picker !== undefined && (picker !== "folder" || mode !== "select"))
|
|
31
|
-
return refuse("picker: folder requires mode: select.");
|
|
30
|
+
if (picker !== undefined && (picker !== "folder" || (mode !== "select" && mode !== "dedicated")))
|
|
31
|
+
return refuse("picker: folder requires mode: select or dedicated.");
|
|
32
32
|
if (mode !== "select" && mode !== "create" && mode !== "dedicated")
|
|
33
33
|
return refuse(" mode must be dedicated, select or create.");
|
|
34
34
|
if (permission !== "ro" && permission !== "rw")
|
|
@@ -42,7 +42,7 @@ export function readSharedFolder(value, fail) {
|
|
|
42
42
|
if (typeof name !== "string" || !SHARE_NAME.test(name) || SYSTEM_SHARE.test(name)) {
|
|
43
43
|
return refuse("create needs name: start with an alphanumeric, contain only alphanumerics, underscores and hyphens (at most 32 characters), and not be a DSM system shared folder name.");
|
|
44
44
|
}
|
|
45
|
-
return { mode, key, name, permission };
|
|
45
|
+
return { mode, key, name, permission, ...(picker ? { picker: "folder" } : {}) };
|
|
46
46
|
}
|
|
47
47
|
/** The first line `inspect` looks for to recover the declaration from an SPK. */
|
|
48
48
|
export const SHARED_FOLDER_MARKER = "# synopkgland:install.sharedFolder ";
|
|
@@ -51,17 +51,26 @@ export const SHARED_FOLDER_MARKER = "# synopkgland:install.sharedFolder ";
|
|
|
51
51
|
* in `$SYNOPKG_PKGVAR/config.json`. The volume path is resolved at run time,
|
|
52
52
|
* so a moved folder keeps working. Runs as the package account.
|
|
53
53
|
*/
|
|
54
|
-
export function renderSharedFolderScript(pkg, folder) {
|
|
54
|
+
export function renderSharedFolderScript(pkg, folder, compose = false, legacyFolderUpgrade = false) {
|
|
55
55
|
const { key } = folder;
|
|
56
|
+
const check = compose
|
|
57
|
+
? `"\${SYNOPKG_PKGDEST:-/var/packages/${pkg}/target}/compose/control" share-check || :`
|
|
58
|
+
: `"\${SYNOPKG_PKGDEST:-/var/packages/${pkg}/target}/install/control" folder-check --root "\${SYNOPKG_PKGDEST:-/var/packages/${pkg}/target}" --package '${pkg}' || :`;
|
|
59
|
+
const upgrade = legacyFolderUpgrade
|
|
60
|
+
? `if [ "\${SYNOPKG_PKG_STATUS:-}" = UPGRADE ] && [ "\${${key}+x}" != x ]; then synopkgland_folder_check; exit 0; fi`
|
|
61
|
+
: `if [ "\${SYNOPKG_PKG_STATUS:-}" = UPGRADE ] && [ "\${${key}_subpath+x}" != x ]; then
|
|
62
|
+
saved=$(sed -n 's/^.*"shared_folders":{"${key}":"\\([^"\\\\]*\\)"}.*$/\\1/p' "$PKGVAR/config.json")
|
|
63
|
+
if [ "\${${key}+x}" != x ] || [ "\${${key}-}" = "$saved" ]; then synopkgland_folder_check; exit 0; fi
|
|
64
|
+
fi`;
|
|
56
65
|
if (folder.picker === "folder")
|
|
57
66
|
return `#!/bin/sh
|
|
58
67
|
${SHARED_FOLDER_MARKER}${JSON.stringify(folder)}
|
|
59
68
|
set -eu
|
|
60
69
|
PKGVAR="\${SYNOPKG_PKGVAR:-/var/packages/${pkg}/var}"
|
|
61
70
|
synopkgland_folder_check() {
|
|
62
|
-
|
|
71
|
+
${check}
|
|
63
72
|
}
|
|
64
|
-
|
|
73
|
+
${upgrade}
|
|
65
74
|
name="\${${key}:?missing shared folder}"
|
|
66
75
|
[ "\${${key}_subpath+x}" = x ] || { echo "missing folder subpath answer" >&2; exit 1; }
|
|
67
76
|
# Empty subpath selects the root; presence is mandatory, content may be empty.
|
|
@@ -140,7 +149,7 @@ function installItems(t, pkg, folder) {
|
|
|
140
149
|
field.validator = { allowBlank: false, fn: existingShareValidator(validationMessages(t), false, folder.name) };
|
|
141
150
|
if (folder.mode === "dedicated")
|
|
142
151
|
picker.desc = t("nativeShare.optionalExisting", { name: folder.name });
|
|
143
|
-
return [intro(t, pkg, folder), picker, ...(folder.picker === "folder" ? [folderSubpathItem(t, folder.key)] : [])];
|
|
152
|
+
return [intro(t, pkg, folder), picker, ...(folder.picker === "folder" ? [folderSubpathItem(t, folder.key, folder.mode === "dedicated" ? folder.name : undefined)] : [])];
|
|
144
153
|
}
|
|
145
154
|
/** Upgrade always submits the displayed selection, prefilled from config.json.
|
|
146
155
|
* A raw unconfirmed picker value must never diverge from the DSM resource grant. */
|
package/dist/standalone/spk.js
CHANGED
|
@@ -6,7 +6,7 @@ import { requireDaemonNoFileActivation } from "./daemon-nofile.js";
|
|
|
6
6
|
import { gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
7
7
|
import { portDefaults, portInstallSteps, writePortPayload } from "./install-ports.js";
|
|
8
8
|
import { packageDependencies, dependencyInfo } from "./package-dependencies.js";
|
|
9
|
-
import { settingsInstallSteps, settingsConfig } from './install-settings.js';
|
|
9
|
+
import { settingsInstallSteps, settingsConfig, nativeFolderConfig } from './install-settings.js';
|
|
10
10
|
import { backupConfig, backupHookProblem, backupRecord, renderBackupScripts, BACKUP_PAYLOAD_DIR, BACKUP_SCRIPTS_DIR, BACKUP_SCRIPT_MODES } from './hyper-backup.js';
|
|
11
11
|
import { nativeGatewaySupported, nativeGatewaySdk, renderNativeGatewayConfig, NATIVE_GATEWAY_CONFIG, legacyGatewayNotice, gatewayEntryPath } from './native-gateway.js';
|
|
12
12
|
import { portalInfoFields } from "../portal/info.js";
|
|
@@ -244,12 +244,14 @@ export async function assembleStandaloneSpk(options) {
|
|
|
244
244
|
chmodSync(join(target, "storage-init"), EXEC_MODE);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
if (manifest.installSettings || manifest.installPorts) {
|
|
247
|
+
if (manifest.installSettings || manifest.installPorts || !manifest.compose && manifest.sharedFolder?.picker === 'folder') {
|
|
248
248
|
if (!options.installSettingsControl)
|
|
249
249
|
throw new StandaloneBuildError('SDK_INSTALL_SETTINGS_BUILD_FAILED', 'SDK settings controller required.');
|
|
250
250
|
const target = join(staging, 'package/install');
|
|
251
251
|
mkdirSync(target, { recursive: true });
|
|
252
252
|
copyExecutable(options.installSettingsControl, join(target, 'control'));
|
|
253
|
+
if (!manifest.compose && manifest.sharedFolder?.picker === 'folder')
|
|
254
|
+
writeFile(join(target, 'folder.json'), JSON.stringify(nativeFolderConfig(manifest), null, 2) + '\n');
|
|
253
255
|
if (manifest.installSettings)
|
|
254
256
|
writeFile(join(target, 'settings.json'), JSON.stringify(settingsConfig(manifest), null, 2) + '\n');
|
|
255
257
|
}
|
package/docs/shared-folders.md
CHANGED
|
@@ -49,8 +49,8 @@ deleted when the selection changes. CLI deployment defaults a fresh dedicated
|
|
|
49
49
|
install to its declared name. To select or change a share explicitly, use
|
|
50
50
|
`--param media=Media` on install, or
|
|
51
51
|
`--param CHANGE_media=true --param media=OtherMedia` on upgrade/repair. Omitted
|
|
52
|
-
upgrade answers
|
|
53
|
-
|
|
52
|
+
upgrade answers retain the recorded selection. Older share-only records select
|
|
53
|
+
their original share root automatically; no folder reselection is required.
|
|
54
54
|
|
|
55
55
|
`mode: create` creates a fixed folder without a picker. `mode: select` requires
|
|
56
56
|
an existing folder and uses the same DSM grant and validation. Its picker starts
|
|
@@ -88,10 +88,47 @@ substitution. Device acceptance additionally verified first-install grants,
|
|
|
88
88
|
upgrade switching, same-version reinstallation after revocation and retained
|
|
89
89
|
files/ACLs after uninstall.
|
|
90
90
|
|
|
91
|
-
## Select
|
|
91
|
+
## Select a folder in native or Compose Apps
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
Native Go, Node, Python and binary daemon packages support folder selection with
|
|
94
|
+
matching current CLI and SDK releases (see the changelog). Use the same installer declaration as Compose:
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
install:
|
|
98
|
+
sharedFolder: {mode: select, key: media, permission: rw, picker: folder}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`mode: dedicated` also accepts `picker: folder` with an App-named `name`.
|
|
102
|
+
Its default can create the dedicated share root; an existing child must already
|
|
103
|
+
exist. `mode: create` has no folder picker. Native packages need no Compose
|
|
104
|
+
capability or Container Manager. Keep the App, gateway and CLI controller SDK
|
|
105
|
+
pins aligned. The native package's existing `install/control` handles preparation
|
|
106
|
+
and access checks; `var/config.json` remains the one selection record.
|
|
107
|
+
|
|
108
|
+
Go Apps read the resolved path through the SDK:
|
|
109
|
+
|
|
110
|
+
```go
|
|
111
|
+
folders := sharedfolder.Config{
|
|
112
|
+
Account: "ExampleApp",
|
|
113
|
+
DataDir: "/var/packages/ExampleApp/var",
|
|
114
|
+
Required: map[string]sharedfolder.Access{"media": sharedfolder.Write},
|
|
115
|
+
}
|
|
116
|
+
path, err := folders.Require("media")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Node backends use `new SharedFolderConfig({packageId: 'ExampleApp'})` from
|
|
120
|
+
`@synopackageland/app`, then `await folders.require('media')`. Python backends use
|
|
121
|
+
`SharedFolderConfig('ExampleApp').require('media')` from `synopkgland_app`.
|
|
122
|
+
Both use the same packaged SDK controller to resolve and check the selection.
|
|
123
|
+
Configure package identity and optional private paths in trusted App code.
|
|
124
|
+
Applications must handle errors and must not parse `config.json` themselves.
|
|
125
|
+
|
|
126
|
+
Each call resolves volume + share + relative subpath anew. A native daemon can
|
|
127
|
+
pass that path to an upstream process when starting it; if the share moves while
|
|
128
|
+
the upstream process caches its root, restart the App to resolve it again. The
|
|
129
|
+
SDK never creates a missing selected child or moves data.
|
|
130
|
+
|
|
131
|
+
Compose uses the same field and additionally declares its matching mount:
|
|
95
132
|
|
|
96
133
|
```yaml
|
|
97
134
|
install:
|
|
@@ -109,7 +146,7 @@ compose:
|
|
|
109
146
|
```
|
|
110
147
|
|
|
111
148
|
This reuses the current single native install share contract. `picker: folder`
|
|
112
|
-
|
|
149
|
+
supports `mode: select` or `dedicated`; Compose uses `select: install`. Container-root
|
|
113
150
|
services still cannot bind shared folders. Other share modes keep their existing
|
|
114
151
|
behavior. It does not require an SDK frontend dependency in the application.
|
|
115
152
|
|
|
@@ -118,14 +155,17 @@ DSM 7.2.2 and newer receive a Vue custom page that opens DSM's native directory
|
|
|
118
155
|
chooser. DSM 7.1, DSM 7.2.1 and unknown versions receive a standard share combobox and a
|
|
119
156
|
relative folder-path text field. The static wizard is also the standard version;
|
|
120
157
|
older Package Center parsers never need to parse a custom page from this SPK.
|
|
121
|
-
The custom page
|
|
158
|
+
The custom page chooses its heading and intro from Package Center's DSM UI
|
|
159
|
+
language, then the browser locale, with English for unsupported or absent values.
|
|
160
|
+
It uses the public headline hook even when DSM selected another server-side
|
|
161
|
+
locale file. The custom page follows the public
|
|
122
162
|
[ExamplePackages wizard contract](https://github.com/SynologyOpenSource/ExamplePackages/tree/main/ExamplePackage/WIZARD_UIFILES).
|
|
123
163
|
|
|
124
164
|
The wizard submits `media=Media` and `media_subpath=Projects/Level two/Deep`.
|
|
125
165
|
An explicitly empty `media_subpath` selects the share root. Paths can have
|
|
126
166
|
arbitrary depth within a supported mounted local ACL share. Absolute paths,
|
|
127
167
|
empty path components, `.`/`..`, double quotes, backslashes, control characters,
|
|
128
|
-
non-directories and symlink components are rejected.
|
|
168
|
+
non-directories and symlink components are rejected. Folder selection excludes
|
|
129
169
|
home/homes and the special share types listed above. Browse visibility follows
|
|
130
170
|
the logged-in administrator's effective DSM permissions; built-in administrator
|
|
131
171
|
access can differ from a normal user's ACL behavior.
|
|
@@ -137,18 +177,20 @@ storage restrictions and available existence/type metadata. It does not require
|
|
|
137
177
|
package-account RO/RW before DSM data-share acquisition. A descendant that cannot
|
|
138
178
|
be inspected before that grant is deferred rather than called missing.
|
|
139
179
|
|
|
140
|
-
After acquisition, postinst
|
|
180
|
+
After acquisition, postinst performs a read-only package-account check without
|
|
141
181
|
failing installation or upgrade. Startup repeats the actual RO/RW check. A
|
|
142
182
|
pending folder prevents App startup and uses the SDK's existing startup permission
|
|
143
183
|
Dialog, including the share/subfolder, missing permission, the exact **File Station
|
|
144
184
|
> folder > Properties > Permission > system internal user** recovery instructions,
|
|
145
|
-
and **Retry**. The stopped gateway's DSM entry
|
|
185
|
+
and **Retry**. The stopped native or Compose gateway's DSM entry shows this same Dialog after DSM authentication. A package without a gateway reports the error through the hook log and SDK API. Retry
|
|
146
186
|
rechecks current access; the existing ready message directs the user to start the
|
|
147
187
|
App in Package Center. No ACL write, root App, or automatic privileged retry is
|
|
148
188
|
introduced. Upgrades follow the same sequence.
|
|
149
189
|
|
|
150
190
|
The saved record keeps the share name and relative folder path separately.
|
|
151
|
-
Upgrade displays both and can change the selection.
|
|
191
|
+
Upgrade displays both and can change the selection. A share-only record from an
|
|
192
|
+
older package prefills its original share and an empty subpath; a silent upgrade
|
|
193
|
+
keeps that root selection. Deletion, rename, or
|
|
152
194
|
revoked access blocks startup with a recovery message. A share moved to another
|
|
153
195
|
volume is resolved again; if the materialized container source differs, repair
|
|
154
196
|
or upgrade to regenerate it. The package never creates a missing selected folder
|
|
@@ -158,9 +200,7 @@ eliminate changes made after validation.
|
|
|
158
200
|
For CLI deployment, supply both answers:
|
|
159
201
|
`--param media=Media --param media_subpath='Projects/Level two/Deep'`.
|
|
160
202
|
Upgrade additionally needs `--param CHANGE_media=true`; omitting all answers
|
|
161
|
-
retains the installed selection.
|
|
162
|
-
requires matching development SDK sources and is not available from a released
|
|
163
|
-
SDK pin.
|
|
203
|
+
retains the installed selection. Use matching development SDK sources until these versions are published.
|
|
164
204
|
|
|
165
205
|
Known storage limits: chooser metadata rejects home/homes, unmounted encryption,
|
|
166
206
|
USB/SATA, remote/cluster/C2/cold-storage, WORM, offline/moving and forced-read-only
|
package/package.json
CHANGED
package/skills/SKILL.md
CHANGED
|
@@ -42,7 +42,7 @@ keep the installed dependency tree and generated pins consistent.
|
|
|
42
42
|
|
|
43
43
|
For Apps with a physical RAM requirement, set `install.min_memory_mb` (MemTotal in MiB; use 1700 for 2 GB machines). The generated install/upgrade wizards and package-account preinst check it dynamically; read failures warn and allow installation, with no runtime check. See [minimum physical memory](../docs/install-memory.md).
|
|
44
44
|
|
|
45
|
-
For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Default to an App-named dedicated DSM data share and installer-selected ports. Existing-folder access, port number format/range and required HTTPS origins use localized wizard validation before Next; detected port conflicts are nonblocking inline warnings, and an unavailable DSM port inventory does not block installation; upgrades retain port selections.
|
|
45
|
+
For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Native Go/Node/Python Apps may use `picker: folder` (matching current CLI/SDK releases (see the changelog)) and must obtain the selected path through the SDK shared-folder API. Default to an App-named dedicated DSM data share and installer-selected ports. Existing-folder access, port number format/range and required HTTPS origins use localized wizard validation before Next; detected port conflicts are nonblocking inline warnings, and an unavailable DSM port inventory does not block installation; upgrades retain port selections.
|
|
46
46
|
|
|
47
47
|
For private native `<audio>` / `<video>` playback and seeking, read
|
|
48
48
|
[reference/media.md](reference/media.md). Use SDK session-bound media grants,
|
|
@@ -149,7 +149,7 @@ See the scaffold steps and release checklist in [reference/upstream-fork.md](ref
|
|
|
149
149
|
|
|
150
150
|
For upstream OSS packaging, leave `ctl` absent from the manifest by default. Ask whether the user wants AI control; implement it only when explicitly requested. Read [reference/ctl.md](reference/ctl.md) for the required `ctl-plan`, UI/API coverage checklist and asynchronous-operation rules. Own Apps retain the native template's ctl defaults, with commands covering their main features; status-only coverage is incomplete.
|
|
151
151
|
|
|
152
|
-
Start with `synopkgland init -t native-go`, `synopkgland init -t binary`, or `synopkgland init -t compose`. Read reference/create.md or reference/wrap.md, then reference/deploy.md. Native CGI session checks belong to the package. For wrapping upstream OSS with DSM accounts, read [reference/identity-gateway.md](reference/identity-gateway.md) first. For all Compose work, read [reference/compose.md](reference/compose.md): schema-2 upstream files, generated override, SDK planner, fixed package identity and current DSM blockers. Containers do not inherit a signed-in user's File Station ACL. Existing Shared Folder mounts are blocked until official protected ACL/project control is verified.
|
|
152
|
+
Start with `synopkgland init -t native-go`, `synopkgland init -t binary`, or `synopkgland init -t compose`. Read reference/create.md or reference/wrap.md, then reference/deploy.md. Native CGI session checks belong to the package. For wrapping upstream OSS with DSM accounts, read [reference/identity-gateway.md](reference/identity-gateway.md) first. For all Compose work, read [reference/compose.md](reference/compose.md): schema-2 upstream files, generated override, SDK planner, fixed package identity and current DSM blockers. Container temporary files go to disk (`compose.services.<service>.scratch`, with `TMPDIR`); a memory tmpfs needs an explicit `compose.services.<service>.tmpfs` declaration and is always size-bounded. Containers do not inherit a signed-in user's File Station ACL. Existing Shared Folder mounts are blocked until official protected ACL/project control is verified.
|
|
153
153
|
|
|
154
154
|
Never install, uninstall, publish or modify NAS data without task authorization. Prefer check, inspect and deploy --dry-run for reviewable artifacts.
|
|
155
155
|
|
|
@@ -34,3 +34,8 @@ The SDK approval screen reads root-produced diagnostics through executor.status,
|
|
|
34
34
|
then uses the existing PasswordConfirm and exact task readback. Older protected
|
|
35
35
|
runtimes without diagnostic support show an explicit unknown explanation. No App
|
|
36
36
|
option supplies an approved baseline or permission claim.
|
|
37
|
+
|
|
38
|
+
Baseline comparison reads historical wizard files as archived data. It does not
|
|
39
|
+
replay the current wizard renderer against them. Archive integrity, package
|
|
40
|
+
identity, privilege/resources, lifecycle and executor authority remain checked.
|
|
41
|
+
The current SPK receives the normal current-format inspection.
|
|
@@ -127,6 +127,7 @@ a build operator trust decision. `check`/`inspect` remain offline.
|
|
|
127
127
|
| --- | --- |
|
|
128
128
|
| Files in one directory, profiles, anchors, depends_on, healthcheck | Reference-loader semantics retained; healthcheck timing receives the SDK slow-NAS floor; DSM worker compatibility needs device acceptance |
|
|
129
129
|
| Named local volumes | Stable package namespace, retained across recreation; inspect inventory |
|
|
130
|
+
| Temporary files | Disk `scratch` per service (package UID, mode 0700, emptied each start); memory tmpfs only when declared, always size-bounded (default 64 MiB); see [Temporary files](#temporary-files) |
|
|
130
131
|
| Private bind data | DSM build rejects COMPOSE_PRIVATE_BIND_TIMING_UNSUPPORTED: clean-install preinst precedes pkgvar creation, while worker acquire precedes postinst; no root initialization or automatic volume conversion |
|
|
131
132
|
| Image VOLUME | Build inventories verified image config and assigns a stable named volume |
|
|
132
133
|
| Existing external volume | Rejected without trusted admin ownership/driver readback |
|
|
@@ -489,6 +490,44 @@ root or delete DSM configuration to claim compatibility.
|
|
|
489
490
|
Compose web health is required before check/build; init has no guessed endpoint or status. Select both `--health-path` and `--health-status`, or edit `compose.web.health`. Readiness does not follow redirects. Static check is not an HTTP or arbitrary-UID/storage preflight. For official-image upstream packaging and DSM login, read [upstream-fork.md](upstream-fork.md).
|
|
490
491
|
|
|
491
492
|
|
|
493
|
+
## Temporary files
|
|
494
|
+
|
|
495
|
+
Temporary files go to disk, not memory. Check refuses every Compose tmpfs (the
|
|
496
|
+
short `tmpfs:` list and `type: tmpfs` volumes) that the package does not
|
|
497
|
+
declare, with `COMPOSE_TMPFS_UNDECLARED` naming the service and target. Host
|
|
498
|
+
`/tmp` binds stay refused.
|
|
499
|
+
|
|
500
|
+
```yaml
|
|
501
|
+
compose:
|
|
502
|
+
services:
|
|
503
|
+
app:
|
|
504
|
+
scratch: [/tmp] # disk; replaces a Compose tmpfs at /tmp
|
|
505
|
+
environment: {TMPDIR: /tmp}
|
|
506
|
+
tmpfs: # memory, only for small data
|
|
507
|
+
- /run # SDK default size, 64 MiB
|
|
508
|
+
- {target: /var/cache/render, size: 16m}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
- `scratch` binds `/var/packages/<package>/target/compose/scratch/<service>/<id>`
|
|
512
|
+
from the installed package files on the volume. The package-account preinst
|
|
513
|
+
creates it explicitly with mode 0700; on every container start the SDK checks
|
|
514
|
+
that the package UID owns it, sets 0700, empties it and probes a write before
|
|
515
|
+
the App runs. Upgrade replaces it; uninstall removes it. It works with
|
|
516
|
+
`read_only: true` and needs explicit entrypoint/command argv. Set `TMPDIR` when
|
|
517
|
+
the App or its tools read it. It is not persistent storage.
|
|
518
|
+
- `tmpfs` accepts the matching Compose tmpfs or adds one. Every tmpfs reaching
|
|
519
|
+
Docker has a size: the declared size, else the Compose size, else 64 MiB.
|
|
520
|
+
Size 0 (unlimited) is refused with `COMPOSE_TMPFS_UNBOUNDED`.
|
|
521
|
+
- Both need an SDK that implements them; check reports `SDK_COMPOSE_UNSUPPORTED`
|
|
522
|
+
for an older `compose.sdk`.
|
|
523
|
+
|
|
524
|
+
`storage_init.directories` may use a read/write Shared Folder mount as the base,
|
|
525
|
+
including one owned by an administrator: the SDK creates missing subdirectories
|
|
526
|
+
as the package UID, never changes the folder root, and requires a real write
|
|
527
|
+
instead of ownership. Runtime files stay on package storage. `storage_init` may
|
|
528
|
+
declare only `runtime`. Do not point `storage_init` at a tmpfs or scratch
|
|
529
|
+
directory to work around a Shared Folder.
|
|
530
|
+
|
|
492
531
|
## Named volumes and uninstall
|
|
493
532
|
|
|
494
533
|
The SDK planner and lock inventory all current project-owned named volumes as
|
|
@@ -22,7 +22,29 @@ Use `install.min_memory_mb` for a physical RAM requirement checked dynamically o
|
|
|
22
22
|
|
|
23
23
|
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.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Use `picker: folder` on `install.sharedFolder` (`mode: select` or `dedicated`)
|
|
26
|
+
for an existing folder at any depth. Native Apps require matching current CLI/SDK releases (see the changelog);
|
|
27
|
+
keep App and identity gateway pins aligned. DSM 7.2.2+ uses the native chooser;
|
|
28
|
+
7.1/7.2.1 uses a share dropdown and relative subpath. An empty subpath explicitly
|
|
29
|
+
selects the share root. A new dedicated share supports its root only.
|
|
30
|
+
|
|
31
|
+
Go Apps use `sharedfolder.Config{Account: packageID, DataDir: pkgvar,
|
|
32
|
+
Required: map[string]sharedfolder.Access{"data": sharedfolder.Write}}.Require("data")`.
|
|
33
|
+
Node Apps use `new SharedFolderConfig({packageId}).require('data')` from
|
|
34
|
+
`@synopackageland/app`; Python uses `SharedFolderConfig(package_id).require('data')`
|
|
35
|
+
from `synopkgland_app`. These APIs resolve the current volume, share and subpath;
|
|
36
|
+
never parse installer config or hard-code a volume path in App code. For native
|
|
37
|
+
upstream daemons, resolve the path before launching the upstream binary. No
|
|
38
|
+
Compose declaration or root privilege is needed.
|
|
39
|
+
|
|
40
|
+
Supply `--param data=Media --param data_subpath='Projects/Deep'` for automated
|
|
41
|
+
installation. Submit both fields plus `--param CHANGE_data=true` when changing
|
|
42
|
+
an upgrade selection; omit all three to retain it. Post-grant and startup checks
|
|
43
|
+
use the package UID. The SDK gateway entry reuses its permission Dialog/Retry;
|
|
44
|
+
Retry rechecks access and directs the administrator to Package Center Start,
|
|
45
|
+
without writing ACLs. See [folder selection and APIs](../../docs/shared-folders.md).
|
|
46
|
+
|
|
47
|
+
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. Share-only records from older packages retain their original share root automatically in both the wizard and silent upgrades.
|
|
26
48
|
|
|
27
49
|
Uninstall retains the share, files and package account's ACL because DSM data-share Release does nothing. Old selected shares can retain that ACL too. To revoke it, an administrator opens Control Panel > Shared Folder > the folder > Edit > Permissions > System internal user, clears the package account's Read only/Read/Write permission and saves, preserving other rows and data. See [shared-folder behavior](../../docs/shared-folders.md).
|
|
28
50
|
|