OSDN Git Service

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