aboutsummaryrefslogtreecommitdiff
path: root/scripts/bootstrap.sh
blob: 9fd7d7ae88a40b54c0665175144e6c861e0ce85a (plain)
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
#!/usr/bin/env bash

dotfiles_dir=$(cd -- "$(dirname ${BASH_SOURCE}/..)" > /dev/null 2>&1; pwd -P)

remove_and_link () {
    for var in $@
    do
        if [ -L $HOME/$var ] && [ -e $HOME/$var ] && \
            [ "$(readlink -- $HOME/$var)" = "$dotfiles_dir/$var" ]; then
            continue
        fi

        rm -rf $HOME/$var
        ln -s $dotfiles_dir/$var $HOME/$var
        echo "Linked: $HOME/$var -> $dotfiles_dir/$var"
    done
}

link_all () {
    remove_and_link .ctags.d .mutt bin .aliases .macos \
        .mbsyncrc .msmtprc  .tmux.conf .urlview .zshrc \
        .vimrc .vim .path .functions .emacs.d .gitconfig \
        .config/i3 .config/polybar .xinitrc .pam_environment \
        .zprofile .newsboat .ledgerrc .nnnrc
}

main () {
    if [ $# -eq 0 ] || [ $1 = 'all' ]; then
        link_all
        return
    fi

    if [ $1 = 'install' ]; then
        install
        return
    fi

    remove_and_link $@
}

install () {
    if [ -f '/etc/arch-release' ]; then
        arch_install
    else
        echo "No script for this OS"
    fi
}

arch_install () {
    sudo pacman -Syu git xorg-server xorg-xinit networkmanager alsa-utils \
        openssh keepassxc bluez bluez-utils \
        adobe-source-han-serif-cn-fonts adobe-source-han-sans-cn-fonts \
        wqy-zenhei wqy-microhei wqy-microhei-lite wqy-bitmapfont \
        noto-fonts-cjk noto-fonts-emoji noto-fonts-extra \
        firefox steam \
        fcitx5-im fcitx5-chinese-addons fcitx5-anthy fcitx5-pinyin-zhwiki \
        i3-wm

    echo 'Please remember to install GPU driver'
}