[skip ci] cleanup after installation

This commit is contained in:
Mirco 2025-02-05 12:31:49 +01:00
parent d63ee8b00e
commit 1117ca8462
4 changed files with 10 additions and 1 deletions
src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure

View file

@ -71,6 +71,7 @@ fun Prov.installKubeconform() = task {
sha256sum = "2b4ebeaa4d5ac4843cf8f7b7e66a8874252b6b71bc7cbfc4ef1cbf85acec7c07"
)
cmd("sudo tar -xzf $packedFilename -C $installationPath", tmpDir)
deleteFile("$tmpDir/$packedFilename")
} else {
ProvResult(true, out = "Kubeconform $version already installed")
}
@ -95,6 +96,7 @@ fun Prov.installKubectl() = task {
sha256sum = "4685bfcf732260f72fce58379e812e091557ef1dfc1bc8084226c7891dd6028f"
)
cmd("sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl", dir = tmpDir)
deleteFile("$tmpDir/kubectl")
}
fun Prov.configureKubectlBashCompletion() = task {

View file

@ -5,6 +5,7 @@ import org.domaindrivenarchitecture.provs.framework.core.ProvResult
import org.domaindrivenarchitecture.provs.framework.core.Secret
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.*
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackage
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.base.gpgFingerprint
import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL
@ -17,7 +18,7 @@ fun Prov.installGopass(
sha256sum: String = "409ed5617e64fa2c781d5e2807ba7fcd65bc383a4e110f410f90b590e51aec55"
) = taskWithResult {
if (isPackageInstalled("gopass") && !enforceVersion) {
if (checkPackage("gopass") && !enforceVersion) {
return@taskWithResult ProvResult(true)
}
if (checkGopassVersion(version)) {
@ -37,8 +38,10 @@ fun Prov.installGopass(
if (result.success) {
cmd("sudo dpkg -i $path/gopass_${version}_linux_amd64.deb")
// Cross-check if installation was successful
deleteFile("$path/$filename")
return@taskWithResult ProvResult(checkGopassVersion(version))
} else {
deleteFile("$path/$filename")
return@taskWithResult ProvResult(false, err = "Gopass could not be installed. " + result.err)
}
}

View file

@ -2,6 +2,7 @@ package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDirs
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.deleteFile
import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL
const val GRAAL_VM_VERSION = "21.0.2"
@ -23,6 +24,7 @@ fun Prov.installGraalVM() = task {
)
createDirs(installationPath, sudo = true)
cmd("sudo tar -C $installationPath -xzf $packedFilename", tmpDir)
deleteFile("$tmpDir/$packedFilename")
val graalInstPath = installationPath + (cmd("ls /usr/lib/jvm/|grep -e graalvm-community-openjdk-$GRAAL_VM_VERSION").out?.replace("\n", ""))
cmd("sudo ln -sf $graalInstPath/lib/svm/bin/native-image /usr/local/bin/native-image")
}

View file

@ -1,6 +1,7 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.deleteFile
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.userHome
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptPurge
@ -26,6 +27,7 @@ fun Prov.installHugoByDeb() = task {
aptInstall("gnupg2")
downloadFromURL(downloadUrl, filename, downloadDir, sha256sum = sha256sum)
cmd("dpkg -i $downloadDir/$filename", sudo = true)
deleteFile("$downloadDir/$filename")
}
}