Browse Source

Revamp loading of .bash/ RC files

*   More intuitive file naming,
*   setup simplified,
*   setup is now in script (vs. diff file),
*   removed unnecessary exec mode.
Alois Mahdal 10 years ago
parent
commit
615a07c2bf

dotfiles/bash/colors → dotfiles/bash/colors.bashrc View File


+ 11
- 0
dotfiles/bash/head.bashrc View File

@@ -0,0 +1,11 @@
1
+#!/bin/bash
2
+
3
+for include in \
4
+  "${HOME}/.bash/colors.bashrc" \
5
+  "${HOME}/.bash/main.bashrc" \
6
+  "${HOME}/.bash/user/$(whoami).bashrc" \
7
+  "${HOME}/.bash/host/$(hostname).bashrc" \
8
+  "${HOME}/.bash/post.bashrc";
9
+do
10
+  test -f $include && . $include;
11
+done

+ 0
- 0
dotfiles/bash/host/azzgoat.bashrc View File


+ 0
- 0
dotfiles/bash/host/hugo.bashrc View File


+ 0
- 0
dotfiles/bash/host/tamtam.bashrc View File


+ 0
- 0
dotfiles/bash/host/tamten.bashrc View File


dotfiles/bash/global-before.bashrc → dotfiles/bash/main.bashrc View File


dotfiles/bash/global-after.bashrc → dotfiles/bash/post.bashrc View File

@@ -9,7 +9,6 @@
9 9
 ### '''' ###
10 10
 
11 11
 make_ps1() {
12
-    source "${HOME}/.bash/colors"
13 12
     # these functions must be already defined by ~/.bash/user/*.bashrc
14 13
     # and ~/.bash/host/*.bashrc
15 14
     ps1u=$(make_ps1u)
@@ -21,7 +20,6 @@ make_ps1() {
21 20
 }
22 21
 
23 22
 make_ps2() {
24
-    source "${HOME}/.bash/colors"
25 23
     echo "$white>$yellow>$lyellow>$normal ";
26 24
 }
27 25
 

+ 17
- 0
dotfiles/bash/setup View File

@@ -0,0 +1,17 @@
1
+#!/bin/bash
2
+
3
+put() {
4
+    echo "$1" >> $HOME/.bashrc
5
+}
6
+
7
+mark="# added by https://github.com/AloisMahdal/mydots"
8
+if grep -qF "$mark" $HOME/.bashrc;
9
+then
10
+    echo "already set up, giving up";
11
+    exit 1;
12
+else
13
+    put ''
14
+    put '# added by https://github.com/AloisMahdal/mydots"'
15
+    put 'test -f "${HOME}/.bash/head.bashrc" \'
16
+    put '  &&. "${HOME}/.bash/head.bashrc"'
17
+fi

+ 0
- 22
dotfiles/bash/setup/bashrc.diff View File

@@ -1,22 +0,0 @@
1
---- /etc/skel/.bashrc	2012-07-13 01:31:07.000000000 +0200
2
-+++ .bashrc	2013-04-13 15:48:06.950935705 +0200
3
-@@ -108,3 +108,19 @@
4
-     . /etc/bash_completion
5
-   fi
6
- fi
7
-+
8
-+if [ -x "${HOME}/.bash/global-before.bashrc" ]; then
9
-+    source "${HOME}/.bash/global-before.bashrc";
10
-+fi
11
-+
12
-+if [ -x "${HOME}/.bash/user/$(whoami).bashrc" ]; then
13
-+    source "${HOME}/.bash/user/$(whoami).bashrc";
14
-+fi
15
-+
16
-+if [ -x "${HOME}/.bash/host/$(hostname -s).bashrc" ]; then
17
-+    source "${HOME}/.bash/host/$(hostname -s).bashrc";
18
-+fi
19
-+
20
-+if [ -x "${HOME}/.bash/global-after.bashrc" ]; then
21
-+    source "${HOME}/.bash/global-after.bashrc";
22
-+fi

+ 0
- 0
dotfiles/bash/user/aloism.bashrc View File


+ 0
- 0
dotfiles/bash/user/lennycz.bashrc View File