forked from ylrxeidx/elementary-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elementary-script.sh
executable file
·480 lines (424 loc) · 16 KB
/
elementary-script.sh
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
#!/bin/bash
zenity(){
# Need to resolve 'GtkDialog mapped without a transient parent'
/usr/bin/zenity "$@" 2>/dev/null
}
function installPackage() {
local name=$1
package=$(dpkg --get-selections | grep "$name" )
echo "Verifying that the $name package is installed."
echo "$package"
if [ -n "$package" ] ;
then echo
echo "Package $name is already installed."
else echo
echo "Package $name required-> Not installed"
echo "Automatically installing the package..."
sudo apt -y install $name
fi
}
function addRepository() {
repository=$1
sudo apt-add-repository -r $repository -y #remove if already installed
sudo apt update
sudo add-apt-repository -y $repository
sudo apt update
}
function error_msg() {
zenity --error --text="${1}" --ellipsize
}
function ppa_error_msg() {
error_msg "The package $1 couldn't be installed\nWe disabled any package that use ppa's for now."
}
function not_implemented_error_msg() {
error_msg "This action($1) wasn't implemented yet."
}
function main() {
#Install x11-utils, we need xwininfo for auto adjust window
installPackage x11-utils
#define the height in px of the top system-bar and sum in px of all horizontal borders:
TOPMARGIN=27
RIGHTMARGIN=10
# get width of screen and height of screen
SCREEN_WIDTH=$(xwininfo -root | awk '$1=="Width:" {print $2}')
SCREEN_HEIGHT=$(xwininfo -root | awk '$1=="Height:" {print $2}')
# new width and height
W=$(( $SCREEN_WIDTH / 1 - $RIGHTMARGIN ))
H=$(( $SCREEN_HEIGHT - 2 * $TOPMARGIN ))
# Zenity
GUI=$(zenity --list --checklist \
--height $H \
--width $W \
--name="elementary 0.4.1 post-install script" \
--title="elementary 0.4.1 post-install script" \
--text "Pick one or multiple Actions to execute." \
--column=Picks --column=Actions --column=Description \
TRUE "Update System" "Updates the package lists, the system packages and Applications." \
TRUE "Enable PPAs" "Another extra layer of security and another level of annoyance. You cannot add PPA by default in Loki." \
FALSE "Install Elementary Tweaks" "Installing themes in elementary OS is a much easier task thanks to elementary Tweaks tool." \
FALSE "Install Urutau Icons" "A mega pack of icons for elementary OS." \
FALSE "Install Elementary X" "Original elementary theme with some tweaks and OS X window controls." \
FALSE "Install Support for Archive Formats" "Installs support for archive formats(.zip, .rar, .p7)." \
FALSE "Fix keyboard accents on latin keyboard" "Autostart ibus-daemon, you may want to check it if you're having issues with accents on Qt apps" \
FALSE "Add Oibaf Repository" "This repository contain updated and optimized open graphics drivers." \
FALSE "Install Gufw Firewall" "Gufw is an easy and intuitive way to manage your linux firewall." \
FALSE "Install Notes-up" "Aimed for elementary OS, notes-up is a virtual notebook manager were you can write your notes in markdown format." \
FALSE "Install Startup Disk Creator" "Startup Disk Creator converts a USB key or SD card into a volume from which you can start up and run OS Linux" \
FALSE "Install GDebi" "Installs GDebi. A simple tool to install deb files." \
FALSE "Install Google Chrome" "Installs Google Chrome 64bits. A browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier." \
FALSE "Install Chromium" "Installs Chromium. An open-source browser project that aims to build a safer, faster, and more stable way for all Internet users to experience the web." \
FALSE "Install Opera" "Installs Opera. Fast, secure, easy-to-use browser" \
FALSE "Install Firefox" "Installs Firefox. A free and open-source web browser." \
FALSE "Install Skype" "Video chat, make international calls, instant message and more with Skype." \
FALSE "Install Dropbox" "Installs Dropbox with wingpanel support. Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily." \
FALSE "Install Liferea" "Installs Liferea. a web feed reader/news aggregator that brings together all of the content from your favorite subscriptions into a simple interface that makes it easy to organize and browse feeds. Its GUI is similar to a desktop mail/newsclient, with an embedded graphical browser." \
FALSE "Install Go For It!" "Go For It! is a simple and stylish productivity app, featuring a to-do list, merged with a timer that keeps your focus on the current task." \
FALSE "Install Klavaro" "Installs the Klavaro a free touch typing tutor program." \
FALSE "Install VLC" "Installs VLC. A free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols." \
FALSE "Install Clementine Music Player" "Installs Clementine. One of the Best Music Players and library organizer on Linux." \
FALSE "Install Gimp" "GIMP is an advanced picture editor. You can use it to edit, enhance, and retouch photos and scans, create drawings, and make your own images." \
FALSE "Install Deluge" "Deluge is a lightweight, Free Software, cross-platform BitTorrent client." \
FALSE "Install Transmission" "Installs the Transmission BitTorrent client." \
FALSE "Install Atom" "Installs Atom. A hackable text editor for the 21st Century." \
FALSE "Install Sublime Text 3" "Installs Sublime Text 3. A sophisticated text editor for code, markup and prose." \
FALSE "Install LibreOffice" "Installs LibreOffice. A powerful office suite." \
FALSE "Install WPS Office" "Installs WPS Office. The most compatible free office suite." \
FALSE "Install TLP" "Install TLP to save battery and prevent overheating." \
FALSE "Install Redshift" "Use night shift to save your eyes." \
FALSE "Install Disk Utility" "Gnome Disk Utility is a tool to manage disk drives and media." \
FALSE "Install Brasero" "A CD/DVD burning application for Linux" \
FALSE "Install Spotify" "A desktop software to listen music by streaming with the possibility to create and share playlists.." \
FALSE "Install Ubuntu Restricted Extras" "Installs commonly used applications with restricted copyright (mp3, avi, mpeg, TrueType, Java, Flash, Codecs)." \
FALSE "Fix Broken Packages" "Fixes the broken packages." \
FALSE "Clean-Up Junk" "Removes unnecessary packages and the local repository of retrieved package files." \
--separator=', ');
if ( parse_opt $GUI ); then
# Notification
notify-send -i utilities-terminal elementary-script "All tasks ran successfully!"
else
return 1
fi
}
function parse_opt() {
opt="$*"
# Update System Action
if [[ $opt == *"Update System"* ]]
then
echo "Updating system..."
sudo apt -y update
sudo apt -y full-upgrade
fi
# Enable PPAs
if [[ $opt == *"Enable PPAs"* ]]
then
echo "Enabling PPAs..."
installPackage software-properties-common
fi
# Install Elementary Tweaks Action
if [[ $opt == *"Install Elementary Tweaks"* ]]
then
echo "Installing Elementary Tweaks..."
addRepository ppa:philip.scott/elementary-tweaks
installPackage elementary-tweaks
ppa_error_msg "Elementary Tweaks"
fi
# Install Elementary Full Icon Theme
if [[ $opt == *"Install Urutau Icons"* ]]
then
installPackage git
directory=/usr/share/icons/urutau-icons
if [ -d "$directory" ]; #Verifying if directory exists
then
echo "The icon-pack already installed. They will be updated now..."
cd /usr/share/icons/urutau-icons
sudo git pull
else
echo "Installing Urutau Icons..."
sudo git clone https://github.com/btd1337/urutau-icons /usr/share/icons/urutau-icons
fi
gsettings set org.gnome.desktop.interface icon-theme "urutau-icons"
fi
# Install Elementary x
if [[ $opt == *"Install Elementary X"* ]]
then
installPackage git
directory=/usr/share/themes/elementary-x
if [ -d "$directory" ]; #Verifying if directory exists
then
echo "The theme already installed. They will be updated now..."
cd /usr/share/
sudo git pull
else
echo "Installing elementary-x Theme..."
sudo git clone https://github.com/surajmandalcell/elementary-x.git /usr/share/themes/elementary-x
fi
gsettings set org.gnome.desktop.interface gtk-theme 'elementary-x'
echo "For enable minimize button, install Elementary Tweaks. After go to System Settings > Elementary Tweaks > Button Layout: OS X and enjoy..."
fi
# Install Support for Archive Formats Action
if [[ $opt == *"Install Support for Archive Formats"* ]]
then
echo "Installing Support for Archive Formats"
installPackage zip
installPackage unzip
installPackage p7zip
installPackage p7zip-rar
installPackage rar
installPackage unrar
fi
# Fix keyboard accents
if [[ $opt == *"Fix keyboard accents on latin keyboard"* ]]
then
echo "Setting up ibus daemon..."
if !(test -e ~/.xprofile); then
touch ~/.xprofile
fi
if (cat ~/.xprofile | grep "ibus">/dev/null); then
echo "ibus-daemon already start up on login"
else
echo "ibus-daemon -drx" >> ~/.xprofile
fi
fi
# Add Oibaf Repository
if [[ $opt == *"Add Oibaf Repository"* ]]
then
# echo "Adding Oibaf Repository and updating..."
addRepository ppa:oibaf/graphics-drivers
# sudo apt -y full-upgrade
ppa_error_msg "Oibaf"
fi
# Install Gufw Firewall Action
if [[ $opt == *"Install Gufw Firewall"* ]]
then
echo "Installing Gufw Firewall..."
installPackage gufw
fi
# Install Notes-up
if [[ $opt == *"Install Notes-up"* ]]
then
echo "Installing Notes-up..."
addRepository ppa:philip.scott/notes-up
installPackage notes-up
ppa_error_msg "Notes-up"
fi
# Install Startup Disk Creator
if [[ $opt == *"Install Startup Disk Creator"* ]]
then
echo "Installing Startup Disk Creator"
installPackage usb-creator-gtk
fi
# Install GDebi Action
if [[ $opt == *"Install GDebi"* ]]
then
echo "Installing GDebi..."
installPackage gdebi
fi
# Install Google Chrome Action
if [[ $opt == *"Install Google Chrome"* ]]
then
echo "Installing Google Chrome..."
wget -O /tmp/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb
fi
# Install Chromium
if [[ $opt == *"Install Chromium"* ]]
then
echo "Installing Chromium..."
installPackage chromium-browser
fi
# Install Opera
if [[ $opt == *"Install Opera"* ]]
then
echo "Installing Opera..."
sudo add-apt-repository 'deb https://deb.opera.com/opera-stable/ stable non-free' -y
wget -qO- https://deb.opera.com/archive.key | sudo apt-key add -
sudo apt update
installPackage opera-stable
fi
# Install Firefox Action
if [[ $opt == *"Install Firefox"* ]]
then
echo "Installing Firefox..."
installPackage firefox
fi
# Install Thunderbird Action
if [[ $opt == *"Replace Pantheon Mail by the Thunderbird Mail"* ]]
then
echo "Removing Pantheon Mail..."
sudo apt --purge remove -y pantheon-mail
echo "Installing Thunderbird..."
installPackage thunderbird
fi
# Install Skype Action
if [[ $opt == *"Install Skype"* ]]
then
echo "Installing Skype..."
if [[ $(uname -m) == "i686" ]]
then
wget -O /tmp/skype.deb https://download.skype.com/linux/skype-ubuntu-precise_4.3.0.37-1_i386.deb
elif [[ $(uname -m) == "x86_64" ]]
then
wget -O /tmp/skype.deb https://go.skype.com/skypeforlinux-64-alpha.deb
fi
sudo dpkg -i /tmp/skype.deb
sudo apt -f install -y
fi
# Install Dropbox Action
if [[ $opt == *"Install Dropbox"* ]]
then
echo "Installing Drobox..."
installPackage git
sudo apt --purge remove -y dropbox*
installPackage python-gpgme
git clone https://github.com/zant95/elementary-dropbox /tmp/elementary-dropbox
sudo bash /tmp/elementary-dropbox/install.sh
fi
# Install Liferea Action
if [[ $opt == *"Install Liferea"* ]]
then
echo "Installing Liferea..."
installPackage liferea
fi
# Install Go For It!
if [[ $opt == *"Install Go For It!"* ]]
then
echo "Installing Go For It!..."
addRepository ppa:go-for-it-team/go-for-it-daily
installPackage go-for-it
ppa_error_msg "Go for it"
fi
# Install Klavaro Action
if [[ $opt == *"Install Klavaro"* ]]
then
echo "Installing Klavaro..."
installPackage klavaro
fi
# Install VLC Action
if [[ $opt == *"Install VLC"* ]]
then
echo "Installing VLC..."
installPackage vlc
fi
# Install Clementine Action
if [[ $opt == *"Install Clementine Music Player"* ]]
then
echo "Installing Clementine Music Player..."
installPackage clementine
fi
# Install Gimp Action
if [[ $opt == *"Install Gimp"* ]]
then
echo "Installing Gimp Image Editor..."
installPackage gimp
fi
# Install Deluge Action
if [[ $opt == *"Install Deluge"* ]]
then
echo "Installing Deluge..."
installPackage deluge
fi
# Install Transmission Action
if [[ $opt == *"Install Transmission"* ]]
then
echo "Installing Transmission..."
installPackage transmission
fi
# Install Atom Action
if [[ $opt == *"Install Atom"* ]]
then
echo "Installing Atom..."
addRepository ppa:webupd8team/atom
installPackage atom
ppa_error_msg "Atom"
fi
# Install Sublime Text 3 Action
if [[ $opt == *"Install Sublime Text 3"* ]]
then
echo "Installing Sublime Text 3..."
addRepository ppa:webupd8team/sublime-text-3
installPackage sublime-text-installer
ppa_error_msg "Sublime Text 3"
fi
# Install LibreOffice Action
if [[ $opt == *"Install LibreOffice"* ]]
then
echo "Installing LibreOffice..."
installPackage libreoffice
fi
# Install WPS Office
if [[ $opt == *"Install WPS Office"* ]]
then
echo "Installing WPS Office..."
if [[ $(uname -m) == "i686" ]]
then
wget -O /tmp/wps-office_10.1.0.5672~a21_i386.deb http://kdl1.cache.wps.com/ksodl/download/linux/a21//wps-office_10.1.0.5707~a21_i386.deb
sudo dpkg -i /tmp/wps-office_10.1.0.5672~a21_i386.deb
elif [[ $(uname -m) == "x86_64" ]]
then
wget -O /tmp/wps-office_10.1.0.5672~a21_amd64.deb http://kdl1.cache.wps.com/ksodl/download/linux/a21//wps-office_10.1.0.5707~a21_amd64.deb
sudo dpkg -i /tmp/wps-office_10.1.0.5672~a21_amd64.deb
fi
#Fonts, Interface Translate, Dictionary
wget -O /tmp/wps-office-fonts_1.0_all.deb http://kdl.cc.ksosoft.com/wps-community/download/fonts/wps-office-fonts_1.0_all.deb
wget -O /tmp/wps-office-ul_10.1.0.5503-0kaiana05052016_all.deb http://repo.uniaolivre.com/packages/xenial/wps-office-ul_10.1.0.5503-0kaiana05052016_all.deb
wget -O /tmp/wps-office-language-all_0.1_all.deb https://doc-0k-5g-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/vmsics07sveefmft458910ml3prvahpt/1480881600000/05316569172087402966/*/0B7HGeEB4kyvMaU5SbkdRRjBYWHc?e=download
sudo dpkg -i /tmp/wps-office-fonts_1.0_all.deb
sudo dpkg -i /tmp/wps-office-ul_10.1.0.5503-0kaiana05052016_all.deb
sudo dpkg -i /tmp/wps-office-language-all_0.1_all.deb
fi
# Install TLP
if [[ $opt == *"Install TLP"* ]]
then
echo "Installing TLP..."
sudo apt --purge remove -y laptop-mode-tools #Avoid conflict with TLP
installPackage tlp
installPackage tlp-rdw
fi
# Install Redshift Action
if [[ $opt == *"Install Redshift"* ]]
then
echo "Installing Redshift..."
installPackage redshift-gtk
fi
# Install Gnome Disk Utility Action
if [[ $opt == *"Install Disk Utility"* ]]
then
echo "Installing Gnome Disk Utility..."
installPackage gnome-disk-utility
fi
# Install Brasero Action
if [[ $opt == *"Install Brasero"* ]]
then
echo "Installing Brasero..."
installPackage brasero
fi
# Install Spotify Action
if [[ $opt == *"Install Spotify"* ]]
then
echo "Installing Spotify..."
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update
installPackage spotify-client
fi
# Install Ubuntu Restricted Extras Action
if [[ $opt == *"Install Ubuntu Restricted Extras"* ]]
then
echo "Installing Ubuntu Restricted Extras..."
installPackage ubuntu-restricted-extras
fi
# Fix Broken Packages Action
if [[ $opt == *"Fix Broken Packages"* ]]
then
echo "Fixing the broken packages..."
sudo apt -y -f install
fi
# Clean-Up Junk Action
if [[ $opt == *"Clean-Up Junk"* ]]
then
echo "Cleaning-up junk..."
sudo apt -y autoremove
sudo apt -y autoclean
fi
}
main