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 # Generate ~/.less with lesskey.
29 # As screen-256color is not widely supported use it only on machines known to
31 generate cat screenrc .in
32 if [ $hostname != asp -a $hostname != systemofadown ]; then
33 sed 's/Enable 256 color/Disable 256 color/;
34 s/screen-256color/screen/' screenrc > screenrc.tmp
35 mv screenrc.tmp screenrc
37 # Some options are only necessary when running as root. They are marked as
39 if [ x`id -u` != x0 ]; then
40 echo screenrc: removing root options
41 grep -v '(ROOT)' screenrc > screenrc.tmp
42 mv screenrc.tmp screenrc
44 # I use some features of screen which are only in Git. Drop them on machines
45 # which have older versions. They are marked as "(GIT)".
46 if [ $hostname != asp -o x`id -u` = x0 ]; then
47 echo screenrc: removing Git features
48 grep -v '(GIT)' screenrc > screenrc.tmp
49 mv screenrc.tmp screenrc
51 # Rxvt doesn't need the attrcolor "fix". As I prefer rxvt assume I use it when
53 if installed rxvt; then
54 echo screenrc: removing attrcolor \"fix\"
55 sed 's/attrcolor b ".I"/#attrcolor b ".I"/' screenrc > screenrc.tmp
56 mv screenrc.tmp screenrc
58 # Display current battery charge on computers with a battery. Necessary lines
59 # are marked as "(BATTERY)".
60 if [ ! -d /sys/class/power_supply/BAT0 ]; then
61 echo screenrc: removing battery display
62 grep -v '(BATTERY)' screenrc > screenrc.tmp
63 mv screenrc.tmp screenrc
66 # Htop overwrites the comments in its configuration file.
67 generate cat htoprc .in
69 # Link setup for shells.
72 link bash/rc ~/.bashrc
73 link bash/profile ~/.bash_profile
74 link bash/logout ~/.bash_logout
75 if installed csh; then
79 link zsh/env ~/.zshenv
81 link zsh/logout ~/.zlogout
83 # Link setup for additional files.
84 link lessfilter ~/.lessfilter
85 if installed colordiff; then
86 link colordiffrc ~/.colordiffrc
88 link inputrc ~/.inputrc
89 link screenrc ~/.screenrc
90 if installed tmux; then
91 link tmux.conf ~/.tmux.conf
93 if installed htop; then
97 # Create rlwrap history directory.