OSDN Git Service

add conky and sl
[instantos/instantOS.git] / install.sh
1 #!/usr/bin/env bash
2
3 #############################################
4 ## installs all paperbenni suckless forks  ##
5 ## made for personal use, so be warned ;)  ##
6 #############################################
7
8 echo "installing paperbenni's suckless suite"
9
10 source <(curl -s https://raw.githubusercontent.com/paperbenni/bash/master/import.sh)
11 pb install
12 pb git
13
14 gprogram() {
15     wget "https://raw.githubusercontent.com/paperbenni/suckless/master/programs/$1"
16     usrbin -f "$1"
17 }
18
19 if [ "$1" = "dotfiles" ]; then
20     shift 1
21     DOTFILES="True"
22 fi
23
24 THEME="${1:-dracula}"
25 echo "using theme $THEME"
26
27 rm -rf suckless
28 mkdir suckless
29 cd suckless
30
31 gitclone dwm
32 gitclone dmenu
33 gitclone st
34
35 # needed for slock
36 if grep -q 'nobody' </etc/groups || grep -q 'nobody' </etc/group; then
37     echo "nobody workaround not required"
38 else
39     sudo groupadd nobody
40 fi
41
42 gitclone slock
43
44 # install cursors for themes
45 if ! [ -e ~/.icons/osx ]; then
46     curl -s https://raw.githubusercontent.com/paperbenni/cursors/master/install.sh | bash
47 fi
48
49 # session for lightdm
50 wget https://raw.githubusercontent.com/paperbenni/suckless/master/dwm.desktop
51 sudo mv dwm.desktop /usr/share/xsessions/
52
53 # x session wrapper
54 gprogram startdwm
55 # shutdown popup that breaks restart loop
56 gprogram sucklessshutdown
57
58 gprogram autoclicker
59 # deadcenter toggle script
60 gprogram deadcenter
61
62 # dmenu run but in terminal emulator st
63 # only supported terminal apps (less to search through)
64 gprogram dmenu_run_st
65
66 gprogram dswitch
67 gprogram dworkl
68 gprogram dworkr
69
70 # for that extra kick when doingg a typo
71 gprogram sll
72
73 curl "$LINK/termprograms.txt" >~/.cache/termprograms.txt
74
75 for FOLDER in ./*; do
76     if ! [ -d "$FOLDER" ]; then
77         echo "skipping $FOLDER"
78         continue
79     fi
80     pushd "$FOLDER"
81     if ! [ -e build.sh ]; then
82         rm config.h
83         make
84         sudo make install
85     else
86         chmod +x ./build.sh
87         ./build.sh "$THEME"
88     fi
89     popd
90 done
91
92 # install dotfiles like bash,git and tmux config
93 if [ -n "$DOTFILES" ]; then
94     curl https://raw.githubusercontent.com/paperbenni/dotfiles/master/install.sh | bash
95 fi
96
97 LINK="https://raw.githubusercontent.com/paperbenni/suckless/master"
98
99 if cat /etc/os-release | grep -i 'arch'; then
100     pacinstall() {
101         for i in "$@"; do
102             { pacman -iQ "$i" || command -v "$i"; } &>/dev/null && continue
103             sudo pacman -S --noconfirm "$i"
104         done
105     }
106     echo "setting up arch specific stuff"
107
108     sudo pacman -Syu --noconfirm
109
110     # utilities
111     pacinstall picom
112
113     pacinstall bash dash
114     pacinstall wget slop
115     pacinstall acpi
116
117     pacinstall ffmpeg
118     pacinstall mpv
119
120     pacinstall dmidecode
121
122     pacinstall wmctrl
123     pacinstall xdotool
124     pacinstall xrandr
125
126     pacinstall conky
127     pacinstall ranger
128     pacinstall fzf
129     pacinstall sl
130
131     pacinstall lxappearance
132
133     if ! command -v panther_launcher; then
134         wget "https://www.rastersoft.com/descargas/panther_launcher/panther_launcher-1.12.0-1-x86_64.pkg.tar.xz"
135         sudo pacman -U --noconfirm panther_launcher*.pkg.tar.xz
136         rm panther_launcher*.pkg.tar.xz
137     fi
138
139 fi
140
141 if sudo dmidecode --string chassis-type | grep -iq 'laptop'; then
142     touch .cache/islaptop
143 fi
144
145 # ubuntu specific stuff
146 if grep -iq 'ubuntu' </etc/os-release; then
147
148     sudo apt-get update
149     sudo apt-get upgrade -y
150
151     aptinstall() {
152         for i in "$@"; do
153             { dpkg -l "$i" || command -v "$i"; } &>/dev/null && continue
154             sudo apt-get install -y "$i"
155         done
156     }
157
158     # utilities
159     aptinstall compton
160
161     aptinstall bash dash
162
163     aptinstall wget slop
164     aptinstall acpi
165     aptinstall ffmpeg
166     aptinstall mpv
167
168     aptinstall xrandr
169
170     aptinstall fzf
171     aptinstall ranger
172     aptinstall conky
173     aptinstall sl
174
175     aptinstall lxappearance
176
177     if ! command -v panther_launcher; then
178         wget "https://www.rastersoft.com/descargas/panther_launcher/panther-launcher-xenial_1.12.0-ubuntu1_amd64.deb"
179         sudo dpkg -i panther-launcher*.deb
180         sudo apt-get install -fy
181         rm panther-launcher*.deb
182     fi
183 fi
184
185 # auto start script with dwm
186 ls ~/.dwm || mkdir ~/.dwm
187 curl $LINK/autostart.sh >~/.dwm/autostart.sh
188
189 # set up multi monitor config for dswitch
190 if ! [ -e ~/paperbenni/ismultimonitor ]; then
191     if xrandr | grep ' connected' | grep -Eo '[0-9]{3,}x' |
192         grep -o '[0-9]*' | wc -l | grep '2'; then
193         mkdir ~/paperbenni &>/dev/null
194         xrandr | grep ' connected' | grep -Eo '[0-9]{3,}x' |
195             grep -o '[0-9]*' >~/paperbenni/ismultimonitor
196         echo "$(wc -l ~/paperbenni/ismultimonitor) monitors detected"
197     else
198         echo "not a multi monitor setup"
199     fi
200 else
201     echo "monitor config: "
202     cat ~/paperbenni/ismultimonitor
203     echo ""
204 fi
205
206 # notification program for deadd-center
207 if ! command -v notify-send.py &>/dev/null; then
208     git clone --depth=2 https://github.com/phuhl/notify-send.py
209     cd notify-send.py
210     sudo pip2 install notify2
211     sudo python3 setup.py install
212     cd ..
213     sudo rm -rf notify-send.py
214 fi
215
216 mkdir -p ~/.config/deadd
217 curl $LINK/deadd.conf >~/.config/deadd/deadd.conf
218
219 # install win + a menus for shortcuts like screenshots and shutdown
220 curl https://raw.githubusercontent.com/paperbenni/menus/master/install.sh | bash
221
222 ## notification center ##
223 if ! command -v deadd; then
224     echo "installing deadd"
225     wget -q $LINK/bin/deadd.xz
226     xz -d deadd.xz
227     sleep 0.1
228     usrbin deadd
229 fi
230
231 if ! command -v dragon &>/dev/null; then
232     git clone --depth=1 https://github.com/mwh/dragon.git
233     cd dragon
234     make
235     make install
236     cd ..
237     rm -rf dragon
238 fi
239
240 if ! command -v lsw &>/dev/null; then
241     test -e core && (echo "core dir existing" && exit 1)
242     git clone --depth=1 https://github.com/wmutils/core.git
243     cd core
244     make
245     sudo make install
246     cd ..
247     rm -rf core
248 fi
249
250 mkdir ~/paperbenni &>/dev/null
251
252 # automatic wallpaper changer
253 if [ "$2" = "rwall" ]; then
254     gitclone rwallpaper
255     cd rwallpaper
256     mv rwallpaper.py ~/paperbenni/
257     chmod +x wallpaper.sh
258     mv wallpaper.sh ~/paperbenni/
259     sudo pip3 install -r requirements.txt
260     cd ..
261     rm -rf rwallpaper
262 fi
263
264 # install things like fonts or gtk theme
265 if ! [ -e ~/.config/paperthemes/$THEME.txt ]; then
266     echo "installing theme"
267     curl -s "https://raw.githubusercontent.com/paperbenni/suckless/master/themes/$THEME.sh" | bash
268     mkdir ~/.config/paperthemes
269     touch ~/.config/paperthemes/$THEME.txt
270 else
271     echo "theme installation already found"
272 fi
273
274 # fix java on dwm
275 if ! grep 'dwm' </etc/profile; then
276     echo "fixing java windows for dwm in /etc/profile"
277     echo '# fix dwm java windows' | sudo tee -a /etc/profile
278     echo 'export _JAVA_AWT_WM_NONREPARENTING=1' | sudo tee -a /etc/profile
279 else
280     echo "java workaround already applied"
281 fi