From b2f6de3d67f9c2994b87104dfae730ebc98b6434 Mon Sep 17 00:00:00 2001 From: xmrv <44023043+xmrv@users.noreply.github.com> Date: Fri, 6 Jan 2023 20:02:02 +0300 Subject: [PATCH] sftpgo: Persist configuration across updates (#4135) * sftpgo: persist configuration across updates The following files have to be copied to the new version's root directory every time the app gets updated: id_ecdsa id_ecdsa.pub id_ed25519 id_ed25519.pub id_rsa id_rsa.pub sftpgo.db sftpgo.json By adding the files above to persist, the config files get copied automatically. * fix: do not persist ssh keys Since Windows 10 builds earlier than 1809 do not have a built-in SSH client, the keys cannot be created in a way that doesn't require the installation of an SSH client at pre_install. So I'm only adding the config files to persist and none of the keys. * sftpgo.json: copy native binary to root Currently the app comes with 3 architectures: arm64, 32bit and 64bit. However arm64 and 32bit binaries exists in their respective folders which requires users of such architectures to explicitly specify the directory. With this commit, if needed, the default 64bit binary is backed up to "x64" folder and the native binary for the platform is copied to the root directory, effectively replacing the binary the shim is created for. * Update sftpgo.json Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com> --- bucket/sftpgo.json | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/bucket/sftpgo.json b/bucket/sftpgo.json index 7bb8e30678..199123b7c7 100644 --- a/bucket/sftpgo.json +++ b/bucket/sftpgo.json @@ -4,21 +4,25 @@ "homepage": "https://github.com/drakkan/sftpgo", "license": "AGPL-3.0-only", "notes": "Register SFTPGo as Windows Service by running: \"sftpgo service install\" as Administrator", - "architecture": { - "64bit": { - "url": "https://github.com/drakkan/sftpgo/releases/download/v2.4.2/sftpgo_v2.4.2_windows_portable.zip", - "hash": "ac82ef9c9fb6e60b839c21011ed01b96eaa746d634964ab34f84e1306a304267" - } - }, + "url": "https://github.com/drakkan/sftpgo/releases/download/v2.4.2/sftpgo_v2.4.2_windows_portable.zip", + "hash": "ac82ef9c9fb6e60b839c21011ed01b96eaa746d634964ab34f84e1306a304267", + "pre_install": [ + "if ($architecture -eq '32bit') {", + " Move-Item \"$dir\\x86\\sftpgo.exe\" \"$dir\\\" -Force", + "} elseif ($architecture -eq 'arm64') {", + " Move-Item \"$dir\\arm64\\sftpgo.exe\" \"$dir\\\" -Force", + "}", + "Remove-Item \"$dir\\arm64\", \"$dir\\x86\" -Recurse -Force" + ], "bin": "sftpgo.exe", + "persist": [ + "sftpgo.db", + "sftpgo.json" + ], "checkver": { "github": "https://github.com/drakkan/sftpgo" }, "autoupdate": { - "architecture": { - "64bit": { - "url": "https://github.com/drakkan/sftpgo/releases/download/v$version/sftpgo_v$version_windows_portable.zip" - } - } + "url": "https://github.com/drakkan/sftpgo/releases/download/v$version/sftpgo_v$version_windows_portable.zip" } }