3 # Setup script for shell configuration files.
5 # Copyright (C) 2011-2012 Simon Ruderich
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 # Create private temporary directory used by many tools (including GNU screen
30 # Generate ~/.less with lesskey.
34 # As screen-256color is not widely supported use it only on machines known to
36 generate cat screenrc .in
37 if [ $hostname != asp -a $hostname != systemofadown ]; then
38 sed 's/Enable 256 color/Disable 256 color/;
39 s/screen-256color/screen/' screenrc > screenrc.tmp
40 mv screenrc.tmp screenrc
42 # Some options are only necessary when running as root. They are marked as
44 if [ x`id -u` != x0 ]; then
45 echo screenrc: removing root options
46 grep -v '(ROOT)' screenrc > screenrc.tmp
47 mv screenrc.tmp screenrc
49 # I use some features of screen which are only in Git. Drop them on machines
50 # which have older versions. They are marked as "(GIT)".
51 if [ $hostname != asp -o x`id -u` = x0 ]; then
52 echo screenrc: removing Git features
53 grep -v '(GIT)' screenrc > screenrc.tmp
54 mv screenrc.tmp screenrc
56 # Rxvt doesn't need the attrcolor "fix". As I prefer rxvt assume I use it when
58 if installed rxvt; then
59 echo screenrc: removing attrcolor \"fix\"
60 sed 's/attrcolor b ".I"/#attrcolor b ".I"/' screenrc > screenrc.tmp
61 mv screenrc.tmp screenrc
63 # Display current battery charge on computers with a battery. Necessary lines
64 # are marked as "(BATTERY)".
65 if [ ! -d /sys/class/power_supply/BAT0 ]; then
66 echo screenrc: removing battery display
67 grep -v '(BATTERY)' screenrc > screenrc.tmp
68 mv screenrc.tmp screenrc
71 # Htop overwrites the comments in its configuration file.
72 generate cat htoprc .in
74 # Link setup for shells.
77 link bash/rc ~/.bashrc
78 link bash/profile ~/.bash_profile
79 link bash/logout ~/.bash_logout
80 if installed csh; then
84 link zsh/env ~/.zshenv
86 link zsh/logout ~/.zlogout
88 # Link setup for additional files.
89 link lessfilter ~/.lessfilter
90 if installed colordiff; then
91 link colordiffrc ~/.colordiffrc
93 link inputrc ~/.inputrc
94 link screenrc ~/.screenrc
95 if installed tmux; then
96 link tmux.conf ~/.tmux.conf
98 if installed htop; then
102 # Create rlwrap history directory.
103 mkdir -p shell/rlwrap