fix bash dir and add gopass autocompletion

This commit is contained in:
ansgarz 2021-12-10 13:54:16 +01:00
parent a027be20d6
commit 0f85161df0
3 changed files with 12 additions and 6 deletions

View file

@ -50,6 +50,8 @@ fun Prov.provisionWorkplace(
configureNoSwappiness() configureNoSwappiness()
installBash()
if (workplaceType == WorkplaceType.OFFICE || workplaceType == WorkplaceType.IDE) { if (workplaceType == WorkplaceType.OFFICE || workplaceType == WorkplaceType.IDE) {
aptInstall("seahorse") aptInstall("seahorse")
aptInstall(BASH_UTILS) aptInstall(BASH_UTILS)

View file

@ -8,17 +8,17 @@ import java.io.File
fun Prov.installBash() = def { fun Prov.installBash() = def {
installBashForUser() configureBashForUser()
} }
fun Prov.installBashForUser(): ProvResult = def { fun Prov.configureBashForUser(): ProvResult = def {
var dirname = "~/.bashrd.d" val dirname = "~/.bashrc.d"
if(!dirExists(dirname)) { if(!dirExists(dirname)) {
createDir(dirname) createDir(dirname)
cmd("chmod 755 " + dirname) cmd("chmod 755 " + dirname)
aptInstall("bash-completion screen") aptInstall("bash-completion screen")
var enhance = """ val enhance = """
# source .bashrc.d files # source .bashrc.d files
if [ -d ~/.bashrc.d ]; then if [ -d ~/.bashrc.d ]; then
for i in ~/.bashrc.d/*.sh; do for i in ~/.bashrc.d/*.sh; do
@ -27,7 +27,7 @@ fun Prov.installBashForUser(): ProvResult = def {
fi fi
done done
unset i unset i
fi """.trimIndent() fi""".trimIndent() + "\n"
addTextToFile(text = enhance, file = File("~/.bashrc")) addTextToFile(text = enhance, file = File("~/.bashrc"))
} else { } else {
ProvResult(true) ProvResult(true)

View file

@ -51,6 +51,10 @@ fun Prov.configureGopass(gopassRootFolder: String? = null) = def {
createDir(rootFolder) createDir(rootFolder)
createDirs(".config/gopass") createDirs(".config/gopass")
createFile("~/.config/gopass/config.yml", gopassConfig(rootFolder)) createFile("~/.config/gopass/config.yml", gopassConfig(rootFolder))
// auto-completion
configureBashForUser()
createFile("~/.bashrc.d/gopass.sh", "source <(gopass completion bash)\n")
} }