OSDN Git Service

mac set font
[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
13 # pinstall dash slop ffmpeg wmctrl
14
15 gclone() {
16     git clone --depth=1 https://github.com/paperbenni/"$1".git
17 }
18
19 gprogram() {
20     wget "https://raw.githubusercontent.com/paperbenni/suckless/master/programs/$1"
21     usrbin "$1"
22 }
23
24 if [ "$1" = "dotfiles" ]; then
25     shift 1
26     DOTFILES="True"
27 fi
28
29 THEME="${1:-dracula}"
30
31 rm -rf suckless
32 mkdir suckless
33 cd suckless
34
35 gclone dwm
36 gclone dmenu
37 gclone st
38
39 # needed for slock
40 if grep -q 'nobody' </etc/groups; then
41     sudo groupadd nobody
42 fi
43 gclone slock
44
45 # session for lightdm
46 wget https://raw.githubusercontent.com/paperbenni/suckless/master/dwm.desktop
47 sudo mv dwm.desktop /usr/share/xsessions/
48
49 # x session wrapper
50 gprogram startdwm
51 # shutdown popup that breaks restart loop
52 gprogram sucklessshutdown
53
54 gprogram autoclicker
55 # deadcenter toggle script
56 gprogram deadcenter
57
58 # dmenu run but in terminal emulator st
59 # only supported terminal apps (less to search through)
60 gprogram dmenu_run_st
61
62 curl "$LINK/termprograms.txt" >~/.cache/termprograms.txt
63
64 for FOLDER in ./*; do
65     if ! [ -d "$FOLDER" ]; then
66         echo "skipping $FOLDER"
67         continue
68     fi
69     pushd "$FOLDER"
70     if ! [ -e build.sh ]; then
71         rm config.h
72         make
73         sudo make install
74     else
75         chmod +x ./build.sh
76         ./build.sh "$THEME"
77     fi
78     popd
79 done
80
81 # install dotfiles like bash,git and tmux config
82 if [ -n "$DOTFILES" ]; then
83     curl https://raw.githubusercontent.com/paperbenni/dotfiles/master/install.sh | bash
84 fi
85
86 LINK="https://raw.githubusercontent.com/paperbenni/suckless/master"
87
88 if cat /etc/os-release | grep -i 'arch'; then
89     pacinstall() {
90         for i in "$@"; do
91             { pacman -iQ "$i" || command -v "$i"; } &>/dev/null && continue
92             sudo pacman -S --noconfirm "$i"
93         done
94     }
95     echo "setting up arch specific stuff"
96
97     sudo pacman -Syu --noconfirm
98
99     # utilities
100     pacinstall picom
101     pacinstall bash dash
102     pacinstall wget slop
103     pacinstall ffmpeg
104     pacinstall dmidecode
105
106     if ! command -v panther_launcher; then
107         wget "https://www.rastersoft.com/descargas/panther_launcher/panther_launcher-1.12.0-1-x86_64.pkg.tar.xz"
108         sudo pacman -U --noconfirm panther_launcher*.pkg.tar.xz
109         rm panther_launcher*.pkg.tar.xz
110     fi
111
112 fi
113
114 if sudo dmidecode --string chassis-type | grep -iq 'laptop'; then
115     touch .cache/islaptop
116 fi
117
118 # ubuntu specific stuff
119 if grep -iq 'ubuntu' </etc/os-release; then
120
121     sudo apt-get update
122     sudo apt-get upgrade -y
123
124     # utilities
125     aptinstall compton
126     aptinstall bash dash
127     aptinstall wget slop
128     aptinstall ffmpeg
129
130     aptinstall() {
131         for i in "$@"; do
132             { dpkg -l "$i" || command -v "$i"; } &>/dev/null && continue
133             sudo apt-get install -y "$i"
134         done
135     }
136
137     if ! command -v panther_launcher; then
138         wget "https://www.rastersoft.com/descargas/panther_launcher/panther-launcher-xenial_1.12.0-ubuntu1_amd64.deb"
139         sudo dpkg -i panther-launcher*.deb
140         sudo apt-get install -fy
141         rm panther-launcher*.deb
142     fi
143 fi
144
145 # auto start script with dwm
146 ls ~/.dwm || mkdir ~/.dwm
147 curl $LINK/autostart.sh >~/.dwm/autostart.sh
148
149 # notification program for deadd-center
150 if ! command -v notify-send.py &>/dev/null; then
151     git clone --depth=2 https://github.com/phuhl/notify-send.py
152     cd notify-send.py
153     sudo pip2 install notify2
154     sudo python3 setup.py install
155     cd ..
156     sudo rm -rf notify-send.py
157 fi
158
159 mkdir -p ~/.config/deadd
160 curl $LINK/deadd.conf >~/.config/deadd/deadd.conf
161
162 # install window switcher
163 curl "$LINK/dswitch" | sudo tee /usr/local/bin/dswitch
164 sudo chmod +x /usr/local/bin/dswitch
165
166 # install win + a menus for shortcuts like screenshots and shutdown
167 curl https://raw.githubusercontent.com/paperbenni/menus/master/install.sh | bash
168
169 ## notification center ##
170 # remove faulty installation
171 sudo rm /usr/bin/deadd &>/dev/null
172 sudo rm /usr/bin/deadcenter &>/dev/null
173
174 # main binary
175 echo "installing deadd"
176 wget -q $LINK/bin/deadd.xz
177 xz -d deadd.xz
178 sleep 0.1
179 sudo mv deadd /usr/bin/deadd
180 sudo chmod +x /usr/bin/deadd
181
182 mkdir ~/paperbenni &>/dev/null
183
184 # automatic wallpaper changer
185 gclone rwallpaper
186 cd rwallpaper
187 mv rwallpaper.py ~/paperbenni/
188 chmod +x wallpaper.sh
189 mv wallpaper.sh ~/paperbenni/
190 sudo pip3 install -r requirements.txt
191 cd ..
192 rm -rf rwallpaper
193
194 # install things like fonts or gtk theme
195 if ! [ -e ~/.config/paperthemes/$THEME.txt ]; then
196     echo "installing theme"
197     curl -s "https://raw.githubusercontent.com/paperbenni/suckless/master/themes/$THEME.sh" | bash
198     mkdir ~/.config/paperthemes
199     touch ~/.config/paperthemes/$THEME.txt
200 else
201     echo "theme installation already found"
202 fi
203
204 # fix java on dwm
205 if ! grep 'dwm' </etc/profile; then
206     echo "fixing java windows for dwm in /etc/profile"
207     echo '# fix dwm java windows' | sudo tee -a /etc/profile
208     echo 'export _JAVA_AWT_WM_NONREPARENTING=1' | sudo tee -a /etc/profile
209 else
210     echo "java workaround already applied"
211 fi