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,
) = task {
// TODO: jem - 2022-06-30: why?? We got already a typed var!
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()) {
throw Exception("Current user ${whoami()} cannot execute sudo without entering a password! This is necessary to execute provisionDesktop")
}
}
aptInstall(KEY_MANAGEMENT)
aptInstall(VERSION_MANAGEMENT)
aptInstall(NETWORK_TOOLS)
aptInstall(SCREEN_TOOLS)
private fun Prov.provisionIdeDesktop() {
aptInstall(JAVA)
aptInstall(OPEN_VPM)
aptInstall(OPENCONNECT)
aptInstall(VPNC)
installDocker()
provisionKeys(gpg, ssh)
provisionGit(gitUserName ?: whoami(), gitEmail, gpg?.let { gpgFingerprint(it.publicKey.plain()) })
// IDEs
installVSC("python", "clojure")
aptInstall(CLOJURE_TOOLS)
installShadowCljs()
installIntelliJ()
installDevOps()
provisionPython()
}
installVirtualBoxGuestAdditions()
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)
private fun Prov.provisionOfficeDesktop() {
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")
@ -92,33 +96,39 @@ fun Prov.provisionDesktop(
}
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()
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)
aptInstall(OPEN_VPM)
aptInstall(OPENCONNECT)
aptInstall(VPNC)
installDocker()
// IDEs
installVSC("python", "clojure")
aptInstall(CLOJURE_TOOLS)
installShadowCljs()
installIntelliJ()
installDevOps()
provisionPython()
}
ProvResult(true)
configureNoSwappiness()
configureBash()
}
private fun Prov.provisionDesktopSubmodules(