fix GopassBridgeKtTest.kt with sha256 checksums
This commit is contained in:
parent
a0fde38bd2
commit
58f2065607
3 changed files with 9 additions and 5 deletions
|
@ -8,9 +8,11 @@ import org.domaindrivenarchitecture.provs.ubuntu.install.base.isPackageInstalled
|
|||
import org.domaindrivenarchitecture.provs.ubuntu.web.base.downloadFromURL
|
||||
|
||||
|
||||
fun Prov.installGopass(version: String = "1.12.7", enforceVersion: Boolean = false) = def {
|
||||
|
||||
val sha256sum = "0824d5110ff1e68bff1ba10c1be63acb67cb1ad8e3bccddd6b6fc989608beca8" // checksum for sha256sum version 8.30 (e.g. ubuntu 20.04)
|
||||
fun Prov.installGopass(
|
||||
version: String = "1.12.7",
|
||||
enforceVersion: Boolean = false,
|
||||
sha256sum: String = "0824d5110ff1e68bff1ba10c1be63acb67cb1ad8e3bccddd6b6fc989608beca8" // checksum for sha256sum version 8.30 (e.g. ubuntu 20.04)
|
||||
) = def {
|
||||
|
||||
if (isPackageInstalled("gopass") && !enforceVersion) {
|
||||
return@def ProvResult(true)
|
||||
|
|
|
@ -35,7 +35,9 @@ fun Prov.downloadFromURL(
|
|||
cmd("curl $followRedirectOption $url -o $finalFilename", path, sudo)
|
||||
|
||||
if (sha256sum != null) {
|
||||
cmd("sha256sum --version") // log version (e.g. 8.30 for ubuntu 20.04)
|
||||
if (!cmd("echo \"$sha256sum $finalFilename\" | sha256sum --check", path).success) {
|
||||
cmd("sha256sum $finalFilename", path) // log the actual checksum
|
||||
deleteFile(finalFilename, path, sudo)
|
||||
} else {
|
||||
ProvResult(true, out = "Sha256sum is correct.")
|
||||
|
|
|
@ -83,7 +83,7 @@ internal class GopassBridgeKtTest {
|
|||
trust = true,
|
||||
skipIfExistin = false
|
||||
)
|
||||
installGopass("1.11.0", enforceVersion = true)
|
||||
installGopass("1.11.0", enforceVersion = true, "1ec9e0dfcfd9bcc241943e1a7d92f31bf3e66bb16f61ae5d079981325c31baa6")
|
||||
if (!chk("gopass ls")) {
|
||||
// configure gopass in default location with gpg-key-fingerprint of snakeoil keys
|
||||
cmd("printf \"\\ntest\\ntest@test.org\\n\" | gopass init 0x0674104CA81A4905")
|
||||
|
@ -116,7 +116,7 @@ internal class GopassBridgeKtTest {
|
|||
trust = true,
|
||||
skipIfExistin = false
|
||||
)
|
||||
installGopass("1.9.0", enforceVersion = true)
|
||||
installGopass("1.9.0", enforceVersion = true, "fe13ef810d7fe200495107161e99eac081368aa0ce5e53971b1bd47a64eba4db")
|
||||
if (!chk("gopass ls")) {
|
||||
// configure gopass in default location with gpg-key-fingerprint of snakeoil keys
|
||||
cmd("printf \"\\ntest\\ntest@test.org\\n\" | gopass init 0x0674104CA81A4905")
|
||||
|
|
Loading…
Reference in a new issue