home · contact · privacy
Replace bashistic shell dotfiles with POSIXy regularity.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 11 Dec 2015 01:06:29 +0000 (02:06 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 11 Dec 2015 01:06:29 +0000 (02:06 +0100)
dotfiles_minimal/profile [new file with mode: 0644]
dotfiles_minimal/shinit [new file with mode: 0644]
dotfiles_root/bashrc [deleted file]
dotfiles_root/shinit_color [new file with mode: 0644]
dotfiles_user_minimal/bash_profile [deleted file]
dotfiles_user_server/bashrc [deleted file]
dotfiles_user_server/shinit_add [new file with mode: 0644]
dotfiles_user_server/shinit_color [new file with mode: 0644]
dotfiles_user_thinkpad/bashrc [deleted file]
dotfiles_user_thinkpad/shinit_color [new file with mode: 0644]
symlink.sh

diff --git a/dotfiles_minimal/profile b/dotfiles_minimal/profile
new file mode 100644 (file)
index 0000000..5a58435
--- /dev/null
@@ -0,0 +1,6 @@
+# Initialization for login shells.
+
+# Tell interactive shells to look in ~/.shinit for setup.
+ENV=$HOME/.shinit
+export ENV
+. $ENV
diff --git a/dotfiles_minimal/shinit b/dotfiles_minimal/shinit
new file mode 100644 (file)
index 0000000..a5a9ee2
--- /dev/null
@@ -0,0 +1,33 @@
+# Settings for interactive shells.
+
+# Fancy colors for ls.
+alias ls="ls --color=auto"
+
+# Use vim as default editor for anything.
+export VISUAL=vim
+export EDITOR=$VISUAL
+
+# Colored prompt with username, hostname, date/time, directory.
+colornumber=7 # Default to white if no color set via colornumber dotfile.
+colornumber_file=~/.shinit_color
+if [ -f $colornumber_file ]; then
+    colornumber=`cat $colornumber_file` 
+fi
+tput_color="$(tput setaf $colornumber)$(tput bold)"
+tput_reset="$(tput sgr0)"
+# Bash confuses the line length when not told to not count escape sequences.
+which_shell=`lsof -ap $$ -d txt | awk 'NR>1 {print $NF}'`
+if [ "${which_shell#*'bash'}" != "$which_shell" ]; then
+    tput_color="\[$tput_color\]"
+    tput_reset="\[$tput_reset\]"
+fi
+PS1="${tput_color}["\$\(date\ +%Y-%m-%d/%H:%M:%S/%Z\)" $USER@$(hostname):"\$\(pwd\)"]$ $tput_reset"
+PS2="${tput_color}> $tput_reset"
+PS3="${tput_color}select: $tput_reset"
+PS4="${tput_color}+ $tput_reset"
+
+# Add local additions.
+local_shinit_file=~/.shinit_add
+if [ -f $local_shinit_file ]; then 
+    . $local_shinit_file 
+fi
diff --git a/dotfiles_root/bashrc b/dotfiles_root/bashrc
deleted file mode 100644 (file)
index 64ba97b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# plomlompom's bashrc for non-login shells (root)
-
-# Fancy colors for ls.
-alias ls="ls --color=auto"
-
-# Use vim as default editor for anything.
-export VISUAL=vim
-export EDITOR=$VISUAL
-
-# Red prompt with time.
-PS1="\[\e[1;31m\][\\t \\u@\\h \\w]$\[\e[m\] "
-PS2="\[\e[1;31m\]>\[\e[m\] "
-PS3="\[\e[1;31m\]>\[\e[m\] "
-PS4="\[\e[1;31m\]+\[\e[m\] "
diff --git a/dotfiles_root/shinit_color b/dotfiles_root/shinit_color
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/dotfiles_user_minimal/bash_profile b/dotfiles_user_minimal/bash_profile
deleted file mode 100644 (file)
index 17d538c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# initialization for login shells
-
-source ~/.bashrc
diff --git a/dotfiles_user_server/bashrc b/dotfiles_user_server/bashrc
deleted file mode 100644 (file)
index 2409091..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# plomlompom's bashrc for non-login shells
-
-# Fancy colors for ls.
-alias ls="ls --color=auto"
-
-# Use vim as default editor for anything.
-export VISUAL=vim
-export EDITOR=$VISUAL
-
-# Wrapper for weechat to force local config file on it anew on each run.
-alias weechat="~/config/bin/weechat-wrapper.sh"
-
-# Blue prompt with time.
-PS1="\[\e[1;34m\][\\t \\u@\\h \\w]$\[\e[m\] "
-PS2="\[\e[1;34m\]>\[\e[m\] "
-PS3="\[\e[1;34m\]>\[\e[m\] "
-PS4="\[\e[1;34m\]+\[\e[m\] "
diff --git a/dotfiles_user_server/shinit_add b/dotfiles_user_server/shinit_add
new file mode 100644 (file)
index 0000000..02d6a99
--- /dev/null
@@ -0,0 +1,4 @@
+# Server-specific .shinit additions. 
+
+# Wrapper for weechat to force local config file on it anew on each run.
+alias weechat="~/config/bin/weechat-wrapper.sh"
diff --git a/dotfiles_user_server/shinit_color b/dotfiles_user_server/shinit_color
new file mode 100644 (file)
index 0000000..b8626c4
--- /dev/null
@@ -0,0 +1 @@
+4
diff --git a/dotfiles_user_thinkpad/bashrc b/dotfiles_user_thinkpad/bashrc
deleted file mode 100644 (file)
index 5cdcf22..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# plomlompom's bashrc for non-login shells
-
-# Fancy colors for ls.
-alias ls="ls --color=auto"
-
-# Use vim as default editor for anything.
-export VISUAL=vim
-export EDITOR=$VISUAL
-
-# Blue prompt with time.
-PS1="\[\e[1;32m\][\\t \\u@\\h \\w]$\[\e[m\] "
-PS2="\[\e[1;32m\]>\[\e[m\] "
-PS3="\[\e[1;32m\]>\[\e[m\] "
-PS4="\[\e[1;32m\]+\[\e[m\] "
diff --git a/dotfiles_user_thinkpad/shinit_color b/dotfiles_user_thinkpad/shinit_color
new file mode 100644 (file)
index 0000000..0cfbf08
--- /dev/null
@@ -0,0 +1 @@
+2
index e2f614f726a874a685933eaf5228266aa68413d3..fabee57c51f2969ba963d8ec0221dcf6b5b9736a 100755 (executable)
@@ -2,12 +2,16 @@
 
 set -x
 
+dir_minimal=~/config/dotfiles_minimal
 dir_user_minimal=~/config/dotfiles_user_minimal
 dir_user_thinkpad=~/config/dotfiles_user_thinkpad
 dir_user_server=~/config/dotfiles_user_server
 dir_root=~/config/dotfiles_root
 homedir=`echo ~`
 find ~ -lname $homedir'/config/*' -delete
+for file in `ls $dir_minimal`; do
+    ln -fs $dir_minimal/$file ~/.$file
+done
 for file in `ls $dir_user_minimal`; do
     ln -fs $dir_user_minimal/$file ~/.$file
 done