refactrored desktop mappings

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

View file

@ -43,46 +43,50 @@ 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")
} }
}
aptInstall(KEY_MANAGEMENT) private fun Prov.provisionIdeDesktop() {
aptInstall(VERSION_MANAGEMENT) aptInstall(JAVA)
aptInstall(NETWORK_TOOLS) aptInstall(OPEN_VPM)
aptInstall(SCREEN_TOOLS) aptInstall(OPENCONNECT)
aptInstall(VPNC)
installDocker()
provisionKeys(gpg, ssh) // IDEs
provisionGit(gitUserName ?: whoami(), gitEmail, gpg?.let { gpgFingerprint(it.publicKey.plain()) }) installVSC("python", "clojure")
aptInstall(CLOJURE_TOOLS)
installShadowCljs()
installIntelliJ()
installDevOps()
provisionPython()
}
installVirtualBoxGuestAdditions() private fun Prov.provisionOfficeDesktop() {
aptPurge(
"remove-power-management xfce4-power-manager " +
"xfce4-power-manager-plugins xfce4-power-manager-data"
)
aptPurge("abiword gnumeric")
aptPurge("popularity-contest")
configureNoSwappiness()
configureBash()
if (desktopType == DesktopType.OFFICE || desktopType == DesktopType.IDE) {
aptInstall(KEY_MANAGEMENT_GUI)
aptInstall(BASH_UTILS)
aptInstall(OS_ANALYSIS)
aptInstall(ZIP_UTILS) aptInstall(ZIP_UTILS)
aptInstall(PASSWORD_TOOLS)
aptInstall(BROWSER) aptInstall(BROWSER)
aptInstall(EMAIL_CLIENT) aptInstall(EMAIL_CLIENT)
installDeltaChat() installDeltaChat()
aptInstall(OFFICE_SUITE) aptInstall(OFFICE_SUITE)
aptInstall(CLIP_TOOLS) aptInstall(CLIP_TOOLS)
installZimWiki() installZimWiki()
installGopass() installGopass()
aptInstallFromPpa("nextcloud-devs", "client", "nextcloud-client") aptInstallFromPpa("nextcloud-devs", "client", "nextcloud-client")
@ -92,33 +96,39 @@ fun Prov.provisionDesktop(
} }
aptInstall(SPELLCHECKING_DE) aptInstall(SPELLCHECKING_DE)
}
private fun Prov.provisionBaseDesktop(
gpg: KeyPair?,
ssh: KeyPair?,
gitUserName: String?,
gitEmail: String?
) {
aptInstall(KEY_MANAGEMENT)
aptInstall(VERSION_MANAGEMENT)
aptInstall(NETWORK_TOOLS)
aptInstall(SCREEN_TOOLS)
aptInstall(KEY_MANAGEMENT_GUI)
aptInstall(PASSWORD_TOOLS)
aptInstall(OS_ANALYSIS)
aptInstall(BASH_UTILS)
provisionKeys(gpg, ssh)
provisionGit(gitUserName ?: whoami(), gitEmail, gpg?.let { gpgFingerprint(it.publicKey.plain()) })
installVirtualBoxGuestAdditions()
installRedshift() installRedshift()
configureRedshift() configureRedshift()
}
if (desktopType == DesktopType.IDE) { aptPurge(
"remove-power-management xfce4-power-manager " +
"xfce4-power-manager-plugins xfce4-power-manager-data"
)
aptPurge("abiword gnumeric")
aptPurge("popularity-contest")
aptInstall(JAVA) configureNoSwappiness()
configureBash()
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(