diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/domain/ProvisionWorkplace.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/domain/ProvisionWorkplace.kt index cffe877..38ebc9c 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/domain/ProvisionWorkplace.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/domain/ProvisionWorkplace.kt @@ -50,6 +50,8 @@ fun Prov.provisionWorkplace( configureNoSwappiness() + installBash() + if (workplaceType == WorkplaceType.OFFICE || workplaceType == WorkplaceType.IDE) { aptInstall("seahorse") aptInstall(BASH_UTILS) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/Bash.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/Bash.kt index d8dd4a7..85b448c 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/Bash.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/Bash.kt @@ -8,26 +8,26 @@ import java.io.File fun Prov.installBash() = def { - installBashForUser() + configureBashForUser() } -fun Prov.installBashForUser(): ProvResult = def { - var dirname = "~/.bashrd.d" +fun Prov.configureBashForUser(): ProvResult = def { + val dirname = "~/.bashrc.d" if(!dirExists(dirname)) { createDir(dirname) cmd("chmod 755 " + dirname) aptInstall("bash-completion screen") - var enhance = """ + val enhance = """ # source .bashrc.d files if [ -d ~/.bashrc.d ]; then for i in ~/.bashrc.d/*.sh; do - if [ -r \$\{i} ]; then + if [ -r \$\{i} ]; then . \\\$\{i} fi done unset i - fi """.trimIndent() + fi""".trimIndent() + "\n" addTextToFile(text = enhance, file = File("~/.bashrc")) } else { ProvResult(true) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/Gopass.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/Gopass.kt index f06f056..976caf4 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/Gopass.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/Gopass.kt @@ -51,6 +51,10 @@ fun Prov.configureGopass(gopassRootFolder: String? = null) = def { createDir(rootFolder) createDirs(".config/gopass") createFile("~/.config/gopass/config.yml", gopassConfig(rootFolder)) + + // auto-completion + configureBashForUser() + createFile("~/.bashrc.d/gopass.sh", "source <(gopass completion bash)\n") }