diff --git a/bucket/simplednscrypt.json b/bucket/simplednscrypt.json index a246e8d..d66057e 100644 --- a/bucket/simplednscrypt.json +++ b/bucket/simplednscrypt.json @@ -18,7 +18,41 @@ } } }, - "installer": { - "file": "SimpleDnsCrypt.msi" - } + "pre_install": [ + "'blacklist.txt', 'blocked.log', 'query.log', 'domain-blacklist.txt', 'domain-whitelist.txt' | ForEach-Object {", + " if (!(Test-Path \"$persist_dir\\dnscrypt-proxy\\$_\")) { New-Item \"$dir\\dnscrypt-proxy\\$_\" -ItemType File | Out-Null }", + "};", + "if (!(Test-Path \"$persist_dir\\dnscrypt-proxy\\$dnscrypt-proxy.toml\")) { Copy-Item \"$dir\\dnscrypt-proxy\\dnscrypt-proxy.toml.example\" \"$dir\\dnscrypt-proxy\\dnscrypt-proxy.toml\" }" + ], + "persist": [ + "dnscrypt-proxy\\dnscrypt-proxy.toml", + "dnscrypt-proxy\\blacklist.txt", + "dnscrypt-proxy\\blocked.log", + "dnscrypt-proxy\\query.log", + "dnscrypt-proxy\\domain-blacklist.txt", + "dnscrypt-proxy\\domain-whitelist.txt" + ], + "extract_dir": "SimpleDNSCrypt", + "shortcuts": [ + [ + "SimpleDnsCrypt.exe", + "SimpleDnsCrypt" + ] + ], + "bin": "SimpleDnsCrypt.exe", + "pre_uninstall": [ + "if (!(is_admin)) { error \"$app requires admin rights to $cmd\"; break }", + "", + "Start-Process -Wait \"$dir\\Uninstall.exe\" | Out-Null", + "if (Get-Process -Name 'SimpleDnsCrypt' -ErrorAction SilentlyContinue) { Stop-Process -Name 'SimpleDnsCrypt' | Out-Null }", + "$service = Get-Service -Name 'dnscrypt-proxy' -ErrorAction SilentlyContinue", + "if (($service) -and ($service.Status -ne 'Stopped')) {", + " if (!(is_admin)) { error 'Admin rights are required to stop dnscrypt-proxy service'; break }", + " Stop-Service -Name 'dnscrypt-proxy' | Out-Null", + "}", + "if (($service) -and ($cmd -eq 'uninstall')) {", + " if (!(is_admin)) { error 'Admin rights are required to remove dnscrypt-proxy service'; break }", + " Remove-Service -Name 'dnscrypt-proxy' | Out-Null", + "}" + ] }