fix bash dir and add gopass autocompletion
This commit is contained in:
parent
a027be20d6
commit
0f85161df0
3 changed files with 12 additions and 6 deletions
|
@ -50,6 +50,8 @@ fun Prov.provisionWorkplace(
|
|||
|
||||
configureNoSwappiness()
|
||||
|
||||
installBash()
|
||||
|
||||
if (workplaceType == WorkplaceType.OFFICE || workplaceType == WorkplaceType.IDE) {
|
||||
aptInstall("seahorse")
|
||||
aptInstall(BASH_UTILS)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue