@ -14,12 +14,13 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.base.gpgFingerpr
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
import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL
fun provisionDesktop ( prov : Prov , cmd : DesktopCliCommand ) {
// retrieve config
val conf = getConfig ( cmd . configFile . fileName )
with ( conf ) {
prov . provisionWorkplace ( type , ssh ?. keyPair ( ) , gpg ?. keyPair ( ) , gitUserName , gitEmail )
with ( conf ) {
prov . provisionWorkplace ( type , ssh ?. keyPair ( ) , gpg ?. keyPair ( ) , gitUserName , gitEmail , cmd )
}
}
@ -36,78 +37,100 @@ fun Prov.provisionWorkplace(
ssh : KeyPair ? = null ,
gpg : KeyPair ? = null ,
gitUserName : String ? = null ,
gitEmail : String ? = null
gitEmail : String ? = null ,
cmd : DesktopCliCommand
) = requireAll {
if ( ! currentUserCanSudo ( ) ) {
throw Exception ( " Current user ${whoami()} cannot execute sudo without entering a password! This is necessary to execute provisionWorkplace " )
}
aptInstall ( KEY _MANAGEMENT )
aptInstall ( VERSION _MANAGEMENT )
aptInstall ( NETWORK _TOOLS )
if ( cmd . haScope ( ) ) {
if ( cmd . scopes . contains ( Scope . PROVS ) ) {
downloadFromURL (
url = " https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/2046149473/artifacts/file/build/libs/provs-server.jar " ,
filename = " provs-server.jar " ,
path = " /usr/local/bin/ " ,
sha256sum = " cec1c8762ce310694bacef587ad26b3bb7b8482a8548330ccaf9c9d3eb052409 " ,
sudo = true
)
downloadFromURL (
url = " https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/2046149473/artifacts/file/build/libs/provs-desktop.jar " ,
filename = " provs-desktop.jar " ,
path = " /usr/local/bin/ " ,
sha256sum = " 61bad1380809325aca95bfbcb7cf27928ee070ed886c5de7e300797961d1fa58 " ,
sudo = true
)
cmd ( " chmod 755 /usr/local/bin/provs-server.jar " , sudo = true )
cmd ( " chmod 755 /usr/local/bin/provs-desktop.jar " , sudo = true )
}
ProvResult ( true )
} else {
aptInstall ( KEY _MANAGEMENT )
aptInstall ( VERSION _MANAGEMENT )
aptInstall ( NETWORK _TOOLS )
provisionKeys ( gpg , ssh )
provisionGit ( gitUserName ?: whoami ( ) , gitEmail , gpg ?. let { gpgFingerprint ( it . publicKey . plain ( ) ) } )
provisionKeys ( gpg , ssh )
provisionGit ( gitUserName ?: whoami ( ) , gitEmail , gpg ?. let { gpgFingerprint ( it . publicKey . plain ( ) ) } )
installVirtualBoxGuestAdditions ( )
installVirtualBoxGuestAdditions ( )
aptPurge (
" remove-power-management xfce4-power-manager " +
" xfce4-power-manager-plugins xfce4-power-manager-data "
)
aptPurge ( " abiword gnumeric " )
aptPurge ( " popularity-contest " )
aptPurge (
" remove-power-management xfce4-power-manager " +
" xfce4-power-manager-plugins xfce4-power-manager-data "
)
aptPurge ( " abiword gnumeric " )
aptPurge ( " popularity-contest " )
configureNoSwappiness ( )
configureNoSwappiness ( )
configureBash ( )
configureBash ( )
if ( workplaceType == WorkplaceType . OFFICE || workplaceType == WorkplaceType . IDE ) {
aptInstall ( KEY _MANAGEMENT _GUI )
aptInstall ( BASH _UTILS )
aptInstall ( OS _ANALYSIS )
aptInstall ( ZIP _UTILS )
aptInstall ( PASSWORD _TOOLS )
if ( workplaceType == WorkplaceType . OFFICE || workplaceType == WorkplaceType . IDE ) {
aptInstall ( KEY _MANAGEMENT _GUI )
aptInstall ( BASH _UTILS )
aptInstall ( OS _ANALYSIS )
aptInstall ( ZIP _UTILS )
aptInstall ( PASSWORD _TOOLS )
aptInstall ( BROWSER )
aptInstall ( EMAIL _CLIENT )
aptInstall ( OFFICE _SUITE )
aptInstall ( CLIP _TOOLS )
aptInstall ( BROWSER )
aptInstall ( EMAIL _CLIENT )
aptInstall ( OFFICE _SUITE )
aptInstall ( CLIP _TOOLS )
installZimWiki ( )
installGopass ( )
aptInstallFromPpa ( " nextcloud-devs " , " client " , " nextcloud-client " )
installZimWiki ( )
installGopass ( )
aptInstallFromPpa ( " nextcloud-devs " , " client " , " nextcloud-client " )
optional {
aptInstall ( DRAWING _TOOLS )
}
optional {
aptInstall ( DRAWING _TOOLS )
}
aptInstall ( SPELLCHECKING _DE )
aptInstall ( SPELLCHECKING _DE )
installRedshift ( )
configureRedshift ( )
}
installRedshift ( )
configureRedshift ( )
}
if ( workplaceType == WorkplaceType . IDE ) {
if ( workplaceType == WorkplaceType . IDE ) {
aptInstall ( JAVA _JDK )
aptInstall ( JAVA _JDK )
aptInstall ( OPEN _VPM )
aptInstall ( OPENCONNECT )
aptInstall ( VPNC )
aptInstall ( OPEN _VPM )
aptInstall ( OPENCONNECT )
aptInstall ( VPNC )
installDocker ( )
installDocker ( )
// IDEs
installVSC ( " python " , " clojure " )
aptInstall ( CLOJURE _TOOLS )
installIntelliJ ( )
// IDEs
installVSC ( " python " , " clojure " )
aptInstall ( CLOJURE _TOOLS )
installIntelliJ ( )
installDevOps ( )
installDevOps ( )
installPython ( )
installPython ( )
}
ProvResult ( true )
}
ProvResult ( true ) // dummy
}