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()
|
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)
|
||||||
|
|
|
@ -8,26 +8,26 @@ 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
|
||||||
if [ -r \$\{i} ]; then
|
if [ -r \$\{i} ]; then
|
||||||
. \\\$\{i}
|
. \\\$\{i}
|
||||||
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)
|
||||||
|
|
|
@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue