fixe bashrcd issue
This commit is contained in:
parent
f9bf72313f
commit
fa4f8beae4
2 changed files with 13 additions and 10 deletions
|
@ -2,12 +2,15 @@ package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
|||
|
||||
import org.domaindrivenarchitecture.provs.framework.core.Prov
|
||||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||
import org.domaindrivenarchitecture.provs.framework.core.endingWithFileSeparator
|
||||
import org.domaindrivenarchitecture.provs.framework.core.getResourceAsText
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.addTextToFile
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDir
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.dirExists
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
||||
import java.io.File
|
||||
|
||||
private val resourcePath = "org/domaindrivenarchitecture/provs/desktop/infrastructure/"
|
||||
|
||||
fun Prov.configureBash() = def {
|
||||
configureBashForUser()
|
||||
|
@ -20,16 +23,7 @@ fun Prov.configureBashForUser(): ProvResult = def {
|
|||
cmd("chmod 755 " + dirname)
|
||||
aptInstall("bash-completion screen")
|
||||
|
||||
val enhance = """
|
||||
# source .bashrc.d files
|
||||
if [ -d ~/.bashrc.d ]; then
|
||||
for i in ~/.bashrc.d/*.sh; do
|
||||
if [ -r \$\{i} ]; then
|
||||
. \\\$\{i}
|
||||
fi
|
||||
done
|
||||
unset i
|
||||
fi""".trimIndent() + "\n"
|
||||
val enhance = getResourceAsText(resourcePath + "bashrcd-enhancement.sh").trimIndent() + "\n"
|
||||
addTextToFile(text = enhance, file = File("~/.bashrc"))
|
||||
} else {
|
||||
ProvResult(true)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# source .bashrc.d files
|
||||
if [ -d ~/.bashrc.d ]; then
|
||||
for i in ~/.bashrc.d/*.sh; do
|
||||
if [ -r ${i} ]; then
|
||||
. ${i}
|
||||
fi
|
||||
done
|
||||
unset i
|
||||
fi
|
Loading…
Reference in a new issue