-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathchroot
executable file
·105 lines (88 loc) · 3.11 KB
/
chroot
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
#!/usr/bin/env bash
# Set the time zone
ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
hwclock --systohc
# Localization
sed -i 's/^#en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
sed -i 's/^#ru_RU.UTF-8/ru_RU.UTF-8/' /etc/locale.gen
locale-gen
echo "LANG=ru_RU.UTF-8" >> /etc/locale.conf
echo "KEYMAP=ru" >> /etc/vconsole.conf
echo "FONT=cyr-sun16" >> /etc/vconsole.conf
# Network configuration
echo "archlinux" >> /etc/hostname
# Move to `packages` 'Post config'
# echo "127.0.0.1 localhost" >> /etc/hosts
# echo "::1 localhost" >> /etc/hosts
# echo "127.0.0.1 archlinux.localdomain archlinux" >> /etc/hosts
systemctl enable NetworkManager
# Pacman settings - Move to `packages` 'Post config'
# sed -i 's/#Color/Color/' /etc/pacman.conf
# sed -i 's/#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
# Add multilib repo
line=`grep -n "#\[multilib\]" /etc/pacman.conf | cut -d':' -f1`
sed -i -e "${line}s/^#//" /etc/pacman.conf
line=$((line+1))
sed -i -e "${line}s/^#//" /etc/pacman.conf
# Passwords and create user
echo; echo
echo "####################"
echo "Password for root"
echo "####################"
passwd
echo; echo
echo "####################"
echo "Add user"
echo "####################"
read -p"Username >" username
useradd -m -G wheel -s /bin/bash $username
passwd $username
# Copy scripts
# chmod -R 755 /home/$username
cp -r /root/archlinux /home/$username
chown -R $username:$username /home/$username/archlinux
# Add sudo
sed -i 's/# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
# Add sudo timeout - Move to `packages` 'Post config'
# line=`grep -n "Runas alias specification" /etc/sudoers | cut -d':' -f1`
# sed -i "${line}aDefaults timestamp_timeout=30\n" /etc/sudoers
echo; echo
# Install GRUB
grub=`pacman -Qe grub 2>/dev/null | grep -o "^grub"`
efibootmgr=`pacman -Qe efibootmgr 2>/dev/null | grep -o "^efibootmgr"`
if [[ $grub == "grub" ]]; then
if [[ $efibootmgr == "efibootmgr" ]]; then
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
sed -i '/^GRUB_TIMEOUT/s/=./=3/' /etc/default/grub
sed -i 's/#GRUB_THEME="\/path\/to\/gfxtheme"/GRUB_THEME="\/usr\/share\/grub\/themes\/Vimix\/theme.txt"/' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
echo; echo
echo "####################"
echo "GRUB for EFI install"
echo "####################"
else
if [[ $1 != "" ]]; then
grub-install --target=i386-pc $1
else
grub-install --target=i386-pc /dev/vda
fi
sed -i '/^GRUB_TIMEOUT/s/=./=3/' /etc/default/grub
sed -i 's/#GRUB_THEME="\/path\/to\/gfxtheme"/GRUB_THEME="\/usr\/share\/grub\/themes\/Vimix\/theme.txt"/' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
echo; echo
echo "####################"
echo "GRUB for MBR install"
echo "####################"
fi
else
echo; echo
echo "####################"
echo "GRUB not install"
echo "####################"
fi
# Exit
echo; echo
echo "####################"
echo "Please do this:"
echo ">exit"
echo "####################"