-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunscript
More file actions
executable file
·553 lines (402 loc) · 12.6 KB
/
runscript
File metadata and controls
executable file
·553 lines (402 loc) · 12.6 KB
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
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
#!/bin/bash
clear
##
# Runscript 21.01 64-bit
#
# For *Ubuntu 21.01 64-bit
#
# Based on softman 1.0.1
#
# Lead Author: Lee Hodson
#
# This Release: 25th Sep 2021
# First Written: 21st Jan. 2016
# First Release: 21st Jan. 2016
#
# Website: https://github.com/VR51/Ubuntu-Runscript
# Donate: paypal.me/vr51
#
# Copyright 2016 Lee Hodson
#
# License: GPL3
#
# Use of this program is at your own risk
#
# TO RUN:
#
# - Ensure the script is executable.
# - Command line: ./runscript OR bash ./runscript
# - File browser: click runscript
#
# Interactive software installer to add a set of useful packages to Ubuntu and Kubuntu distros, including KDE Neon.
# Installs repositories and software as detailed below. Useful for initialising a cleanly installed OS.
#
# Runscript will prompt for confirmation before any repos or software are installed. First the repository installer prompt then the software installed prompt for each package set.
# This double opt-in prompt allows time to reconsider the first response or to choose to add the repos then add the software later.
#
# This is for 64 bit systems.
#
# Software and repositories for optional install:
#
# BASIC:
#
# Backports (additional Ubuntu software repository)
# y-ppa-manager (PPA software installer)
# vlc (multimedia player & streamer)
# gimp (latest) (graphics app)
# krita (latest) (graphics app)
# google-chrome-stable (web browser)
# brave (web browser)
# opera (web browser)
# webcamstudio (web camera management)
# openshot-qt (screenshot tool)
# simplescreenrecorder (screen recorder)
# virtualbox (environment for virtual OS management)
# LyX (advanced text editor)
#
# MAME:
#
# MAME (home computer, console and arcade emulator)
# QMC2 (software manager for MAME)
# More info at https://journalxtra.com/gaming/download-complete-sets-of-mess-and-mame-roms/
#
# SERVER
#
# apache2
# php7.4
# php7.4-mysql (for MariaDB)
# php8*
# + other PHP7 modules
# mariadb-server 10.6
# phpmyadmin
# Webmin
# Mod_Pagespeed
#
# You will need to configure Apache modules through either terminal or Webmin after installation has completed.
#
# Functions in here: runscript_run runscript_prompt runscript_repos runscript_manual softman softman_message runscript_launch
###
version='Runscript 19.10 64-bit'
declare -ga what
# NOTES: Full install size is around 12 GB. Takes approx. 1 hour to install into non-SSD VM.
basicPackage=( software-properties-common y-ppa-manager vlc gimp krita google-chrome-stable brave opera-stable lyx virtualbox-6 dkms openshot-qt simplescreenrecorder gcc make perl python libnet-ssleay-perl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions dirmngr apt-transport-https lsb-release )
mamePackage=( mame mame-data qmc2-sdlmame qmc2-arcade qmc2-data qchdman )
serverPackage=( apache2 php7.4 php7.4-common php7.4-mysql mariadb-server phpmyadmin openssl php7.4-bcmath php7.4-json php7.4-mbstring php7.4-xsl php7.4-bz2 php7.4-curl php7.4-enchant php7.4-gmp php7.4-imap php7.4-interbase php7.4-ldap php7.4-mcrypt php7.4-odbc php7.4-pspell php7.4-readline php7.4-recode php7.4-soap php7.4-tidy php7.4-zip php7.4-dba php7.4-gd php7.4-opcache php7.4-snmp php7.4-xml php7.4-cli php7.4-phpdbg php7.4-fpm php8* )
## Receive script arguments and process them -- See 'run' at bottom of script
function runscript_run() {
## Open shell if not already running in one
tty -s
if test "$?" -ne 0 ; then
runscript_launch
fi
## Prompt for repositories and files to install
printf "INSTALL REPOSITORIES\n\n"
runscript_prompt "Install basic repos?" "basicRepo"
runscript_prompt "Install MAME repos?" "mameRepo"
runscript_prompt "Install web server repos?" "serverRepo"
printf "\nINSTALL SOFTWARE\n\n"
runscript_prompt "Install basic software?" "basicPackage"
runscript_prompt "Install MAME software?" "mamePackage"
runscript_prompt "Install server software?" "serverPackage"
runscript_prompt "Install Webmin server admin panel?" "webminManual"
runscript_prompt "Install Mod_Pagespeed for Apache2?" "pagespeedManual"
printf "\nUPGRADDE & CLEAN\n\n"
runscript_prompt "Do a final upgrade and clean to finish?" "finish"
# declare -p what # debug
## Install requested items
n=0
o=${#what[@]}
while [ "$n" -lt "$o" ]
do
if echo "${what[$n]}" | grep -iq 'repo'
then
runscript_repos "${what[$n]}"
# echo ${what[$n]} # debug
unset what[$n]
let n=n+1
fi
if echo "${what[$n]}" | grep -iq 'package'
then
package="${what[$n]}" # Get the value @ $n e.g. serverPackage
package=$package[*] # Get the value of ${serverPackage[@]} using indirect substitution.
package=${!package}
# Rebuild the array
# for i in "$package"
# do
# newpackage+=( $i )
# done
apt-get update
softman upgrade
softman install "$package"
# echo ${what[$n]} # debug
# echo "${!package}" # debug
unset what[$n]
let n=n+1
fi
if echo "${what[$n]}" | grep -iq 'manual'
then
runscript_manual "${what[$n]}"
# echo ${what[$n]} # debug
unset what[$n]
let n=n+1
fi
if echo "${what[$n]}" | grep -iq 'finish'
then
softman launch
# echo ${what[$n]} # debug
unset what[$n]
let n=n+1
fi
if echo "${what[$n]}" | grep -iq '^n$'
then
unset what[$n]
let n=n+1
fi
done
echo "All done. Restart system when ready. Press a key to close script."
read something
exit
}
function runscript_prompt() {
bold=$(tput bold)
normal=$(tput sgr0)
while true; do
read -r -n 1 -p "${1:-Continue?} [y/n]: " REPLY
case $REPLY in
[yY])
what+=( "$2" )
printf "\n"
return 0
;;
[nN])
what+=( 'n' )
printf "\n"
return 1
;;
*)
printf "${bold} %s ${normal}" "Answer ${bold}y${normal} to proceed or ${bold}n${normal}.\n"
esac
done
}
function runscript_repos() {
###
# Install repositories and GPG keys
###
case $1 in
basicRepo)
## Kubuntu Backports
apt-add-repository ppa:kubuntu-ppa/ppa
add-apt-repository ppa:kubuntu-ppa/backports
## VirtualBox
sh -c 'echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian hirsute contrib" >> /etc/apt/sources.list.d/virtualbox.list'
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
## Google Chrome
wget -q https://dl-ssl.google.com/linux/linux_signing_key.pub -O- | apt-key add -
sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
## Brave Web Browser
curl https://s3-us-west-2.amazonaws.com/brave-apt/keys.asc | sudo apt-key add -
echo "deb [arch=amd64] https://s3-us-west-2.amazonaws.com/brave-apt `lsb_release -sc` main" | sudo tee -a /etc/apt/sources.list.d/brave-`lsb_release -sc`.list
## Opera Stable
add-apt-repository 'deb https://deb.opera.com/opera-stable/ stable non-free'
wget -qO- https://deb.opera.com/archive.key | sudo apt-key add -
## Gimp
# Beta versions
add-apt-repository ppa:otto-kesselgulasch/gimp-edge
## Krita
# https://krita.org/download/krita-desktop/
add-apt-repository ppa:kritalime/ppa
## Web Update YPPA Manager
add-apt-repository ppa:webupd8team/y-ppa-manager
## Openshot Video Editor
add-apt-repository ppa:openshot.developers/ppa
## Simple Screen Recorder
add-apt-repository ppa:maarten-baert/simplescreenrecorder
## Lyx
add-apt-repository ppa:lyx-devel/release
;;
mameRepo)
## MAME (this is now MAME and MESS together)
add-apt-repository ppa:c.falco/mame
## QMC2 MAME GUI/Frontend
add-apt-repository ppa:mmbossoni-gmail/emu
;;
serverRepo)
## Web Server
apt-add-repository ppa:ondrej/apache2
apt-add-repository ppa:ondrej/php
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64] https://mirrors.xtom.nl/mariadb/repo/10.6/ubuntu hirsute main'
## PhpMyAdmin
add-apt-repository ppa:phpmyadmin/ppa
;;
esac
}
function runscript_manual() {
case $1 in
webminManual)
## Install Webmin
# PPA is still on 'sarge' so we download and install the .deb package. Update Webmin from within Webmin.
# See http://www.webmin.com/deb.html
softman install apt-show-versions libauthen-pam-perl
wget https://prdownloads.sourceforge.net/webadmin/webmin_1.981_all.deb
dpkg --install webmin_1.981_all.deb
rm webmin_1.981_all.deb
;;
pagespeedManual)
## Mod_Pagespeed
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
dpkg -i mod-pagespeed-*.deb
apt-get -f install
rm mod-pagespeed-*.deb
;;
esac
}
##
# SOFTMAN
##
## Run softman
function softman() {
##
#
# Softman 1.0.0
#
# Install or reinstall packages with build dependencies.
# Update system
# Build binaries from source
#
# Written to solve a Linux World problem
#
# softman arg args
#
# @1 = install,upgrade,reinstall,flush,build,findbad,fixbad,rebuildsystem:
# are we to install, reinstall or upgrade packages;
# are we to compile a .deb from source;
# are we to clean the cache;
# are we to find and/or fix installed packages that are corrupted;
# are we to find and/or reinstall packages with missing files;
# are we to re-install every package with rebuildsystem?
# @2 = list of packages to (re)install: space separated list of packages.
#
# Copyright Lee Hodson @ VR51 & JournalXtra
#
#
# EXAMPLE USAGE
#
# softman install 'simplescreenrecorder gimp vlc'
# softman reinstall 'simplescreenrecorder gimp vlc'
#
##
options='--install-suggests --show-progress'
_options='--install-suggests'
case $1 in
launch)
sudo apt-get update
sudo apt-get $options upgrade
sudo apt-get $options dist-upgrade
sudo apt-get $options full-upgrade
sudo apt-get clean
sudo apt-get autoremove
softman_message 'upgrade'
read something
;;
upgrade)
apt-get $options upgrade
apt-get $options dist-upgrade
apt-get $options full-upgrade
;;
install)
for i in ${2}; do
apt-get $_options build-dep "$i"
apt-get $options install "$i"
done
;;
reinstall)
for i in ${2}; do
apt-get $_options build-dep "$i"
apt-get install $options --reinstall "$i"
done
;;
findbad)
if command -v debsums > /dev/null 2>&1; then
apt-get clean
debsums_init ; debsums -cs
# debsums -es
else
softman install debsums
softman findbad
fi
;;
fixbad)
if command -v debsums > /dev/null 2>&1; then
apt-get clean
apt-get install $options --reinstall $(dpkg -S $(debsums -c) | cut -d : -f 1 | sort -u)
else
softman install debsums
softman fixbad
# debsums -es
fi
;;
fixmissing)
if command -v debsums > /dev/null 2>&1; then
apt-get clean
debsums -c 2>&1 | cut -d " " -f 4 | sort -u | xargs -rd '\n' -- dpkg -S | cut -d : -f 1 | sort -u | xargs -rd '\n' -- apt-get install $options --reinstall
else
softman install debsums
softman fixmissing
fi
;;
rebuildsystem)
dpkg -l | grep '^ii ' | sed 's/ */\t/g' |cut -f 2,3 | sed 's/\t/=/' | xargs apt-get install --reinstall -y --ignore-missing
# See: http://unix.stackexchange.com/questions/79028/debian-install-missing-man-pages
;;
build)
for i in ${2}; do
apt-get $options --compile source "$i"
done
;;
flush)
apt-get clean
apt-get autoremove
;;
*)
return 2
;;
esac
softman_message "$arg"
}
## Message
function softman_message() {
printf "\n\nsoftman service completed: $arg\n"
}
##
# SOFTMAN END
##
## launch terminal
function runscript_launch() {
# This code section is released in public domain by Han Boetes <han@mijncomputer.nl>
# Updated by Dave Davenport <qball@gmpclient.org>
# Updated by Lee Hodson <https://journalxtra.com> - Added break on successful hit, added more terminals, humanized the failure message, replaced call to rofi with printf and made $terminal an array for easy reuse.
#
# This script tries to exec a terminal emulator by trying some known terminal
# emulators.
#
# We welcome patches that add distribution-specific mechanisms to find the
# preferred terminal emulator. On Debian, there is the x-terminal-emulator
# symlink for example.
terminal=( konsole gnome-terminal x-terminal-emulator xdg-terminal terminator urxvt rxvt Eterm aterm roxterm xfce4-terminal termite lxterminal xterm )
for i in ${terminal[@]}; do
if command -v $i > /dev/null 2>&1; then
exec $i -e "$0"
break
else
printf "\nUnable to determine the correct terminal program to run e.g gnome-terminal or konsole. Rerun this program within a terminal.\n"
read something
exit 1
fi
done
}
## Boot
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
runscript_run "$@"
# Exit is at end of runscript_run()