summaryrefslogtreecommitdiffstats
path: root/install
blob: a4b2c03ceff6b103112af0e0960bff6ea7db6b00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash

confdir=$(dirname $0)
files="abcde.conf
       bash_logout
       bashrc
       conkerorrc
       conkyrc
       crawlrc
       gitconfig
       gitignore
       gtkrc
       inputrc
       muttrc
       nethackrc
       procmailrc
       screenrc
       tmux.conf
       vimrc
       Xdefaults
       xinitrc
       xmobarrc
       bash
       bin
       irssi
       fortune
       module-setup
       ncmpc
       newsbeuter
       procmail
       terminfo
       urxvt
       vim
       xmonad"

function install() {
    if [[ -e "$2" && ! -h "$2" ]]; then
        mv "$2" "$2.bak"
    fi
    if [[ -d "$2" && -h "$2" ]]; then
        rm -f "$2"
    fi
    target="$confdir/$1"
    tmp=$(dirname $2)
    if [[ "$tmp" != '.' ]]; then
        for i in ${tmp//\// }; do
            target="../$target"
        done
    fi
    mkdir -p $(dirname $2)
    ln -sf "$target" "$2"
}

for file in $files; do
    install "${file}" ".${file}"
done
install repl.rc .re.pl/repl.rc
install authorized_keys .ssh/authorized_keys

cd .bin
find -type f -exec chmod a+x '{}' \;
ln -sf ssh scp
ln -sf ssh sftp