refactrored desktop mappings

This commit is contained in:
jerger 2022-06-30 09:00:42 +02:00
parent 24ff5b7c15
commit b265824b63

View file

@ -43,21 +43,82 @@ fun Prov.provisionDesktop(
gitEmail: String? = null, gitEmail: String? = null,
) = task { ) = task {
// TODO: jem - 2022-06-30: why?? We got already a typed var!
DesktopType.valueOf(desktopType.name) // throws exception when desktopType.name is unknown DesktopType.valueOf(desktopType.name) // throws exception when desktopType.name is unknown
validatePrecondition()
provisionBaseDesktop(gpg, ssh, gitUserName, gitEmail)
if (desktopType == DesktopType.OFFICE || desktopType == DesktopType.IDE) {
provisionOfficeDesktop()
}
if (desktopType == DesktopType.IDE) {
provisionIdeDesktop()
}
ProvResult(true)
}
private fun Prov.validatePrecondition() {
if (!currentUserCanSudo()) { if (!currentUserCanSudo()) {
throw Exception("Current user ${whoami()} cannot execute sudo without entering a password! This is necessary to execute provisionDesktop") throw Exception("Current user ${whoami()} cannot execute sudo without entering a password! This is necessary to execute provisionDesktop")
} }
}
private fun Prov.provisionIdeDesktop() {
aptInstall(JAVA)
aptInstall(OPEN_VPM)
aptInstall(OPENCONNECT)
aptInstall(VPNC)
installDocker()
// IDEs
installVSC("python", "clojure")
aptInstall(CLOJURE_TOOLS)
installShadowCljs()
installIntelliJ()
installDevOps()
provisionPython()
}
private fun Prov.provisionOfficeDesktop() {
aptInstall(ZIP_UTILS)
aptInstall(BROWSER)
aptInstall(EMAIL_CLIENT)
installDeltaChat()
aptInstall(OFFICE_SUITE)
aptInstall(CLIP_TOOLS)
installZimWiki()
installGopass()
aptInstallFromPpa("nextcloud-devs", "client", "nextcloud-client")
optional {
aptInstall(DRAWING_TOOLS)
}
aptInstall(SPELLCHECKING_DE)
}
private fun Prov.provisionBaseDesktop(
gpg: KeyPair?,
ssh: KeyPair?,
gitUserName: String?,
gitEmail: String?
) {
aptInstall(KEY_MANAGEMENT) aptInstall(KEY_MANAGEMENT)
aptInstall(VERSION_MANAGEMENT) aptInstall(VERSION_MANAGEMENT)
aptInstall(NETWORK_TOOLS) aptInstall(NETWORK_TOOLS)
aptInstall(SCREEN_TOOLS) aptInstall(SCREEN_TOOLS)
aptInstall(KEY_MANAGEMENT_GUI)
aptInstall(PASSWORD_TOOLS)
aptInstall(OS_ANALYSIS)
aptInstall(BASH_UTILS)
provisionKeys(gpg, ssh) provisionKeys(gpg, ssh)
provisionGit(gitUserName ?: whoami(), gitEmail, gpg?.let { gpgFingerprint(it.publicKey.plain()) }) provisionGit(gitUserName ?: whoami(), gitEmail, gpg?.let { gpgFingerprint(it.publicKey.plain()) })
installVirtualBoxGuestAdditions() installVirtualBoxGuestAdditions()
installRedshift()
configureRedshift()
aptPurge( aptPurge(
"remove-power-management xfce4-power-manager " + "remove-power-management xfce4-power-manager " +
@ -67,58 +128,7 @@ fun Prov.provisionDesktop(
aptPurge("popularity-contest") aptPurge("popularity-contest")
configureNoSwappiness() configureNoSwappiness()
configureBash() configureBash()
if (desktopType == DesktopType.OFFICE || desktopType == DesktopType.IDE) {
aptInstall(KEY_MANAGEMENT_GUI)
aptInstall(BASH_UTILS)
aptInstall(OS_ANALYSIS)
aptInstall(ZIP_UTILS)
aptInstall(PASSWORD_TOOLS)
aptInstall(BROWSER)
aptInstall(EMAIL_CLIENT)
installDeltaChat()
aptInstall(OFFICE_SUITE)
aptInstall(CLIP_TOOLS)
installZimWiki()
installGopass()
aptInstallFromPpa("nextcloud-devs", "client", "nextcloud-client")
optional {
aptInstall(DRAWING_TOOLS)
}
aptInstall(SPELLCHECKING_DE)
installRedshift()
configureRedshift()
}
if (desktopType == DesktopType.IDE) {
aptInstall(JAVA)
aptInstall(OPEN_VPM)
aptInstall(OPENCONNECT)
aptInstall(VPNC)
installDocker()
// IDEs
installVSC("python", "clojure")
aptInstall(CLOJURE_TOOLS)
installShadowCljs()
installIntelliJ()
installDevOps()
provisionPython()
}
ProvResult(true)
} }
private fun Prov.provisionDesktopSubmodules( private fun Prov.provisionDesktopSubmodules(