OSDN Git Service

add cursors
[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 "$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 curl "$LINK/termprograms.txt" >~/.cache/termprograms.txt
71
72 for FOLDER in ./*; do
73     if ! [ -d "$FOLDER" ]; then
74         echo "skipping $FOLDER"
75         continue
76     fi
77     pushd "$FOLDER"
78     if ! [ -e build.sh ]; then
79         rm config.h
80         make
81         sudo make install
82     else
83         chmod +x ./build.sh
84         ./build.sh "$THEME"
85     fi
86     popd
87 done
88
89 # install dotfiles like bash,git and tmux config
90 if [ -n "$DOTFILES" ]; then
91     curl https://raw.githubusercontent.com/paperbenni/dotfiles/master/install.sh | bash
92 fi
93
94 LINK="https://raw.githubusercontent.com/paperbenni/suckless/master"
95
96 if cat /etc/os-release | grep -i 'arch'; then
97     pacinstall() {
98         for i in "$@"; do
99             { pacman -iQ "$i" || command -v "$i"; } &>/dev/null && continue
100             sudo pacman -S --noconfirm "$i"
101         done
102     }
103     echo "setting up arch specific stuff"
104
105     sudo pacman -Syu --noconfirm
106
107     # utilities
108     pacinstall picom
109
110     pacinstall bash dash
111     pacinstall wget slop
112
113     pacinstall ffmpeg
114
115     pacinstall dmidecode
116
117     pacinstall wmctrl
118     pacinstall xdotool
119     pacinstall xrandr
120
121     pacinstall ranger
122     pacinstall fzf
123
124     if ! command -v panther_launcher; then
125         wget "https://www.rastersoft.com/descargas/panther_launcher/panther_launcher-1.12.0-1-x86_64.pkg.tar.xz"
126         sudo pacman -U --noconfirm panther_launcher*.pkg.tar.xz
127         rm panther_launcher*.pkg.tar.xz
128     fi
129
130 fi
131
132 if sudo dmidecode --string chassis-type | grep -iq 'laptop'; then
133     touch .cache/islaptop
134 fi
135
136 # ubuntu specific stuff
137 if grep -iq 'ubuntu' </etc/os-release; then
138
139     sudo apt-get update
140     sudo apt-get upgrade -y
141
142     # utilities
143     aptinstall compton
144
145     aptinstall bash dash
146
147     aptinstall wget slop
148
149     aptinstall ffmpeg
150
151     aptinstall xrandr
152
153     aptinstall fzf
154     aptinstall ranger
155
156     aptinstall() {
157         for i in "$@"; do
158             { dpkg -l "$i" || command -v "$i"; } &>/dev/null && continue
159             sudo apt-get install -y "$i"
160         done
161     }
162
163     if ! command -v panther_launcher; then
164         wget "https://www.rastersoft.com/descargas/panther_launcher/panther-launcher-xenial_1.12.0-ubuntu1_amd64.deb"
165         sudo dpkg -i panther-launcher*.deb
166         sudo apt-get install -fy
167         rm panther-launcher*.deb
168     fi
169 fi
170
171 # auto start script with dwm
172 ls ~/.dwm || mkdir ~/.dwm
173 curl $LINK/autostart.sh >~/.dwm/autostart.sh
174
175 # set up multi monitor config for dswitch
176 if ! [ -e ~/paperbenni/ismultimonitor ]; then
177     if xrandr | grep ' connected' | grep -Eo '[0-9]{3,}x' |
178         grep -o '[0-9]*' | wc -l | grep '2'; then
179         mkdir ~/paperbenni &>/dev/null
180         xrandr | grep ' connected' | grep -Eo '[0-9]{3,}x' |
181             grep -o '[0-9]*' >~/paperbenni/ismultimonitor
182         echo "$(wc -l ~/paperbenni/ismultimonitor) monitors detected"
183     else
184         echo "not a multi monitor setup"
185     fi
186 else
187     echo "monitor config: "
188     cat ~/paperbenni/ismultimonitor
189     echo ""
190 fi
191
192 # notification program for deadd-center
193 if ! command -v notify-send.py &>/dev/null; then
194     git clone --depth=2 https://github.com/phuhl/notify-send.py
195     cd notify-send.py
196     sudo pip2 install notify2
197     sudo python3 setup.py install
198     cd ..
199     sudo rm -rf notify-send.py
200 fi
201
202 mkdir -p ~/.config/deadd
203 curl $LINK/deadd.conf >~/.config/deadd/deadd.conf
204
205 # install win + a menus for shortcuts like screenshots and shutdown
206 curl https://raw.githubusercontent.com/paperbenni/menus/master/install.sh | bash
207
208 ## notification center ##
209 if ! command -v deadd; then
210     echo "installing deadd"
211     wget -q $LINK/bin/deadd.xz
212     xz -d deadd.xz
213     sleep 0.1
214     usrbin deadd
215 fi
216
217 mkdir ~/paperbenni &>/dev/null
218
219 # automatic wallpaper changer
220 if [ "$2" = "rwall" ]; then
221     gitclone rwallpaper
222     cd rwallpaper
223     mv rwallpaper.py ~/paperbenni/
224     chmod +x wallpaper.sh
225     mv wallpaper.sh ~/paperbenni/
226     sudo pip3 install -r requirements.txt
227     cd ..
228     rm -rf rwallpaper
229 fi
230
231 # install things like fonts or gtk theme
232 if ! [ -e ~/.config/paperthemes/$THEME.txt ]; then
233     echo "installing theme"
234     curl -s "https://raw.githubusercontent.com/paperbenni/suckless/master/themes/$THEME.sh" | bash
235     mkdir ~/.config/paperthemes
236     touch ~/.config/paperthemes/$THEME.txt
237 else
238     echo "theme installation already found"
239 fi
240
241 # fix java on dwm
242 if ! grep 'dwm' </etc/profile; then
243     echo "fixing java windows for dwm in /etc/profile"
244     echo '# fix dwm java windows' | sudo tee -a /etc/profile
245     echo 'export _JAVA_AWT_WM_NONREPARENTING=1' | sudo tee -a /etc/profile
246 else
247     echo "java workaround already applied"
248 fi