This repository was archived by the owner on Feb 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_chroot.sh
More file actions
executable file
·88 lines (63 loc) · 2.79 KB
/
post_chroot.sh
File metadata and controls
executable file
·88 lines (63 loc) · 2.79 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
#!/bin/bash
# Set colors
LIGHTGREEN='\033[1;32m'
LIGHTRED='\033[1;91m'
WHITE='\033[1;97m'
MAGENTA='\033[1;35m'
CYAN='\033[1;96m'
BLUE='\033[1;34m'
while true; do
printf ${WHITE}"### Setting timezone\n"
printf ${CYAN}"Enter your timezone in this format: Area/City\n(ex, Europe/Helsinki, America/New_York, Asia/Singapore, Australia/Sydney)\n(https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)\n>"
read timezone
ln -sf /usr/share/zoneinfo/${timezone} /etc/localtime
if [ "$?" = "0" ]; then
break
else
printf ${LIGHTRED}"Error while setting timezone, please enter it again\n"
sleep 2
fi
done
hwclock --systohc
printf ${WHITE}"### Setting locale, charset and keymap\n"
printf ${CYAN}"What locale do you want to use? Must be one of the locales placed in ${BLUE}/usr/share/i18n/locales${CYAN}. Example: fi_FI, en_US, en_GB, en_AU, de_DE. Remember that you can always change this later in ${BLUE}/etc/locale.conf${CYAN}\n>"
read locale
printf ${CYAN}"What charset do you want to use? Must be one of the charsets placed in ${BLUE}/usr/share/i18n/charmaps${CYAN} (Ignore the .gz extension). Example: UTF-8, ISO-8859-1, MAC-UK, MACINTOSH. Remember that you can always change this later in ${BLUE}/etc/locale.conf${CYAN}\n>"
read charset
printf ${CYAN}"What keymap do you want to use? Must be one of the keymaps placed in ${BLUE}/usr/share/kbd/keymaps${CYAN} (Ignore the .map.gz extension). Example: fi, us, pc110, jp106.\n>"
read keymap
echo LANG="${locale}.${charset}" > /etc/locale.conf
echo "${locale}.${charset} ${charset}" >> /etc/locale.gen
echo KEYMAP=${keymap} > /etc/vconsole.conf
locale-gen
printf ${CYAN}"Enter the hostname you want to use\n>"
read newHostname
echo $newHostname > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.0.1 $newHostname.localdomain $newHostname" >> /etc/hosts
pacman --noconfirm -Sy networkmanager
systemctl enable NetworkManager
while true; do
printf ${LIGHTGREEN}"Enter the password for the root user\n>"
read -s password
printf ${LIGHTGREEN}"Re-enter the password for the root user\n>"
read -s password_compare
if [ "$password" = "$password_compare" ]; then
echo "root:$password" | chpasswd
break
else
printf ${LIGHTRED}"Passwords do not match, re-enter them"
printf ${WHITE}".\n"
sleep 3
clear
fi
done
pacman --noconfirm -Sy grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot/efi
grub-mkconfig -o /boot/grub/grub.cfg
printf ${LIGHTGREEN}"# =========================\n"
printf ${LIGHTGREEN}"# REBOOT NEEDED\n"
printf ${LIGHTGREEN}"# =========================\n"
printf ${WHITE}"# After you've rebooted and logged into the root user please see the README to see what commands to run:\n"
exit