aboutsummaryrefslogtreecommitdiff
path: root/install.sh
blob: 548b9dcf921204a587b743960880904f810dc706 (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
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
205
206
207
208
209
210
211
212
213
214
#! /bin/bash

# Copyright (C) 2022  HimbeerserverDE
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

set -e

if [[ -z "$1" || -z "$2" ]]; then
	echo -e "\e[1m\e[1;31mUsage: <xkblayout> <xkbvariant>"
	exit 1
fi

echo -e "\e[1m\e[1;31mMAKE SURE YOU ARE IN THE DIRECTORY THIS SCRIPT IS LOCATED IN!"
echo -e "\e[0m\e[1;31mIf you're sure you are in the correct dir, press Enter."
read
echo -e "\e[0m"

./shell_only.sh
source ~/.cargo/env

function command_exists {
	command -v $1 &> /dev/null
}

if [ ${UID} -ne 0 ]; then
	if command_exists doas; then
		SUDO="doas"
	elif command_exists sudo; then
		SUDO="sudo"
	else
		echo "Requires doas or sudo to be installed."
		exit 1
	fi
fi

if command_exists pacman; then
	${SUDO} pacman -Sy --noconfirm --needed \
		bspwm \
		sxhkd \
		xorg \
		xorg-xinit \
		xdo \
		rofi \
		polybar \
		flameshot \
		feh \
		picom \
		dunst \
		libnotify \
		vlc \
		firefox \
		thunderbird \
		signal-desktop \
		element-desktop \
		fontconfig \
		terminus-font \
		ttf-hack \
		ttf-hanazono \
		noto-fonts \
		noto-fonts-emoji \
		noto-fonts-extra \
		ttf-dejavu \
		xclip \
		hexchat \
		brightnessctl \
		pipewire \
		pipewire-alsa \
		pipewire-pulse \
		wireplumber \
		alsa-utils \
		chafa \
		xdg-user-dirs \
		xss-lock \
		gstreamer \
		gst-plugins-base \
		gst-plugins-good \
		gst-plugins-bad \
		sl

	paru -S --noconfirm cava i3lock-fancy-rapid-git neo-matrix polkit-dumb-agent-git
elif command_exists apt; then
	${SUDO} apt install -y gnupg gcc cmake g++ pkg-config libfontconfig1-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev apt-transport-https

	wget -O- https://updates.signal.org/desktop/apt/keys.asc | ${SUDO} apt-key add -
	echo "deb [arch=$(dpkg --print-architecture)] https://updates.signal.org/desktop/apt xenial main" | ${SUDO} tee /etc/apt/sources.list.d/signal-xenial.list

	${SUDO} wget -O /usr/share/keyrings/element-io-archive-keyring.gpg https://packages.element.io/debian/element-io-archive-keyring.gpg
	echo "deb [signey-by=/usr/share/keyrings/element-io-archive-keyring.gpg] https://packages.element.io/debian/default main" | ${SUDO} tee /etc/apt/sources.list.d/element-io.list

	${SUDO} apt update
	${SUDO} apt install --no-install-recommends -y \
		bspwm \
		sxhkd \
		xorg \
		xdo \
		rofi \
		polybar \
		flameshot \
		feh \
		picom \
		dunst \
		vlc \
		firefox-esr \
		thunderbird \
		signal-desktop \
		element-desktop \
		fontconfig \
		fonts-terminus-otb \
		fonts-hack \
		fonts-hanazono \
		fonts-noto \
		fonts-noto-color-emoji \
		fonts-dejavu \
		xclip \
		hexchat \
		brightnessctl \
		cava \
		pipewire \
		pipewire-bin \
		wireplumber \
		alsa-utils \
		chafa \
		xdg-user-dirs \
		xss-lock \
		gstreamer1.0-plugins-base \
		gstreamer1.0-plugins-good \
		gstreamer1.0-plugins-bad \
		sl

	cat <<EOT > /usr/bin/polkit-dumb-agent
#!/bin/bash

exit 0
EOT
	chmod a+x /usr/bin/polkit-dumb-agent
else
	echo "Your distro is not supported."
	exit 1
fi

cat <<EOT | ${SUDO} tee /etc/X11/xorg.conf.d/00-keyboard.conf
Section "InputClass"
	Identifier "system-keyboard"
	MatchIsKeyboard "on"
	Option "XkbLayout" "$1"
	Option "XkbVariant" "$2"
EndSection
EOT

mkdir -p ~/.config/bspwm
ln -sf ${PWD}/bspwmrc ~/.config/bspwm/bspwmrc
ln -sf ${PWD}/init_monitor.sh ~/.config/bspwm/init_monitor.sh
ln -sf ${PWD}/intro.canvas ~/.config/bspwm/intro.canvas
ln -sf ${PWD}/intro.rules ~/.config/bspwm/intro.rules

find ${PWD} -name "intro_*.canvas" | xargs ln -sf -t ~/.config/bspwm/
find ${PWD} -name "intro_*.rules" | xargs ln -sf -t ~/.config/bspwm/

mkdir -p ~/.config/sxhkd
ln -sf ${PWD}/sxhkdrc ~/.config/sxhkd/sxhkdrc

mkdir -p ~/.config/rofi
ln -sf ${PWD}/rofi_config ~/.config/rofi/config
ln -sf ${PWD}/rofi_config.rasi ~/.config/rofi/config.rasi

# not the actual config location, it will be symlinked by the mode switch
ln -sf ${PWD}/polybar ~/.config/polybar.d

mkdir -p ~/.config
ln -sf ${PWD}/picom.conf ~/.config/picom.conf

mkdir -p ~/.config/fontconfig
ln -sf ${PWD}/fonts.conf ~/.config/fontconfig/fonts.conf

${SUDO} usermod -aG video ${USER}

xdg-user-dirs-update --set DESKTOP ~
xdg-user-dirs-update --set DOWNLOAD ~/downloads
xdg-user-dirs-update --set TEMPLATES ~
xdg-user-dirs-update --set PUBLICSHARE ~
xdg-user-dirs-update --set DOCUMENTS ~/documents
xdg-user-dirs-update --set MUSIC ~/music
xdg-user-dirs-update --set PICTURES ~/pictures
xdg-user-dirs-update --set VIDEOS ~/videos

cargo install alacritty

mkdir -p ~/.config
ln -sf ${PWD}/alacritty ~/.config/alacritty

mkdir -p ~/
ln -sf ${PWD}/xinitrc ~/.xinitrc

mkdir -p ~/.gnupg
ln -sf ${PWD}/gpg-agent.conf ~/.gnupg/gpg-agent.conf

cargo install --git https://github.com/HimbeerserverDE/musikbox.git

chsh -s /bin/zsh

echo -e "\e[1m\e[1;32mSuccess! You can now log in on tty1."
echo -en "\e[0m"