-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvironment-setup.sh
More file actions
executable file
·193 lines (160 loc) · 4.23 KB
/
environment-setup.sh
File metadata and controls
executable file
·193 lines (160 loc) · 4.23 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
#!/bin/bash
# encoding: utf-8
source snackk.conf
to_install=9;
success=0
##################################################
# ENVIRONMENT-SETUP #
##################################################
function run_osprober
{
ERR=0
# os-prober
print_pretty_header "Running OS-prober${NC} /dev/$EFI_BOOT"
os-prober 1>/dev/null || ERR=1
mount /dev/$EFI_BOOT /mnt/boot
grub-mkconfig -o /mnt/boot/grub/grub.cfg 1>/dev/null || ERR=1
umount /mnt/boot
if [[ $ERR -eq 1 ]]; then
echo "OS-prober error."
exit 1
else
let success+=1;
fi
}
function add_user
{
ERR=0
# Add user
print_pretty_header "Adding user${NC} $USERN"
useradd -m -G wheel -s /bin/bash $USERN || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Add user error."
exit 1
else
let success+=1;
fi
}
function set_user_passwd
{
ERR=0
# Setting User password
print_pretty_header "Setting password${NC} $ROOT_PASSWD"
echo -e $ROOT_PASSWD"\n"$ROOT_PASSWD | passwd $USERN
if [[ $ERR -eq 1 ]]; then
echo "Set user error."
exit 1
else
let success+=1;
fi
}
function add_repositories
{
ERR=0
# Configure pacman
print_pretty_header "Adding multilib & aur"
sed -i '/^#VerbosePkgLists/ a ILoveCandy' /etc/pacman.conf || ERR=1
echo "" >> /etc/pacman.conf || ERR=1
echo "[multilib]" >> /etc/pacman.conf || ERR=1
echo "Include = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf || ERR=1
echo "" >> /etc/pacman.conf || ERR=1
echo "[archlinuxfr]" >> /etc/pacman.conf || ERR=1
echo "SigLevel = Never" >> /etc/pacman.conf || ERR=1
echo "Server = http://repo.archlinux.fr/x86_64" >> /etc/pacman.conf || ERR=1
print_pretty_header "Updating repositories"
pacman -Syy 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Pacman config error."
exit 1
else
let success+=1;
fi
}
function set_sudoers
{
ERR=0
# Setting sudoers
print_pretty_header "Setting up sudoers"
sed -i -e 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g' /etc/sudoers || ERR=1
sed -i -e 's/# %sudo ALL=(ALL) ALL/%sudo ALL=(ALL) ALL/g' /etc/sudoers || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Sudoers error."
exit 1
else
let success+=1;
fi
}
function pacman_display_dependecies
{
ERR=0
# Downloading pacman display dependencies
print_pretty_header "Installing${NC} $DISPLAY_PKGS"
pacman -S `echo $DISPLAY_PKGS` --noconfirm 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Pacman Display dependencies error."
exit 1
else
let success+=1;
fi
}
function deepin_dde
{
ERR=0
# Adding some nice touch :D
print_pretty_header "Installing Deepin"
pacman -S `echo $DEEPIN` --noconfirm 1>/dev/null || ERR=1
sed -i -e 's/#greeter-session=example-gtk-gnome/greeter-session=lightdm-deepin-greeter/g' /etc/lightdm/lightdm.conf || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Deepin dde error."
exit 1
else
let success+=1;
fi
}
function enable_sysctl_daemons
{
ERR=0
# Daemons
print_pretty_header "Enabling NetworkManager and Lightdm"
systemctl enable NetworkManager.service 1>/dev/null || ERR=1
systemctl enable lightdm.service 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Systemctl daemons error."
exit 1
else
let success+=1;
fi
}
function set_dns
{
ERR=0
# CloudFlare's DNS
print_pretty_header "Setting CloudFlare DNS"
echo "[main]" >> /etc/NetworkManager/NetworkManager.conf || ERR=1
echo "dns=none" >> /etc/NetworkManager/NetworkManager.conf || ERR=1
rm /etc/resolv.conf
touch /etc/resolv.conf
echo "# CloudFlare IPv4 nameservers" >> /etc/resolv.conf || ERR=1
echo "nameserver 1.1.1.1" >> /etc/resolv.conf || ERR=1
echo "nameserver 1.0.0.1" >> /etc/resolv.conf || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "DNS error."
exit 1
else
let success+=1;
fi
}
##################################################
# Script #
##################################################
run_osprober
add_user
set_user_passwd
add_repositories
set_sudoers
pacman_display_dependecies
deepin_dde
enable_sysctl_daemons
set_dns
print_results
print_line