From 270ac482ec30bf08b57943bc193d804cafb1d448 Mon Sep 17 00:00:00 2001 From: Dabombber Date: Sun, 21 Nov 2021 01:24:53 +1300 Subject: [PATCH] megacmd: Fix background server and persist settings (#978) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update megacmd.json * Update megacmd.json * Update megacmd.json * Update megacmd.json * Update megacmd.json Use mklink to avoid needing elevation, support global installs * Update megacmd.json Co-authored-by: Jakub Čábera Co-authored-by: Issac Lin --- bucket/megacmd.json | 49 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/bucket/megacmd.json b/bucket/megacmd.json index 94edd39770..62b6039511 100644 --- a/bucket/megacmd.json +++ b/bucket/megacmd.json @@ -8,8 +8,43 @@ }, "url": "https://mega.nz/MEGAcmdSetup.exe#/dl.7z", "hash": "dc67762caa70e514b01b4da331c189e7c1e53051a38cd26b7f7b1e8ed86b0d8a", + "post_install": [ + "Remove-Item \"$dir\\`$*\", \"$dir\\unins*\" -Recurse", + "$datapath = if ($global) { $env:APPDATA } else { $env:LOCALAPPDATA }", + "if (!(Test-Path \"$datapath\\MEGAcmd\")) {", + " & \"$env:COMSPEC\" /c mklink /j \"$datapath\\MEGAcmd\" \"$dir\\\" | Out-Null", + "}", + "if (!(Test-Path \"$persist_dir\\.megaCmd\\megacmd.cfg\")) {", + " Set-Content \"$dir\\.megaCmd\\megacmd.cfg\" 'updaterregistered=1', 'autoupdate=0' -Encoding Ascii", + "}" + ], + "uninstaller": { + "script": [ + "$datapath = if ($global) { $env:APPDATA } else { $env:LOCALAPPDATA }", + "if ((Get-Item \"$datapath\\MEGAcmd\" -ErrorAction SilentlyContinue).Attributes -band [IO.FileAttributes]::ReparsePoint) {", + " & \"$env:COMSPEC\" /c \"rmdir `\"$datapath\\MEGAcmd`\"\"", + "}" + ] + }, "bin": [ "MEGAclient.exe", + [ + "MEGAcmdServer.exe", + "mega-cmd-server" + ], + [ + "MEGAcmdShell.exe", + "mega-cmd" + ], + [ + "MEGAclient.exe", + "mega-exec" + ], + [ + "MEGAclient.exe", + "mega-exit", + "exit" + ], "mega-attr.bat", "mega-backup.bat", "mega-cancel.bat", @@ -67,9 +102,17 @@ "mega-webdav.bat", "mega-whoami.bat" ], - "installer": { - "script": "Remove-Item \"$dir\\`$PLUGINSDIR\", \"$dir\\uninst.exe\" -Recurse" - }, + "shortcuts": [ + [ + "MEGAcmdServer.exe", + "MEGAcmd Server" + ], + [ + "MEGAcmdShell.exe", + "MEGAcmd Shell" + ] + ], + "persist": ".megaCmd", "checkver": { "url": "https://github.com/meganz/MEGAcmd/tags", "regex": "tag/([\\d.]+)_Win"