-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·204 lines (159 loc) · 5.6 KB
/
install.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/bin/bash
# __ __ _
# ___ __ _ / _|/ _| ___(_)_ __ ___
# / __/ _` | |_| |_ / _ \ | '_ \ / _ \
# | (_| (_| | _| _| __/ | | | | __/
# \___\__,_|_| |_| \___|_|_| |_|\___|
#
# --- Linux desktop environment for geeks ---
#
#
# Copyright (c) 2018 imm studios, z.s.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
##############################################################################
## COMMON UTILS
base_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
config_dir=$HOME/.config
temp_dir="/tmp/caffeine-installer"
function error_exit {
printf "\n\033[0;31mInstallation failed\033[0m\n"
cd ${base_dir}
exit 1
}
function finished {
printf "\n\033[0;92mInstallation completed\033[0m\n"
cd ${base_dir}
exit 0
}
if [ ! -d ${temp_dir} ]; then
mkdir ${temp_dir} || error_exit
fi
if [ ! -d $config_dir ]; then
mkdir $config_dir;
fi
## COMMON UTILS
##############################################################################
function download_repo() {
cd ${temp_dir}
repo=$1
repo_name=$(basename $repo)
if [ -d $repo_name ]; then
cd $repo_name
git pull || return 1
cd ..
else
git clone $repo || return 1
fi
return 0
}
function install_apt {
apt update || return 1
# X server and audio
apt install -y \
xserver-xorg xdm \
pulseaudio pulseaudio-utils pavucontrol \
|| return 1
# Desktop notifications
apt install -y \
dunst libnotify-bin dbus-x11 || return 1
# Console utils
apt install -y \
vim git screen curl mc rsync aptitude source-highlight \
htop nload nmap net-tools\
build-essential autoconf automake autogen \
figlet cowsay w3m mediainfo \
unoconv odt2txt catdoc \
python-pip python3-pip || return 1
# GUI utils
apt install -y \
numlockx xclip rxvt-unicode-256color arandr acpi \
rofi compton redshift xbacklight \
mpd mpc ncmpcpp \
zathura mpv feh scrot vlc vim-gtk || return 1
apt install -y \
gtk2-engines-pixbuf gtk2-engines-murrine || return 1
pip3 install py3status python-mpd2 || return 1
#
# ETC
#
cp $caffeine_dir/global/etc/X11/xdm/Xresources /etc/X11/xdm/Xresources
cp $caffeine_dir/global/etc/X11/xdm/Xsetup /etc/X11/xdm/Xsetup
#
# USR
#
# Default background
if [ ! -d /usr/share/backgrounds ]; then
mkdir -p /usr/share/backgrounds
fi
cp $base_dir/global/usr/share/backgrounds/caffeine.png /usr/share/backgrounds
# Console font
if [ ! -d /usr/share/fonts/caffeine-font ]; then
mkdir -p /usr/share/fonts/caffeine-font
fi
cp -r $base_dir/global/usr/share/fonts/caffeine-font /usr/share/fonts/
# Set urxvt as default terminal
update-alternatives --set x-terminal-emulator /usr/bin/urxvt
# Disable system-wide MPD
if [ -f /etc/mpd.conf ]; then rm /etc/mpd.conf; fi
systemctl disable mpd
# urxvt plugins
if [ ! -d /usr/lib/urxv/perl ]; then
mkdir -p /usr/lib/urxvt/perl
fi
cp global/usr/lib/urxvt/perl/* /usr/lib/urxvt/perl
}
function install_i3 {
command -v i3 >/dev/null 2>&1 && return 0
apt install -y \
libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev \
libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev \
libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev \
libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev \
libxcb-xrm0 libxcb-xrm-dev libxcb-shape0-dev || return 1
download_repo "https://github.com/Airblader/i3"
cd ${temp_dir}/i3
if [ -d build/ ]; then
rm -rf build/
fi
mkdir build/
autoreconf --force --install || return 1
cd build
../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers || return 1
make || return 1
make install || return 1
apt install -y i3lock i3status || return 1
}
function install_user {
if [ -f $HOME/.Xresources ]; then rm $HOME/.Xresources; fi
if [ -d $config_dir/i3 ]; then rm -rf $config_dir/i3; fi
if [ -d $config_dir/i3status ]; then rm -rf $config_dir/i3status; fi
if [ -d $config_dir/mpd ]; then rm -rf $config_dir/mpd; fi
if [ -d $config_dir/mpv ]; then rm -rf $config_dir/mpv; fi
if [ -d $config_dir/scripts ]; then rm -rf $config_dir/scripts; fi
ln -s $base_dir/home/.Xresources $HOME/.Xresources
ln -s $base_dir/home/.config/i3 $config_dir/i3
ln -s $base_dir/home/.config/i3status $config_dir/i3status
ln -s $base_dir/home/.config/mpd $config_dir/mpd
ln -s $base_dir/home/.config/mpv $config_dir/mpv
ln -s $base_dir/home/.config/scripts $config_dir/scripts
ln -s $base_dir/home/.config/dunst $config_dir/dunst
echo "exec i3 > $HOME/.xsession"
xdg-mime default feh.desktop image/jpeg
xdg-mime default feh.desktop image/png
}
if [ "$(id -u)" != "0" ]; then
install_user || error_exit
else
install_apt || error_exit
install_i3 || error_exit
fi