From 0265cd36833d93d21c87bd0e4586629c410b38f1 Mon Sep 17 00:00:00 2001 From: smail Date: Sun, 18 Oct 2026 17:22:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(deploy):=20=E4=BC=98=E5=8C=96=E6=89=93?= =?UTF-8?q?=E5=8C=85=E8=84=9A=E6=9C=ACpackage.mjs=E4=BD=BFLinux=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E5=8C=85=E5=8C=85=E5=90=AB=E5=AE=8C=E6=95=B4deploy?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E4=B8=8Esystemd=E6=9C=8D=E5=8A=A1=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/package.mjs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/deploy/package.mjs b/deploy/package.mjs index e7fea4f6..cca81026 100644 --- a/deploy/package.mjs +++ b/deploy/package.mjs @@ -9,6 +9,34 @@ import { buildPlan, root, targets } from './build-plugins.mjs' const execute = promisify(execFile) const runtimeDirectories = ['config', 'data', 'ssl', 'log'] +async function copyDeployFiles(stagingSmailDir, target, workspace) { + if (!target.startsWith('linux_')) return + const deployDir = path.join(stagingSmailDir, 'deploy') + const systemdDir = path.join(deployDir, 'systemd') + await mkdir(deployDir, { recursive: true, mode: 0o755 }) + await mkdir(systemdDir, { recursive: true, mode: 0o755 }) + const srcDeploy = path.join(workspace, 'deploy') + const deployFiles = ['install-systemd.sh', 'update-systemd.sh'] + for (const f of deployFiles) { + const src = path.join(srcDeploy, f) + const dst = path.join(deployDir, f) + try { + await copyFile(src, dst) + await chmod(dst, 0o755) + } catch (e) {} + } + const srcSystemd = path.join(srcDeploy, 'systemd') + const systemdFiles = ['smail.service', 'smail-admin.service', 'smail-tls-sync.service', 'smail-tls-sync.path'] + for (const f of systemdFiles) { + const src = path.join(srcSystemd, f) + const dst = path.join(systemdDir, f) + try { + await copyFile(src, dst) + await chmod(dst, 0o755) + } catch (e) {} + } +} + export async function resolveAppVersion(workspace = root) { if (process.env.SMAIL_VERSION) return process.env.SMAIL_VERSION try { @@ -118,6 +146,7 @@ export async function packageRelease(selectedTargets = targets, { workspace = ro await chmod(destination, 0o755) files.push({ name, ...await digestFile(destination) }) } + await copyDeployFiles(runtime, target, workspace) const version = await resolveAppVersion(workspace) const baseExt = target.startsWith('windows_') ? 'zip' : 'tar.gz' const archiveName = version && version !== 'dev' ? `Smail_${version}_${target}.${baseExt}` : `${name}.${baseExt}`