~jman/dotfiles

ref: refs/heads/master dotfiles/stow-install.sh -rwxr-xr-x 1.4 KiB
256207b1jman doom: add deepl.com and reverso.com client 15 days ago
                                                                                
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
#!/bin/bash

# set -x

# Usage: <action> <pkg>
# Examples:
# ./stow-install.sh waybar
# ./stow-install.sh -R sway

if [ "${2}" == "" ]; then
    pkg=$1
else
    action=$1
    pkg=$2
fi

if [ -z $pkg ]; then
    echo "Missing pkg. Abort."
    exit 1
fi

# echo action=$action pkg=$pkg
# exit 0

init_pkgs=(kanshi swappy waybar home sway systemd utils xkb mako swayidle terminfo vim emacs gnupg swaylock wallpapers youtube-dl lnav)
personal_pkgs=(mpop gitconfigs isync)

function install_pkg {
    # Note about using "--no-folding"
    # This param *will* create a dir if missing and then symlinks files inside that dir.
    # Although sometimes is useful to avoid creating a dir when symlinking
    # that parameter also does not handle deleting directories when
    # removing the symlinks, so you end up with empty dirs in ~/.config
    echo ">> Running ${@}"
    stow -v --dotfiles -t /home/$USER --ignore='.*\.md' --ignore='.*\.src' ${@}
}

if [ -z "${pkg}" ]; then
    echo "Missing pkg. Abort."
    exit 1
fi

if [[ "${pkg}" == "system" ]]; then
    sudo stow -v -t / --ignore='.*\.md' --ignore='.*\.src' ${action} ${pkg}
    exit 0
fi

if [[ "${pkg}" == "init" ]]; then
    for pkg in ${init_pkgs[@]}; do
        install_pkg $action $pkg
    done
elif [[ "${pkg}" == "personal" ]]; then
    for pkg in ${personal_pkgs[@]}; do
        install_pkg $action $pkg
    done
else
    install_pkg ${action} ${pkg}
fi