@synopackageland/cli 0.48.10 → 0.48.11
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.
|
@@ -46,7 +46,7 @@ import { renderNativePrivilege } from "../build-spk/native-lifecycle.js";
|
|
|
46
46
|
import { renderUiConfig } from "./dsm-window.js";
|
|
47
47
|
import { identityGatewayConfig, gatewayCgiPaths, GATEWAY_SETTINGS_CGI_PATH, gatewayAdmissionReport, gatewayAdmissionPolicy, readIdentityGateway, } from "./identity-gateway.js";
|
|
48
48
|
import { checkCgiBinary } from "./binary.js";
|
|
49
|
-
import { matchesStandaloneScript,
|
|
49
|
+
import { matchesStandaloneScript, matchesStandaloneScriptPrefix } from "./lifecycle.js";
|
|
50
50
|
import { listPortExposures, loadCompose } from "../compose/analyze.js";
|
|
51
51
|
import { uninstallCleanup, } from "../runtime/uninstall-cleanup.js";
|
|
52
52
|
import { PORTAL_JSON_RELPATH, PORTAL_MUSTACHE_RELPATH, renderPortalJson, renderPortalLifecycle, renderPortalMustache, renderPortalWizardStep, } from "../portal/package.js";
|
|
@@ -310,8 +310,7 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
310
310
|
...(uninstallHook ? { uninstall: uninstallHook.uninstall } : {}),
|
|
311
311
|
};
|
|
312
312
|
for (const hook of ["preuninst", "preupgrade", "start-stop-status"]) {
|
|
313
|
-
if (readOptional(join(dir, "scripts", hook))
|
|
314
|
-
renderStandaloneScript(hook, lifecycleManifest))
|
|
313
|
+
if (!matchesStandaloneScript(hook, lifecycleManifest, readOptional(join(dir, "scripts", hook))))
|
|
315
314
|
findings.push(`Executor scripts/${hook} differs from fixed lifecycle.`);
|
|
316
315
|
}
|
|
317
316
|
}
|
|
@@ -45,6 +45,13 @@ function standaloneScriptVariants(name, manifest, expected) {
|
|
|
45
45
|
const wait = renderNativeGatewayPortWait(manifest, name);
|
|
46
46
|
const diagnosticOnly = wait ? expected.replace(wait, '') : expected;
|
|
47
47
|
const variants = [expected, ...(wait ? [diagnosticOnly] : []), ...(diagnostic ? [diagnosticOnly.replace(diagnostic, '')] : [])];
|
|
48
|
+
// One released renderer added daemon bookkeeping even without a daemon.
|
|
49
|
+
// Replay that exact variant, retaining the complete lifecycle comparison.
|
|
50
|
+
if (name === 'start-stop-status' && !manifest.daemon &&
|
|
51
|
+
(manifest.capabilities?.rootOps || manifest.capabilities?.delegate || manifest.capabilities?.webapi)) {
|
|
52
|
+
const stop = `"\${SYNOPKG_PKGDEST:-/var/packages/${manifest.package}/target}/executor/lifecycle" stop --package ${manifest.package} || exit $?\n`;
|
|
53
|
+
variants.push(...variants.map(v => v.replace('if [ "$1" = stop ]; then\n', 'if [ "$1" = stop ]; then\ndaemon_result=0\n').replace(stop, stop + '[ "$daemon_result" = 0 ] || exit "$daemon_result"\n')));
|
|
54
|
+
}
|
|
48
55
|
// Released packages stop the daemon in preupgrade without the first-daemon guard.
|
|
49
56
|
const unguarded = (v) => v.replace(daemonGuard(manifest.package), '').replace(delegatedDaemonGuard(manifest.package), '');
|
|
50
57
|
return name === 'preupgrade' ? [...new Set([...variants, ...variants.map(unguarded)])] : variants;
|
|
@@ -162,7 +169,7 @@ function renderStandaloneScriptBody(name, manifest) {
|
|
|
162
169
|
const stopDaemon = manifest.daemon
|
|
163
170
|
? `"/var/packages/${manifest.package}/target/daemon/control" stop "\${SYNOPKG_PKGDEST:-/var/packages/${manifest.package}/target}" "\${SYNOPKG_PKGVAR:-/var/packages/${manifest.package}/var}" || daemon_result=$?\n`
|
|
164
171
|
: "";
|
|
165
|
-
return normal.replace("#!/bin/sh\n", `#!/bin/sh\n${workerStop}if [ "$1" = start ]; then\n${request("start")}fi\nif [ "$1" = stop ]; then\n${stopWorker}daemon_result=0\n${stopDaemon}${request("stop")}[ "$daemon_result" = 0 ] || exit "$daemon_result"\n${workerResult}fi\n`);
|
|
172
|
+
return normal.replace("#!/bin/sh\n", `#!/bin/sh\n${workerStop}if [ "$1" = start ]; then\n${request("start")}fi\nif [ "$1" = stop ]; then\n${stopWorker}${manifest.daemon ? 'daemon_result=0\n' : ''}${stopDaemon}${request("stop")}${manifest.daemon ? '[ "$daemon_result" = 0 ] || exit "$daemon_result"\n' : ''}${workerResult}fi\n`);
|
|
166
173
|
}
|
|
167
174
|
if (name === "preuninst")
|
|
168
175
|
return renderExecutorPreuninst(manifest, workerStop, stopWorker, workerResult, request);
|
|
@@ -13,7 +13,9 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
|
|
|
13
13
|
if (e && e.passwordConfirm) return code + (code === "dsm_3121" ? ": DSM rejected the administrator password." : ": administrator password confirmation failed.") + " Nothing was created.";
|
|
14
14
|
if (e && e.detail) return code + ": " + e.detail;
|
|
15
15
|
if (["dsm_106","dsm_107","dsm_119"].indexOf(code) >= 0) return code + ": the DSM session ended. Sign in to DSM again, then approve again.";
|
|
16
|
-
|
|
16
|
+
var step = e && e.operation;
|
|
17
|
+
var at = step ? " [" + step.api + "/" + step.method + " v" + step.version + "]" : "";
|
|
18
|
+
return code + (code === "105" || code === "dsm_105" ? ": DSM denied administrator scheduler access. Sign out of DSM, sign in again from the DSM desktop, then check status before approving again. If access is still denied, contact your administrator. No automatic retry was made." : ": scheduler readback or operation failed.") + at;
|
|
17
19
|
}
|
|
18
20
|
// What a result's code says, for the window panel and the SDK to translate;
|
|
19
21
|
// reason keeps the English detail. fallback names a step's own failure.
|
|
@@ -27,17 +29,31 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
|
|
|
27
29
|
if (code === "executor_starting") return code;
|
|
28
30
|
if (e && e.detail) return /other digests/.test(e.detail) ? "executor_mismatch" : "executor_unreachable";
|
|
29
31
|
if (code.indexOf("executor_selection") === 0) return "selection_failed";
|
|
30
|
-
if (fallback) return fallback;
|
|
31
32
|
if (code === "105" || code === "dsm_105") return "scheduler_denied";
|
|
33
|
+
if (fallback) return fallback;
|
|
32
34
|
if (["102","103","104","dsm_102","dsm_103","dsm_104"].indexOf(code) >= 0) return "scheduler_unsupported";
|
|
33
35
|
return "scheduler_failed";
|
|
34
36
|
}
|
|
35
|
-
function block(result, e, fallback) {
|
|
37
|
+
function block(result, e, fallback) {
|
|
38
|
+
result.state = "blocked"; result.reason = reason(e); result.code = codeOf(e, fallback);
|
|
39
|
+
if (e && e.diagnostic) result.diagnostic = e.diagnostic;
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
36
42
|
// A find result that stops an approval, with its code.
|
|
37
|
-
function refused(current) { var e = fail(current.reason); e.task = current.code; return e; }
|
|
43
|
+
function refused(current) { var e = fail(current.reason); e.task = current.code; e.diagnostic = current.diagnostic; return e; }
|
|
38
44
|
// AppWindow.sendWebAPI encodes JSON parameters. Preserve their native types;
|
|
39
45
|
// pre-encoding turns objects/booleans into strings and DSM rejects create.
|
|
40
|
-
function send(api, method, version, params) {
|
|
46
|
+
function send(api, method, version, params) {
|
|
47
|
+
return options.send(api, method, version, params || {}).catch(function (error) {
|
|
48
|
+
// Identify the refused native operation without carrying request parameters,
|
|
49
|
+
// credentials, a password token or a raw DSM response into diagnostics.
|
|
50
|
+
var e = fail(error && error.code || "executor_bad_response");
|
|
51
|
+
e.operation = {api: api, method: method, version: version};
|
|
52
|
+
var match = /^(?:dsm_)?([0-9]+)$/.exec(String(e.code));
|
|
53
|
+
if (match) e.diagnostic = {api: api, method: method, version: version, dsm_code: Number(match[1])};
|
|
54
|
+
throw e;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
41
57
|
// DSM 7.1 has no Root APIs: TaskScheduler stops at list v2 (offset) and get v3.
|
|
42
58
|
// Only an unsupported method version on a read selects that profile, which
|
|
43
59
|
// then creates through the plain scheduler APIs. Writes never fall back.
|
|
@@ -105,7 +121,11 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
|
|
|
105
121
|
delete listed[task.name];
|
|
106
122
|
return find(task, false);
|
|
107
123
|
});
|
|
108
|
-
}).catch(function (e) {
|
|
124
|
+
}).catch(function (e) {
|
|
125
|
+
var result = block({}, e);
|
|
126
|
+
if (["102","103","104","dsm_102","dsm_103","dsm_104"].indexOf(String(e && e.code)) >= 0) result.state = "unsupported";
|
|
127
|
+
return result;
|
|
128
|
+
});
|
|
109
129
|
}
|
|
110
130
|
function read(cached) {
|
|
111
131
|
try { admin(); } catch (e) { return Promise.resolve(block({tasks: {}}, e)); }
|
|
@@ -113,7 +133,7 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
|
|
|
113
133
|
var result = {state: "ready", tasks: {}};
|
|
114
134
|
options.tasks.forEach(function (t, i) {
|
|
115
135
|
result.tasks[t.kind] = found[i];
|
|
116
|
-
if (found[i].state === "blocked" || (found[i].state !== "ready" && result.state === "ready")) { result.state = found[i].state; result.reason = found[i].reason; result.code = found[i].code; }
|
|
136
|
+
if (found[i].state === "blocked" || (found[i].state !== "ready" && result.state === "ready")) { result.state = found[i].state; result.reason = found[i].reason; result.code = found[i].code; result.diagnostic = found[i].diagnostic; }
|
|
117
137
|
});
|
|
118
138
|
return result;
|
|
119
139
|
});
|
|
@@ -124,7 +144,10 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
|
|
|
124
144
|
var failed;
|
|
125
145
|
return created.reduceRight(function (withdrawn, task) {
|
|
126
146
|
return withdrawn.then(function () { return find(task); }).then(function (current) {
|
|
127
|
-
if (current.state === "ready") return remove(task, current.ref);
|
|
147
|
+
if (current.state === "ready") return remove(task, current.ref).then(function () { return find(task); }).then(function (after) {
|
|
148
|
+
if (after.state !== "needs-admin-approval" || after.ref) throw refused(after);
|
|
149
|
+
});
|
|
150
|
+
if (current.state !== "needs-admin-approval" || current.ref) throw refused(current);
|
|
128
151
|
}).catch(function (e) { failed = reason(e); });
|
|
129
152
|
}, Promise.resolve()).then(function () { return failed; });
|
|
130
153
|
}
|
|
@@ -135,7 +158,11 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
|
|
|
135
158
|
return removed.reduceRight(function (restored, earlier) {
|
|
136
159
|
return restored.then(function () { return find(earlier); }).then(function (current) {
|
|
137
160
|
if (current.state === "blocked") throw refused(current);
|
|
138
|
-
if (
|
|
161
|
+
if (current.state === "ready") return;
|
|
162
|
+
if (current.ref) throw refused(current);
|
|
163
|
+
return create(earlier.kind === "boot", definition(earlier), confirmation).then(function () { return find(earlier); }).then(function (restored) {
|
|
164
|
+
if (restored.state !== "ready") throw refused(restored);
|
|
165
|
+
});
|
|
139
166
|
}).catch(function (e) { failed = reason(e); });
|
|
140
167
|
}, Promise.resolve()).then(function () { return failed; });
|
|
141
168
|
});
|
|
@@ -407,7 +434,7 @@ export const ROOT_PANEL_MESSAGES = {
|
|
|
407
434
|
"reason.password_confirm_failed": { en: "DSM could not confirm the administrator password. Nothing was changed.", "zh-TW": "DSM 無法確認管理員密碼,沒有做任何變更。", "zh-CN": "DSM 无法确认管理员密码,没有做任何更改。", ja: "DSM で管理者パスワードを確認できませんでした。何も変更されていません。", ko: "DSM에서 관리자 비밀번호를 확인할 수 없습니다. 변경된 내용은 없습니다.", de: "DSM konnte das Administratorkennwort nicht bestätigen. Es wurde nichts geändert.", fr: "DSM n'a pas pu confirmer le mot de passe administrateur. Rien n'a été modifié.", es: "DSM no pudo confirmar la contraseña de administrador. No se ha cambiado nada.", it: "DSM non ha potuto confermare la password amministratore. Non è stato modificato nulla." },
|
|
408
435
|
"reason.session_ended": { en: "The DSM session ended. Sign in to DSM again, then approve again.", "zh-TW": "DSM 工作階段已結束。請重新登入 DSM 後再核准一次。", "zh-CN": "DSM 会话已结束。请重新登录 DSM 后再批准一次。", ja: "DSM セッションが終了しました。DSM に再度サインインしてから、もう一度承認してください。", ko: "DSM 세션이 종료되었습니다. DSM에 다시 로그인한 후 다시 승인하십시오.", de: "Die DSM-Sitzung ist abgelaufen. Melden Sie sich erneut bei DSM an und genehmigen Sie dann erneut.", fr: "La session DSM a expiré. Reconnectez-vous à DSM, puis approuvez de nouveau.", es: "La sesión de DSM ha finalizado. Vuelva a iniciar sesión en DSM y apruebe de nuevo.", it: "La sessione DSM è terminata. Accedere di nuovo a DSM, quindi approvare di nuovo." },
|
|
409
436
|
"reason.admin_required": { en: "Only a DSM administrator can approve.", "zh-TW": "只有 DSM 管理員可以核准。", "zh-CN": "只有 DSM 管理员可以批准。", ja: "承認できるのは DSM 管理者のみです。", ko: "DSM 관리자만 승인할 수 있습니다.", de: "Nur ein DSM-Administrator kann genehmigen.", fr: "Seul un administrateur DSM peut approuver.", es: "Solo un administrador de DSM puede aprobar.", it: "Solo un amministratore DSM può approvare." },
|
|
410
|
-
"reason.scheduler_denied": { en: "DSM denied
|
|
437
|
+
"reason.scheduler_denied": { "en": "DSM denied Task Scheduler access. Sign out of DSM, sign in again from the DSM desktop, then select Check status. If access is still denied, contact your administrator", "zh-TW": "DSM 拒絕了管理員對任務排程表的存取。請登出 DSM,重新登入 DSM 桌面後按「檢查狀態」。若仍被拒絕,請聯絡管理員", "zh-CN": "DSM 拒绝访问任务计划。请退出 DSM,重新登录 DSM 桌面后点击“检查状态”。若仍被拒绝,请联系管理员", "ja": "DSM がタスクスケジューラへのアクセスを拒否しました。DSM からサインアウトし、DSM デスクトップに再度サインインしてから「状態を確認」を選択してください。拒否が続く場合は管理者にお問い合わせください", "ko": "DSM에서 작업 스케줄러 액세스를 거부했습니다. DSM에서 로그아웃하고 DSM 데스크톱에 다시 로그인한 후 상태 확인을 선택하십시오. 계속 거부되면 관리자에게 문의하십시오", "de": "DSM hat den Zugriff auf den Aufgabenplaner verweigert. Melden Sie sich von DSM ab und am DSM-Desktop erneut an. Wählen Sie dann „Status prüfen“. Wird der Zugriff weiterhin verweigert, wenden Sie sich an Ihren Administrator", "fr": "DSM a refusé l’accès au Planificateur de tâches. Déconnectez-vous de DSM, reconnectez-vous au bureau DSM, puis sélectionnez Vérifier l’état. Si l’accès est toujours refusé, contactez votre administrateur", "es": "DSM denegó el acceso al Programador de tareas. Cierre sesión en DSM, vuelva a entrar desde el escritorio de DSM y seleccione Comprobar estado. Si se sigue denegando el acceso, contacte con su administrador", "it": "DSM ha negato l’accesso a Utilità di pianificazione. Esci da DSM, accedi nuovamente dal desktop DSM e seleziona Verifica stato. Se l’accesso viene ancora negato, contatta l’amministratore" },
|
|
411
438
|
"reason.scheduler_failed": { en: "Reading or changing the scheduled tasks failed.", "zh-TW": "讀取或變更排程任務失敗。", "zh-CN": "读取或更改计划任务失败。", ja: "スケジュール済みタスクの読み取りまたは変更に失敗しました。", ko: "예약된 작업을 읽거나 변경하지 못했습니다.", de: "Die geplanten Aufgaben konnten nicht gelesen oder geändert werden.", fr: "La lecture ou la modification des tâches planifiées a échoué.", es: "No se pudieron leer ni cambiar las tareas programadas.", it: "Impossibile leggere o modificare le attività pianificate." },
|
|
412
439
|
"reason.scheduler_unsupported": { en: "This DSM's Task Scheduler does not offer what background access needs.", "zh-TW": "這台 DSM 的任務排程表不提供背景存取所需的功能。", "zh-CN": "此 DSM 的任务计划不提供后台访问所需的功能。", ja: "この DSM のタスクスケジューラには、バックグラウンドアクセスに必要な機能がありません。", ko: "이 DSM의 작업 스케줄러는 백그라운드 액세스에 필요한 기능을 제공하지 않습니다.", de: "Der Aufgabenplaner dieses DSM bietet nicht, was der Hintergrundzugriff benötigt.", fr: "Le Planificateur de tâches de ce DSM n'offre pas ce dont l'accès en arrière-plan a besoin.", es: "El Programador de tareas de este DSM no ofrece lo que necesita el acceso en segundo plano.", it: "L'Utilità di pianificazione di questo DSM non offre quanto necessario all'accesso in background." },
|
|
413
440
|
"reason.task_missing": { en: "The approved tasks are not in Task Scheduler.", "zh-TW": "任務排程表中沒有已核准的任務。", "zh-CN": "任务计划中没有已批准的任务。", ja: "承認済みのタスクがタスクスケジューラにありません。", ko: "승인된 작업이 작업 스케줄러에 없습니다.", de: "Die genehmigten Aufgaben fehlen im Aufgabenplaner.", fr: "Les tâches approuvées ne figurent pas dans le Planificateur de tâches.", es: "Las tareas aprobadas no están en el Programador de tareas.", it: "Le attività approvate non sono presenti in Utilità di pianificazione." },
|