Update gopass/gopass-jsonapi Version 1.15.5; add check for SHA256sum to gopass-jsonapi download; change .config/gopass/config.yml to .config/gopass/config, adapt tests
This commit is contained in:
parent
5cf5b87c91
commit
6633299f5b
5 changed files with 35 additions and 31 deletions
|
@ -18,7 +18,7 @@ apply plugin: "kotlinx-serialization"
|
|||
|
||||
|
||||
group = "org.domaindrivenarchitecture.provs"
|
||||
version = "0.22.1-SNAPSHOT"
|
||||
version = "release-0.22.1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
@ -11,9 +11,9 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFrom
|
|||
|
||||
|
||||
fun Prov.installGopass(
|
||||
version: String = "1.12.7",
|
||||
version: String = "1.15.5",
|
||||
enforceVersion: Boolean = false,
|
||||
sha256sum: String = "0824d5110ff1e68bff1ba10c1be63acb67cb1ad8e3bccddd6b6fc989608beca8" // checksum for sha256sum version 8.30 (e.g. ubuntu 20.04)
|
||||
sha256sum: String = "23ec10015c2643f22cb305859eb36d671094d463d2eb1798cc675e7bb06f4b39"
|
||||
) = taskWithResult {
|
||||
|
||||
if (isPackageInstalled("gopass") && !enforceVersion) {
|
||||
|
@ -45,16 +45,16 @@ fun Prov.installGopass(
|
|||
|
||||
fun Prov.configureGopass(gopassRootFolder: String? = null, publicGpgKey: Secret? = null) = taskWithResult {
|
||||
|
||||
val configFile = ".config/gopass/config.yml"
|
||||
|
||||
if (checkFile(configFile)) {
|
||||
return@taskWithResult ProvResult(true, out = "Gopass already configured in file $configFile")
|
||||
}
|
||||
val configFile = ".config/gopass/config"
|
||||
|
||||
if ((gopassRootFolder != null) && (!gopassRootFolder.startsWith("/"))) {
|
||||
return@taskWithResult ProvResult(false, err = "Gopass cannot be initialized with a relative path or path starting with ~ ($gopassRootFolder)")
|
||||
}
|
||||
|
||||
if(!fileContainsText(configFile,"share/gopass/stores/root")){
|
||||
return@taskWithResult ProvResult(true, out = "Gopass already configured in file $configFile")
|
||||
}
|
||||
|
||||
val defaultRootFolder = userHome() + ".password-store"
|
||||
val gopassRoot = gopassRootFolder ?: defaultRootFolder
|
||||
|
||||
|
@ -83,18 +83,21 @@ fun Prov.gopassInitStoreFolder(path: String, gpgFingerprint: String? = null ) =
|
|||
|
||||
internal fun gopassConfig(gopassRoot: String): String {
|
||||
return """
|
||||
autoclip: true
|
||||
autoimport: true
|
||||
cliptimeout: 45
|
||||
exportkeys: true
|
||||
nocolor: false
|
||||
nopager: false
|
||||
notifications: true
|
||||
parsing: true
|
||||
path: $gopassRoot
|
||||
safecontent: false
|
||||
mounts: {}
|
||||
""".trimIndent() + "\n"
|
||||
[core]
|
||||
parsing = true
|
||||
exportkeys = true
|
||||
autoclip = true
|
||||
showsafecontent = false
|
||||
nopager = false
|
||||
cliptimeout = 45
|
||||
notifications = true
|
||||
autoimport = true
|
||||
[age]
|
||||
usekeychain = false
|
||||
[mounts]
|
||||
path = $gopassRoot
|
||||
"""
|
||||
.trimIndent() + "\n"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ fun Prov.downloadGopassBridge() = task {
|
|||
|
||||
fun Prov.installGopassJsonApi() = taskWithResult {
|
||||
// see https://github.com/gopasspw/gopass-jsonapi
|
||||
val gopassJsonApiVersion = "1.11.1"
|
||||
val requiredGopassVersion = "1.12.7"
|
||||
val sha256sum = "ec9976e39a468428ae2eb1e2e0b9ceccba7f60d66b8097e2425b0c07f4fed108"
|
||||
val gopassJsonApiVersion = "1.15.5"
|
||||
val requiredGopassVersion = "1.15.5"
|
||||
val filename = "gopass-jsonapi_${gopassJsonApiVersion}_linux_amd64.deb"
|
||||
val downloadUrl = "-L https://github.com/gopasspw/gopass-jsonapi/releases/download/v$gopassJsonApiVersion/$filename"
|
||||
val downloadDir = "${userHome()}Downloads"
|
||||
|
@ -35,7 +36,7 @@ fun Prov.installGopassJsonApi() = taskWithResult {
|
|||
if (checkGopassVersion(requiredGopassVersion)) {
|
||||
aptInstall("git gnupg2") // required dependencies
|
||||
createDir(downloadDir)
|
||||
downloadFromURL(downloadUrl, filename, downloadDir)
|
||||
downloadFromURL(downloadUrl, filename, downloadDir, sha256sum = sha256sum)
|
||||
cmd("dpkg -i $downloadDir/$filename", sudo = true)
|
||||
} else {
|
||||
ProvResult(
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackag
|
|||
|
||||
|
||||
fun Prov.installVSC(vararg options: String) = task {
|
||||
val clojureExtensions = listOf("betterthantomorrow.calva", "DavidAnson.vscode-markdownlint")
|
||||
val pythonExtensions = listOf("ms-python.python")
|
||||
val clojureExtensions = setOf("betterthantomorrow.calva", "DavidAnson.vscode-markdownlint")
|
||||
val pythonExtensions = setOf("ms-python.python")
|
||||
|
||||
prerequisitesVSCinstall()
|
||||
|
||||
|
@ -62,7 +62,7 @@ private fun Prov.installVSCodiumPackage() = task {
|
|||
}
|
||||
|
||||
|
||||
private fun Prov.installExtensionsCode(extensions: List<String>) = optional {
|
||||
private fun Prov.installExtensionsCode(extensions: Set<String>) = optional {
|
||||
var res = ProvResult(true)
|
||||
for (ext in extensions) {
|
||||
res = cmd("code --install-extension $ext")
|
||||
|
@ -71,7 +71,7 @@ private fun Prov.installExtensionsCode(extensions: List<String>) = optional {
|
|||
// Settings can be found at $HOME/.config/Code/User/settings.json
|
||||
}
|
||||
|
||||
private fun Prov.installExtensionsCodium(extensions: List<String>) = optional {
|
||||
private fun Prov.installExtensionsCodium(extensions: Set<String>) = optional {
|
||||
var res = ProvResult(true)
|
||||
for (ext in extensions) {
|
||||
res = cmd("codium --install-extension $ext")
|
||||
|
|
|
@ -21,7 +21,7 @@ internal class GopassKtTest {
|
|||
fun test_configureGopass_fails_with_path_starting_with_tilde() {
|
||||
// when
|
||||
val res = defaultTestContainer().task {
|
||||
deleteFile(".config/gopass/config.yml")
|
||||
deleteFile(".config/gopass/config")
|
||||
configureGopass("~/somedir")
|
||||
}
|
||||
|
||||
|
@ -45,10 +45,10 @@ internal class GopassKtTest {
|
|||
}
|
||||
|
||||
// then
|
||||
prov.fileContent("~/.config/gopass/config.yml") // displays the content in the logs
|
||||
prov.fileContent("~/.config/gopass/config") // displays the content in the logs
|
||||
assertTrue(res.success)
|
||||
assertTrue(prov.fileContainsText("~/.config/gopass/config.yml", "/home/testuser/.password-store"))
|
||||
assertTrue(prov.fileContainsText("~/.config/gopass/config.yml", "exampleStore"))
|
||||
assertTrue(prov.fileContainsText("~/.config/gopass/config", "/home/testuser/.password-store"))
|
||||
assertTrue(prov.fileContainsText("~/.config/gopass/config", "exampleStore"))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in a new issue