[skip ci] fix installation direnv

This commit is contained in:
ansgarz 2025-02-25 21:15:06 +01:00
parent 81f16cbbc1
commit c1e3bfbd41
2 changed files with 10 additions and 4 deletions
src/main
kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure
resources

View file

@ -164,12 +164,18 @@ fun Prov.installTerraform() = task {
fun Prov.installDirenv() = taskWithResult {
val bashConfigFile = "~/.bashrc.d/direnv.sh"
if (!checkFile(bashConfigFile) && !checkPackage("direnv")) {
aptInstall("direnv")
val content = """eval "$(direnv hook bash)" """.trim() + "\n"
createFile(bashConfigFile, content)
addResult(checkPackage("direnv"), info = "direnv has been installed.")
if (checkPackage("direnv")) {
ProvResult(true, info = "direnv has been installed.")
} else {
ProvResult(false, info = "direnv has not been installed successfully.")
}
} else {
return@taskWithResult ProvResult(true, info = "direnv or ~/.bashrc.d/direnv.sh already installed")
ProvResult(true, info = "direnv or ~/.bashrc.d/direnv.sh are already installed")
}
}
}

View file

@ -1 +1 @@
0.40.1-SNAPSHOT
0.40.2-SNAPSHOT