]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - setup.sh
setup.sh: Use new generate() argument order.
[config/dotfiles.git] / setup.sh
1 #!/bin/sh
2
3 # Setup script for X11 configuration files.
4
5 # Copyright (C) 2011-2012  Simon Ruderich
6 #
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.
11 #
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.
16 #
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/>.
19
20
21 set -e
22
23 . ../lib.sh
24
25
26 if installed stumpwm; then
27     link stumpwmrc ~/.stumpwmrc
28 fi
29 if installed xmonad; then
30     link xmonad ~/.xmonad
31 fi
32
33 if installed X; then
34     # Prevent code duplication. Term* rules are for all terminals; XTerm rules
35     # are for XTerm and UXTerm. At the moment XTerm, UXTerm and Rxvt are
36     # supported.
37     generate Xdefaults .in perl -ne \
38         'if (/^Term/) {
39              s/^Term//;
40              print "XTerm", $_;
41              print "UXTerm", $_;
42              print "Rxvt", $_;
43          } elsif (/^XTerm/) {
44              print $_;
45              s/^XTerm//;
46              print "UXTerm", $_;
47          } else {
48              print $_;
49          }'
50     # Xdefaults uses ! as comment instead of #.
51     sed_i 's/^#/!/' Xdefaults
52
53     if test ! "x`os`" = xdarwin; then
54         link xinitrc ~/.xinitrc
55         # lightdm doesn't use ~/.xinitrc but ~/.xprofile instead. Assume it's
56         # used when the lightdm configuration file is present.
57         if test -f "$HOME/.dmrc"; then
58             link xinitrc ~/.xprofile
59         fi
60     fi
61     if test -f xinitrc.local; then
62         link xinitrc.local ~/.xinitrc.local
63     fi
64     link xmodmaprc ~/.xmodmaprc
65     link Xdefaults ~/.Xdefaults
66     link XCompose ~/.XCompose
67 fi
68
69 if installed xpdf; then
70     link xpdfrc ~/.xpdfrc
71 fi
72 if installed zathura; then
73     mkdir -p ~/.config/zathura
74     link zathurarc ~/.config/zathura/zathurarc
75 fi
76
77 if installed feh; then
78     mkdir -p ~/.config
79     link feh ~/.config/feh
80     # Older feh versions only support theme options and configure them through
81     # ~/.fehrc.
82     link feh/themes ~/.fehrc
83 fi