-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux_setup.sh
executable file
·612 lines (529 loc) · 24.2 KB
/
linux_setup.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
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
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
#!/usr/bin/env bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename "$0")"
VERSION="031220211542-git"
USER="${SUDO_USER:-${USER}}"
HOME="${USER_HOME:-${HOME}}"
SRC_DIR="${BASH_SOURCE%/*}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#set opts
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 031220211542-git
# @Author : Jason Hempstead
# @Contact : [email protected]
# @License : LICENSE.md
# @ReadME : template --help
# @Copyright : Copyright: (c) 2021 Jason Hempstead, CasjaysDev
# @Created : Friday, Apr 02, 2021 13:11 EDT
# @File : template
# @Description : Linux setup script
# @TODO : Refactor the code
# @Other :
# @Resource :
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin
#Modify and set if using the auth token
AUTHTOKEN=""
# either http https or git
GITPROTO="https://"
#Your git repo
GITREPO="github.com/casjay-systems/linux"
# Git Command - Private Repo
#GITURL="$GITPROTO$AUTHTOKEN:x-oauth-basic@$GITREPO"
#Public Repo
GITURL="$GITPROTO$GITREPO"
# Default NTP Server
NTPSERVER="0.casjay.pool.ntp.org"
# Set the temp directory
DOTTEMP="/tmp/dotfiles-desktop-$USER"
# Default dotfiles dir
# Set primary dir - not used
DOTFILES="$HOME/.local/dotfiles/linux"
SUDO_PROMPT="$(printf "\033[1;36m") • [sudo]$(printf "\033[0m") password for %p: "
dotfilesDirectory="$DOTFILES"
srcdir="$dotfilesDirectory/src"
linuxosdir="$srcdir/os/linux"
backupsdir="$HOME/.local/backups/dotfiles/linux"
export DOTFILES DOTTEMP dotfilesDirectory srcdir linuxosdir backupsdir SUDO_PROMPT
##################################################################################################
# Define colors
PURPLE='\033[0;35m'
BLUE='\033[0;34m'
RED='\033[0;31m'
GREEN='\033[32m'
YELLOW='\033[0;33m'
NC='\033[0m'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [[ ! "$OSTYPE" =~ ^linux ]]; then
printf "\n\t\t${RED} This script is for Linux ${NC}\n\n"
exit 1
fi
# Grab the OS detection script if it doesn't exist script
if [ -f "$srcdir/os/osdetect.sh" ] && [ -f "$srcdir/os/utils.sh" ]; then
source "$srcdir/os/utils.sh"
source "$srcdir/os/osdetect.sh"
else
curl -Lsq "https://$GITREPO/raw/main/src/os/utils.sh" -o /tmp/utils.sh
curl -Lsq "https://$GITREPO/raw/main/src/os/osdetect.sh" -o /tmp/osdetect.sh
if [ -f "/tmp/osdetect.sh" ] && [ -f "/tmp/utils.sh" ]; then
source /tmp/utils.sh
source /tmp/osdetect.sh
rm -Rf /tmp/utils.sh /tmp/osdetect.sh
else
clear
printf "\n\n\n\n${BLUE} Could not source the files needed${NC}\n\n\n\n"
exit 1
fi
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [[ "$(python3 -V 2>/dev/null)" =~ "Python 3" ]]; then
PYTHONVER="python3"
PIP="pip3"
export PATH="${PATH}:$(python3 -c 'import site; print(site.USER_BASE)')/bin"
elif [[ "$(python2 -V 2>/dev/null)" =~ "Python 2" ]]; then
PYTHONVER="python"
PIP="pip"
export PATH="${PATH}:$(python -c 'import site; print(site.USER_BASE)')/bin"
fi
##################################################################################################
if [ -f "$HOME/.config/dotfiles/env" ]; then
source "$HOME/.config/dotfiles/env"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Automatic linux install
###############################################################################################
clear #
printf "\n\n\n\n\n${BLUE} *** Initializing the installer please wait *** ${NC}\n" #
###############################################################################################
if (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null; then
printf "\n${RED} • Getting root privileges •${NC}\n" &&
ask_for_sudo
if [ "$?" -eq 0 ]; then
printf "${GREEN} • Received root privileges •${NC}\n\n"
else
printf "${GREEN} • Can not get access to sudo •${NC}\n\n"
exit 1
fi
else
printf "${GREEN} • Can not get access to sudo •${NC}\n\n"
exit 1
fi
# Remove previous installs
if [ ! -d "$DOTFILES/.git" ]; then
rm -Rf "$DOTFILES"
fi
if [ -d $HOME/.config/bash/profile ]; then rm -Rf $HOME/.config/bash/profile/zz-*; fi
if [ ! -d "$HOME/.config/dotfiles/backups/configs" ]; then mkdir -p "$HOME/.config/dotfiles/backups/configs"; fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -z $UPDATE ]; then
if (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null; then
#Define the package manager and install option
if [ -f /usr/bin/apt ]; then
LSBPAC=lsb-release
pkgmgr="DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --ignore-missing --allow-unauthenticated --assume-yes"
instoption="-yy -qq install"
instupdateoption="update && sudo $pkgmgr dist-upgrade -yy -qq"
instchkupdatecmd="$(sudo apt-get update >/dev/null && apt-get --just-print upgrade | grep "Inst " | wc -l)"
##
elif [ -f /usr/bin/yum ]; then
LSBPAC=redhat-lsb
pkgmgr="yum"
instoption="install -y -q"
instupdateoption="install -y -q --skip-broken"
instchkupdatecmd="$(sudo yum check-update -q | grep -v Security | wc -l)"
##
elif [ -f /usr/bin/dnf ]; then
LSBPAC=redhat-lsb
pkgmgr="dnf"
instoption="install -y -q --skip-broken"
instupdateoption="update -y -q"
instchkupdatecmd="$(sudo dnf check-update -q | grep -v Security | wc -l)"
##
elif [ -f /usr/bin/pacman ]; then
LSBPAC=lsb-release
pkgmgr="pacman"
instoption="-Syy --needed --noconfirm"
instupdateoption="--Syyu --noconfirm"
instchkupdatecmd="$(checkupdates 2>/dev/null | wc -l)"
fi
if [[ "$instchkupdatecmd" != 0 ]]; then
printf "\n${RED} *** Please update your system before runng this installer ***${NC}\n"
printf "\n${RED} *** You have $instchkupdatecmd update available ***${NC}\n\n\n\n"
exit 1
fi
fi
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Welcome message
wait_time=10 # seconds
temp_cnt=${wait_time}
printf "\n\n\n${GREEN} *** ${RED}•${GREEN} Welcome to my dotfiles Installer for linux ${RED}•${GREEN} ***${NC}\n"
printf "${YELLOW} *** • Your Distro is $distroname and is based on $DISTRO • ***${NC}\n\n\n"
while [[ ${temp_cnt} -gt 0 ]]; do
printf "\r${GREEN} *** ${RED}•${GREEN} You have %2d second(s) remaining to hit Ctrl+C to cancel ${RED}•${GREEN} ***" ${temp_cnt}
sleep 1
((temp_cnt--))
done
printf "${NC}\n\n\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### for when I'm forgetful
if [ -z $dotfilesDirectory ]; then printf "\n${RED} *** dotfiles directory not specified ***${NC}\n"; fi
if [ -z $srcdir ]; then printf "\n${RED} *** dotfiles src directory not specified ***${NC}\n"; fi
if [ -z $linuxosdir ]; then printf "\n${RED} *** dotfiles linuxos directory not specified ***${NC}\n"; fi
#####
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GIT=$(command -v git 2>/dev/null)
CURL=$(command -v curl 2>/dev/null)
WGET=$(command -v wget 2>/dev/null)
VIM=$(command -v vim 2>/dev/null)
TMUX=$(command -v tmux 2>/dev/null)
ZSH=$(command -v zsh 2>/dev/null)
FISH=$(command -v fish 2>/dev/null)
SUDO=$(command -v sudo 2>/dev/null)
LSBR=$(command -v lsb_release 2>/dev/null)
POLYBAR=$(command -v polybar 2>/dev/null)
JGMENU=$(command -v jgmenu 2>/dev/null)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# no sudo can't continue
if ! (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null; then
if [[ -z "$SUDU" ]] && [[ -z "$UPDATE" ]]; then
printf "\n${GREEN} *** ${RED}•${GREEN} UPDATE=yes bash -c "$(curl -LsS https://$GITREPO/raw/main/src/os/setup.sh)" ${RED}•${GREEN} ***${NC}\n"
printf "\n${GREEN} *** ${RED}•${GREEN} to install just the dotfiles ${RED}•${GREEN} ***${NC}\n"
printf "\n${RED} *** ${RED}•${GREEN} No sudo or root privileges ${RED}•${GREEN} ***${NC}\n\n"
exit
fi
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -z "$UPDATE" ]; then
if ! (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null && [ -z "$POLYBAR" ]; then
printf "
${RED}\n • Please run one of the following commands as root:${NC}
${GREEN}if running Arch you can just do${RED} su -c $srcdir/os/linux/pkgs/lists/arch.sh${NC}
${GREEN}if running Centos you can just do${RED} su -c $srcdir/os/linux/pkgs/lists/rhel.sh${NC}
${GREEN}if running Debian you can just do${RED} su -c $srcdir/os/linux/pkgs/lists/debian-sys.sh${NC}
${GREEN}if running Fedora you can just do${RED} su -c $srcdir/os/linux/pkgs/lists/fedora-sys.sh${NC}
${GREEN}if running Ubuntu you can just do${RED} su -c $srcdir/os/linux/pkgs/lists/ubuntu-sys.sh${NC}
${GREEN}if running Raspbian you can just do${RED} su -c $srcdir/os/linux/pkgs/lists/raspbian-sys.sh${NC}
\n${RED}then come back to this installer ${NC}\n\n"
exit
fi
fi
# Lets check for git, curl, wget
unset MISSING
if [[ ! "$GIT" ]]; then MISSING="$MISSING git"; fi
if [[ ! "$CURL" ]]; then MISSING="$MISSING curl"; fi
if [[ ! "$WGET" ]]; then MISSING="$MISSING wget"; fi
if [[ ! "$VIM" ]]; then MISSING="$MISSING vim"; fi
if [[ ! "$TMUX" ]]; then MISSING="$MISSING tmux"; fi
if [[ ! "$ZSH" ]]; then MISSING="$MISSING zsh"; fi
if [[ ! "$FISH" ]]; then MISSING="$MISSING fish"; fi
if [[ ! "$SUDO" ]]; then MISSING="$MISSING sudo"; fi
if [[ ! "$LSBR" ]]; then MISSING="$MISSING $LSBPAC"; fi
if [ -z "$LSBR" ] || [ -z "$GIT" ] || [ -z "$CURL" ] || [ -z "$WGET" ] || [ -z "$VIM" ] || [ -z "$TMUX" ] || [ -z "$ZSH" ] || [ -z "$FISH" ] || [ -z "$SUDO" ]; then
printf "${RED} *** • The following are needed: • ***${NC}\n"
printf "${RED} *** • ${MISSING} • ***${NC}\n"
if (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null; then
execute "sudo $pkgmgr $instoption ${MISSING}" " *** • Attempting to install the missing package[s] • ***"
else
printf "${RED} *** • I can't get root access You will have to manually install the missing programs • ***${NC}\n"
printf "${RED} *** • ${MISSING} • ***${NC}\n\n\n"
exit
fi
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Set version from git
CURDOTFVERSION="$(curl -LSsq "https://$GITREPO/raw/main/version.txt" | grep -v "#" | head)"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Print info
printf "\n${GREEN} *** • git, curl, wget, vim, tmux, zsh, fish, sudo are present • ***${NC}\n\n"
printf "${GREEN} *** • Installing version $CURDOTFVERSION • ***${NC}\n\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setup the dotfiles Directory
if [ -d "$dotfilesDirectory/.git" ]; then
printf "\n${PURPLE} • Updating the git repo - $dotfilesDirectory${NC}\n"
cd "$srcdir/os" && source "utils.sh"
execute \
"git -C $dotfilesDirectory reset --hard -q >/dev/null && \
git -C $dotfilesDirectory pull --recurse-submodules -q" \
"Updating dotfiles"
NEWVERSION="$(cat "$DOTFILES/version.txt" | tail -n 1)"
REVER="$(cd $dotfilesDirectory && git rev-parse --short HEAD)"
printf "${GREEN} [✔] Updated to $NEWVERSION - revision: $REVER${NC}\n"
printf "${PURPLE} • Updating the git repo completed${NC}\n\n"
else
printf "\n${PURPLE} • Cloning the git repo - $dotfilesDirectory${NC}\n"
rm -Rf $dotfilesDirectory
git clone --recursive -q $GITURL $dotfilesDirectory >/dev/null 2>&1
printf "${GREEN} [✔] cloned $GITURL → $dotfilesDirectory \n"
NEWVERSION="$(cat "$DOTFILES/version.txt" | tail -n 1)"
REVER="$(cd $dotfilesDirectory && git rev-parse --short HEAD)"
printf "${GREEN} [✔] downloaded version $NEWVERSION - revision: $REVER${NC}\n"
cd "$srcdir/os" && source "utils.sh"
printf "${PURPLE} • Cloning the git repo completed${NC}\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Make Directories and fix permissions
mkdir -p ~/.gnupg ~/.ssh 2>/dev/null
find "$HOME" -xtype l -delete 2>/dev/null
find ~/.gnupg ~/.ssh -type f -exec chmod 600 {} \; 2>/dev/null
find ~/.gnupg ~/.ssh -type d -exec chmod 700 {} \; 2>/dev/null
find "$dotfilesDirectory/" -iname "*.sh" -exec chmod 755 {} \; 2>/dev/null
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Check for then get root permissions
if [ -z "$UPDATE" ] || [ "$1" = "--force" ]; then
if (sudo true && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null; then
printf "\n${RED} • Getting root privileges${NC}\n"
ask_for_sudo
printf "${GREEN} • Received root privileges${NC}\n\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Install Packages
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# MacOS setup
printf "\n${PURPLE} • Setting up for ${DISTRO} $(get_os_version) ${NC}\n"
source "$linuxosdir/install_packages.sh"
printf "\n${PURPLE} • Done Setting up for the ${DISTRO}${NC}\n\n"
fi
fi
###################################################################
# grab the modules
printf "\n${PURPLE} *** • Downloading additional configuration files • ***${NC}\n"
if (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null; then
systemmgr_inst() {
sudo bash -c "$(curl -LSs https://github.com/systemmgr/installer/raw/main/install.sh)" >/dev/null 2>&1 &&
systemmgr install installer >/dev/null 2>&1
}
if [ -z "$(command -v systemmgr 2>/dev/null)" ]; then
execute "systemmgr_inst" "installing system scripts"
else
execute "systemmgr_inst" "Updating system scripts"
fi
fi
for config in bash geany git htop neofetch fish tmux terminology Thunar transmission variety vifm vim zsh; do
if [ -d "$dotfilesDirectory/src/config/$config/.git" ]; then
execute \
"git -C $dotfilesDirectory/src/config/$config reset --hard -q && \
git -C $dotfilesDirectory/src/config/$config pull -q" \
"Updating $config module"
else
rm -Rf "$dotfilesDirectory/src/config/$config"
execute \
"git clone -q https://github.com/dfmgr/$config $dotfilesDirectory/src/config/$config" \
"Installing $config module"
fi
done
printf "${PURPLE} *** • Downloading additional configuration files completed • ***${NC}\n\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Install additional system files if root
if (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null; then
print_in_purple "\n • Installing system files\n"
sudo bash -c "$linuxosdir/install_system_files.sh"
print_in_purple " • Installing system files completed\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create user directories
print_in_purple "\n • Creating directories\n"
bash -c $linuxosdir/create_directories.sh
print_in_purple " • Creating directories completed\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create user .local files
print_in_purple "\n • Create local config files\n"
bash -c $linuxosdir/create_local_config_files.sh
print_in_purple " • Create local config files completed\n\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create user dotfile symlinks
print_in_purple "\n • Backing up and creating user files\n"
bash -c $linuxosdir/create_symbolic_links.sh
print_in_purple " • Create user files completed\n\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create user themes/fonts/icons or install to system if root
print_in_purple "\n • Installing Customizations\n"
bash -c $linuxosdir/install_customizations.sh
print_in_purple " • Installing Customizations completed\n\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create and Setup git
GIT=$(which git 2>/dev/null)
if [ -z "$GIT" ]; then print_in_red "\n • The git package is not installed\n\n"; else
print_in_purple "\n • Installing GIT\n"
bash -c $linuxosdir/install_git.sh
print_in_purple " • Installing GIT completed\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create and Setup vim
VIM=$(which vim 2>/dev/null)
if [ -z "$VIM" ]; then print_in_red "\n • The vim package is not installed\n\n"; else
print_in_purple "\n • Installing vim with plugins\n"
bash -c $linuxosdir/install_vim.sh
print_in_purple " • Installing vim with plugins completed\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create and Setup tmux
TMUX=$(which tmux 2>/dev/null)
if [ -z "$TMUX" ]; then print_in_red "\n • The tmux package is not installed\n\n"; else
print_in_purple "\n • Installing tmux plugins\n"
bash -c $linuxosdir/install_tmux.sh
print_in_purple " • Installing tmux plugins completed\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create and Setup zsh
ZSH=$(which zsh 2>/dev/null)
if [ -z "$ZSH" ]; then print_in_red "\n • The zsh package is not installed\n\n"; else
print_in_purple "\n • Installing zsh with plugins\n"
bash -c $linuxosdir/install_ohmyzsh.sh
print_in_purple " • Installing zsh with plugins completed\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create and Setup fish
FISH=$(which fish 2>/dev/null)
if [ -z "$FISH" ]; then print_in_red "\n • The fish package is not installed\n\n"; else
print_in_purple "\n • Installing fish shell and plugins\n"
bash -c $linuxosdir/install_ohmyfish.sh
print_in_purple " • Installing fish shell and plugins completed\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create and Setup Visual Studio code
CODE=$(command -v code 2>/dev/null)
if [ -z "$CODE" ]; then print_in_red "\n • The Visual Studio code package is not installed\n\n"; else
print_in_purple "\n • Installing Visual Studio code and plugins\n"
$linuxosdir/install_vscode.sh
print_in_purple " • Installing Visual Studio code shell and plugins completed\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#No point in running if no desktop
if [ -n "$DESKTOP_SESSION" ]; then
# Compile and Install polybar
POLYBAR=$(which polybar 2>/dev/null)
if [ -z $UPDATE ]; then
print_in_purple "\n • polybar install\n\n"
if [ -n "$POLYBAR" ]; then print_in_green " • polybar already installed\n"; else
sudo bash -c $linuxosdir/make_polybar.sh
fi
print_in_purple " • polybar install complete\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Compile and Install jgmenu
JGMENU=$(which jgmenu 2>/dev/null)
if [ -z $UPDATE ]; then
print_in_purple " • jgmenu install\n\n"
if [ ! -z "$JGMENU" ]; then print_in_green " • jgmenu already installed\n"; else
sudo bash -c $linuxosdir/make_jgmenu.sh
fi
print_in_purple " • jgmenu install complete\n\n"
fi
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -z "$(command -v shodan 2>/dev/null)" ] || [ -z "$(command -v ytmdl 2>/dev/null)" ] || [ -z "$(command -v toot 2>/dev/null)" ] ||
[ -z "$(command -v castero 2>/dev/null)" ] || [ -z "$(command -v rainbowstream 2>/dev/null)" ]; then
print_in_purple "\n • Installing terminal tools\n"
for PIPTOOLS in git+https://github.com/sixohsix/python-irclib shodan ytmdl toot castero rainbowstream; do
if "(sudo -vn && sudo -ln)" 2>&1 | grep -v 'may not' >/dev/null; then
execute \
"sudo sh -c $PIP install $PIPTOOLS >/dev/null 2>&1" \
"Installing pip package: $PIPTOOLS"
else
execute \
"sh -c $PIP install --user $PIPTOOLS >/dev/null 2>&1" \
"Installing pip package: $PIPTOOLS"
fi
done
print_in_purple " • Installing terminal tools completed\n\n"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Update configs
print_in_purple "\n • Update configs\n"
for confsetup in $(ls -d $srcdir/config/*); do
if [ -f "$confsetup/install.sh" ] && [ ! -f "$confsetup/.installed" ]; then
execute "$confsetup/install.sh" "Finalizing $confsetup setup"
fi
done
print_in_purple " • Update configs completed\n\n"
# Install additional
print_in_purple "\n • Installing additional tools\n"
if [ -f "$(command -v dfmgr 2>/dev/null)" ]; then
execute "dfmgr install misc"
fi
print_in_purple " • Installing additional tools completed\n\n"
if [ -n "$DESKTOP_SESSION" ]; then
case "$DESKTOP_SESSION" in
awesome) execute "dfmgr install awesome" "Setting up for awesome" ;;
bspwm) execute "dfmgr install bspwm" "Setting up for bspwm" ;;
i3 | i3wm) execute "dfmgr install i3" "Setting up for i3" ;;
qtile) execute "dfmgr install qtile" "Setting up for qtile" ;;
xfce) execute "dfmgr install xfce" "Setting up for xfce" ;;
openbox) execute "dfmgr install openbox" "Setting up for openbox" ;;
xmonad) execute "dfmgr install xmonad" "Setting up for xmonad" ;;
#jwm) execute "dfmgr install jwm" "Setting up for jwm";;
#lxde) execute "dfmgr install lxde" "Setting up for lxde";;
#lxqt) execute "dfmgr install lxqt" "Setting up for lxqt";;
esac
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Go home
cd "$HOME" || false
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Fix permissions again
find "$HOME" -xtype l -delete
find ~/.gnupg ~/.ssh -type f -exec chmod 600 {} \; 2>/dev/null
find ~/.gnupg ~/.ssh -type d -exec chmod 700 {} \; 2>/dev/null
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create env file
if [ ! -d ~/.config/dotfiles ]; then mkdir -p ~/.config/dotfiles; fi
if [ ! -f ~/.config/dotfiles/env ]; then
echo "" >~/.config/dotfiles/env
echo "UPDATE="yes"" >>~/.config/dotfiles/env
echo "dotfilesDirectory="$dotfilesDirectory"" >>~/.config/dotfiles/env
echo "srcdir="$dotfilesDirectory/src"" >>~/.config/dotfiles/env
echo "linuxosdir="$srcdir/os/linux"" >>~/.config/dotfiles/env
echo "INSTALLEDVER="$NEWVERSION"" >>~/.config/dotfiles/env
echo "DISTRO="$DISTRO"" >>~/.config/dotfiles/env
echo "CODENAME="$CODENAME"" >>~/.config/dotfiles/env
echo "GIT="$GIT"" >>~/.config/dotfiles/env
echo "CURL="$CURL"" >>~/.config/dotfiles/env
echo "WGET="$WGET"" >>~/.config/dotfiles/env
echo "VIM="$VIM"" >>~/.config/dotfiles/env
echo "TMUX="$TMUX"" >>~/.config/dotfiles/env
echo "ZSH="$ZSH"" >>~/.config/dotfiles/env
echo "FISH="$FISH"" >>~/.config/dotfiles/env
echo "POLYBAR="$POLYBAR"" >>~/.config/dotfiles/env
echo "JGMENU="$JGMENU"" >>~/.config/dotfiles/env
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#Reconfigure lxdm
#if (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' > /dev/null; then
# if [[ "$distroname" =~ "Kali" ]] || [[ "$distroname" =~ "Parrot" ]] || [[ "$distroname" =~ "Debian" ]] || [[ "$distroname" =~ "Raspbian" ]] || [[ "$distroname" =~ "Ubuntu" ]] ; then
#sudo dpkg-reconfigure lxdm
# fi
#fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# run clean up
print_in_purple "\n • Running cleanup\n"
# remove unwanted system files
if (sudo -vn && sudo -ln) 2>&1 | grep -v 'may not' >/dev/null; then
for sudocleanfile in /usr/share/xsessions/*-shmlog.desktop; do
if [ -e "$sudocleanfile" ]; then
execute \
"sudo rm -Rf $sudocleanfile" \
"Clean up cleaning up $sudocleanfile"
fi
done
fi
# remove unwanted user temp files
for homecleanfile in "$HOME/.cache/yay"/*; do
if [ -e "$homecleanfile" ]; then
execute \
"rm -Rf $homecleanfile 2>/dev/null" \
"cleaning up $homecleanfile"
fi
done
print_in_purple " • Running cleanup complete\n\n"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Print installed version
NEWVERSION="$(cat "$DOTFILES/version.txt" | tail -n 1)"
cp -Rf "$DOTFILES/version.txt" "$srcdir/os/version.txt"
# End Install
#RESULT=$?
printf "\n${GREEN} *** 😃 installation of dotfiles completed 😃 *** ${NC}\n"
printf "${GREEN} *** 😃 You now have version number: "$NEWVERSION" 😃 *** ${NC}\n\n"
printf "${RED} *** For the configurations to take effect *** ${NC} \n "
printf "${RED} *** you should logoff or reboot your system *** ${NC} \n\n\n\n "
##################################################################################################
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -