-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
91 lines (70 loc) · 2.25 KB
/
setup.sh
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh -x
# You can run this script on a remote host like this:
# ssh root@172.16.4.1 'bash -s' < puppet.sh
cd ~
installed()
{
command -v $1 > /dev/null
}
chown -R $(id -u):$(id -g) ~/.configs
for i in apt-get yum pkg_add prt-get apk pacman; do
installed $i && installer=$i && break
done
sudo=$(which sudo 2> /dev/null )
case $installer in
apk)
install=add
;;
pkg)
install=install
;;
pacman)
install='-S --noconfirm'
;;
*)
install="install -y"
;;
esac
if [ $(id -u) != 0 ]; then
sudo=sudo
fi
install_package() {
for i in $*; do
case $i in
*:*)
installed ${i%:*} || $sudo $installer $install ${i#*:}
;;
*)
installed $i || $sudo $installer $install $i
;;
esac
done
}
[ "$installer" = "yum" ] && [ ! -f /etc/yum.repos.d/epel.repo ] && $sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
case $installer in
apk)
install_package zsh git mg htop tmux ag:the_silver_searcher rsync
;;
*)
install_package zsh git mg htop tmux ag:the_silver_searcher w3m colordiff iotop coreutils rsync
;;
esac
[ -d .configs ] || git clone https://github.com/hboetes/configs.git .configs
installed zsh && grep -q "^$USER:.*/bin/zsh$" /etc/passwd || chsh -s $(which zsh)
mkdir -p .config
for i in .configs/.config/htop .configs/.config/mc .configs/.config/terminator .configs/.config/fontconfig; do
[ -h .config/${i##*/} ] || ln -sf ../$i .config
done
for i in .configs/.colordiffrc .configs/.emacs.d .configs/.mg .configs/.w3m .configs/zsh.d/.zshenv .configs/.gitconfig .configs/.tmux.conf; do
[ -h ${i##*/} ] || ln -sf $i
done
[ -f .tmux.local ] || cp .configs/.tmux.local .
# Only install this stuff if X is installed.
installed X || exit 0
install_package i3-wm rofi diodon redshift-gtk mpv
# Set up the right apps to open pgn and magnet links.
xdg-desktop-menu install --mode user --novendor .configs/pgnhandler.desktop
xdg-desktop-menu install --mode user --novendor .configs/magnethandler.desktop
for i in .configs/.config/i3 .configs/.config/i3blocks; do
[ -h .config/${i##*/} ] || ln -sf $i .config
done