diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/application/Application.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/application/Application.kt index 318101d..780bd37 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/application/Application.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/application/Application.kt @@ -1,7 +1,7 @@ package org.domaindrivenarchitecture.provs.desktop.application import kotlinx.serialization.SerializationException -import org.domaindrivenarchitecture.provs.desktop.domain.provisionDesktopCmd +import org.domaindrivenarchitecture.provs.desktop.domain.provisionDesktopCommand import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance import java.io.FileNotFoundException import kotlin.system.exitProcess @@ -20,7 +20,7 @@ fun main(args: Array) { val prov = createProvInstance(cmd.target, remoteHostSetSudoWithoutPasswordRequired = true) try { - provisionDesktopCmd(prov, cmd) + provisionDesktopCommand(prov, cmd) } catch (e: SerializationException) { println( "Error: File \"${cmd.configFile?.fileName}\" has an invalid format and or invalid data.\n" diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt index 79939be..b56be09 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt @@ -2,7 +2,6 @@ package org.domaindrivenarchitecture.provs.desktop.domain import org.domaindrivenarchitecture.provs.desktop.infrastructure.* import org.domaindrivenarchitecture.provs.framework.core.Prov -import org.domaindrivenarchitecture.provs.framework.core.ProvResult import org.domaindrivenarchitecture.provs.framework.ubuntu.git.provisionGit import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptPurge @@ -13,12 +12,19 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.provisionKeys import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.currentUserCanSudo import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.whoami -internal fun provisionDesktopCmd(prov: Prov, cmd: DesktopCliCommand) { +internal fun provisionDesktopCommand(prov: Prov, cmd: DesktopCliCommand) { // retrieve config val conf = if (cmd.configFile != null) getConfig(cmd.configFile.fileName) else DesktopConfig() - prov.provisionDesktop(cmd.type, conf.ssh?.keyPair(), conf.gpg?.keyPair(), conf.gitUserName, conf.gitEmail, cmd.onlyModules) + prov.provisionDesktop( + cmd.type, + conf.ssh?.keyPair(), + conf.gpg?.keyPair(), + conf.gitUserName, + conf.gitEmail, + cmd.onlyModules + ) } @@ -43,14 +49,19 @@ internal fun Prov.provisionDesktop( if (desktopType == DesktopType.OFFICE) { provisionOfficeDesktop(onlyModules) - verifyOfficeSetup() + if (onlyModules == null) { + verifyOfficeSetup() + } } if (desktopType == DesktopType.IDE) { - provisionOfficeDesktop(onlyModules) - provisionIdeDesktop(onlyModules) - verifyIdeSetup() + if (onlyModules == null) { + provisionOfficeDesktop() + provisionIdeDesktop() + verifyIdeSetup() + } else { + provisionIdeDesktop(onlyModules) + } } - ProvResult(true) } fun Prov.validatePrecondition() { @@ -59,7 +70,7 @@ fun Prov.validatePrecondition() { } } -fun Prov.provisionIdeDesktop(onlyModules: List?) { +fun Prov.provisionIdeDesktop(onlyModules: List? = null) { if (onlyModules == null) { aptInstall(OPEN_VPM) aptInstall(OPENCONNECT) @@ -83,7 +94,7 @@ fun Prov.provisionIdeDesktop(onlyModules: List?) { } } -@Suppress("unused") +@Suppress("unused") // used in other projects fun Prov.provisionMSDesktop(onlyModules: List?) { if (onlyModules == null) { installMsTeams() @@ -92,7 +103,7 @@ fun Prov.provisionMSDesktop(onlyModules: List?) { } } -fun Prov.provisionOfficeDesktop(onlyModules: List?) { +fun Prov.provisionOfficeDesktop(onlyModules: List? = null) { if (onlyModules == null) { aptInstall(ZIP_UTILS) aptInstall(BROWSER) @@ -102,6 +113,7 @@ fun Prov.provisionOfficeDesktop(onlyModules: List?) { installZimWiki() installNextcloudClient() + // optional as installation of these tools often fail and they are not considered mandatory optional { aptInstall(DRAWING_TOOLS) }