fixe bashrcd issue

This commit is contained in:
gittestuser 2022-02-04 11:22:57 +01:00
parent f9bf72313f
commit fa4f8beae4
2 changed files with 13 additions and 10 deletions

View file

@ -2,12 +2,15 @@ package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.Prov import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.core.ProvResult 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.addTextToFile
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDir import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDir
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.dirExists import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.dirExists
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
import java.io.File import java.io.File
private val resourcePath = "org/domaindrivenarchitecture/provs/desktop/infrastructure/"
fun Prov.configureBash() = def { fun Prov.configureBash() = def {
configureBashForUser() configureBashForUser()
@ -20,16 +23,7 @@ fun Prov.configureBashForUser(): ProvResult = def {
cmd("chmod 755 " + dirname) cmd("chmod 755 " + dirname)
aptInstall("bash-completion screen") aptInstall("bash-completion screen")
val enhance = """ val enhance = getResourceAsText(resourcePath + "bashrcd-enhancement.sh").trimIndent() + "\n"
# 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"
addTextToFile(text = enhance, file = File("~/.bashrc")) addTextToFile(text = enhance, file = File("~/.bashrc"))
} else { } else {
ProvResult(true) ProvResult(true)

View file

@ -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