-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfig.sh
executable file
·87 lines (71 loc) · 2.35 KB
/
config.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
#!/usr/bin/env bash
configure_touchpad() {
read -r -p "Configure touchpad? [y/N] " answer
if [[ "$answer" != y ]] && [[ "$answer" != Y ]]; then
printf 'Skipping touchpad configuration...\n'
else
printf 'Configuring touchpad...\n'
printf 'Writing content to "/usr/share/X11/xorg.conf.d/40-libinput.conf"...'
sudo tee -a /usr/share/X11/xorg.conf.d/40-libinput.conf >> /dev/null << EOT
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Option "Tapping" "true"
Option "TappingDrag" "false"
Option "NaturalScrolling" "true"
Option "AccelProfile" "linear"
Option "AccelSpeed" "0.25"
Option "DisableWhileTyping" "true"
Driver "libinput"
EndSection
EOT
printf "Done.\n"
fi
}
enable_docker() {
read -r -p "Start and enable Docker? [y/N] " answer
if [[ "$answer" != y ]] && [[ "$answer" != Y ]]; then
printf "\nSkipping Docker systemctl setup...\n"
else
printf "\nStarting Docker through systemctl..."
systemctl start docker
printf "\nStarting Docker through systemctl..."
systemctl enable docker
printf "DONE.\n"
fi
}
configure_docker() {
read -r -p "Manage Docker as a non-root user? [y/N] " answer
if [[ "$answer" != y ]] && [[ "$answer" != Y ]]; then
printf 'Skipping Docker non-root configuration...\n'
else
printf "\nAdding 'docker' group..."
sudo groupadd docker
printf '\nAdding user %s to docker group...' "$USER"
sudo usermod -aG docker "$USER"
printf "DONE.\n"
fi
}
configure_npm() {
read -r -p "Manage NPM as a non-root user? [y/N] " answer
if [[ "$answer" != y ]] && [[ "$answer" != Y ]]; then
printf "\nSkipping NPM non-root configuration...\n"
else
local npm_dir="$HOME/.npm-global"
if [[ ! -d "$npm_dir" ]]; then
printf '\nCreating dir %s...\n' "$npm_dir"
mkdir -p "$npm_dir"
else
printf '\nDirectory %s exists...\n' "$npm_dir"
fi
printf '\nAdding to %s npm config...' "$npm_dir"
npm config set prefix "$HOME/.npm-global"
printf "DONE.\n"
fi
}
configure_touchpad
enable_docker
configure_docker
configure_npm
printf "Configuration completed.\n"