-
Notifications
You must be signed in to change notification settings - Fork 0
/
arch-configuration.sh
executable file
·195 lines (159 loc) · 3.72 KB
/
arch-configuration.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
#!/bin/bash
# encoding: utf-8
source snackk.conf
to_install=10;
##################################################
# ARCH-CONFIGURATION #
##################################################
function set_hostname
{
ERR=0
# Hostname
print_pretty_header "Setting hostname${NC} $HOSTN"
echo $HOSTN > /etc/hostname || ERR=1
if [[ $ERR -eq 1 ]]; then
print_results "Hostname error."
exit 1
else
let success+=1;
fi
}
function set_keyboard_layout
{
ERR=0
# Keyboard Layout
print_pretty_header "Setting keyboard layout${NC} $KEYBOARD_LAYOUT"
echo 'KEYMAP='$KEYBOARD_LAYOUT > /etc/vconsole.conf || ERR=1
if [[ $ERR -eq 1 ]]; then
print_results "Keyboard layout error."
exit 1
else
let success+=1;
fi
}
function set_locale
{
ERR=0
# Setting Locale
print_pretty_header "Setting locale${NC} $LANGUAGE"
sed -i 's/^#'$LANGUAGE'/'$LANGUAGE/ /etc/locale.gen || ERR=1
locale-gen 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
print_results "Locale error."
exit 1
else
let success+=1;
fi
}
function set_language
{
ERR=0
# Setting language
print_pretty_header "Setting language${NC} $LANGUAGE"
export LANG=$LANGUAGE'.utf-8'
echo 'LANG='$LANGUAGE'.utf-8' > /etc/locale.conf
if [[ $ERR -eq 1 ]]; then
print_results "Language error."
exit 1
else
let success+=1;
fi
}
function set_timezone
{
ERR=0
# Time zone
print_pretty_header "Setting time zone${NC} $LOCALE"
ln -sf /usr/share/zoneinfo/$LOCALE /etc/localtime || ERR=1
echo $LOCALE > /etc/timezone
#hwclock --systohc --utc
if [[ $ERR -eq 1 ]]; then
print_results "Time zone error."
exit 1
else
let success+=1;
fi
}
function set_initial_ramdisk
{
ERR=0
# Setting initial ramdisk environment
print_pretty_header "Setting initial ramdisk"
mkinitcpio -p linux 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
print_results "Ramdisk error."
exit 1
else
let success+=1;
fi
}
function set_root_passwd
{
ERR=0
# Setting root password
print_pretty_header "Setting root password${NC} $ROOT_PASSWD"
echo -e $ROOT_PASSWD"\n"$ROOT_PASSWD | passwd
if [[ $ERR -eq 1 ]]; then
print_results "Root password error."
exit 1
else
let success+=1;
fi
}
function install_basic_dependencies
{
ERR=0
# Installing basic dependencies
print_pretty_header "Installing${NC} $BASIC_PKGS"
pacman -S `echo $BASIC_PKGS` --noconfirm 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
print_results "Basic dependencies error."
exit 1
else
let success+=1;
fi
}
function install_efi
{
ERR=0
# Install EFI
mkdir /mnt/boot || ERR=1
mount /dev/$EFI_BOOT /mnt/boot || ERR=1
print_pretty_header "Installing EFI on${NC} /dev/$EFI_BOOT"
grub-install --target=x86_64-efi --efi-directory=/mnt/boot --bootloader-id=grub --boot-directory=/mnt/boot 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
print_results "EFI error."
exit 1
else
let success+=1;
fi
}
function install_grub
{
ERR=0
# Making grub config
print_pretty_header "Installing grub on${NC} /dev/$EFI_BOOT"
grub-mkconfig -o /mnt/boot/grub/grub.cfg 1>/dev/null || ERR=1
umount /mnt/boot
if [[ $ERR -eq 1 ]]; then
print_results "Grub error."
exit 1
else
let success+=1;
fi
}
##################################################
# Script #
##################################################
set_hostname
set_keyboard_layout
set_locale
set_language
set_timezone
set_initial_ramdisk
set_root_passwd
install_basic_dependencies
install_efi
install_grub
print_results
print_line