-
Notifications
You must be signed in to change notification settings - Fork 1
/
installer.sh
executable file
·119 lines (100 loc) · 2.99 KB
/
installer.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
#!/bin/bash
# Configuration
swap_partition=true
# Usage Message
usage() {
echo "Usage:"
echo "$0 --no-swap : Install without making swap partition."
echo "$0 --install : Default installation (with swap partition)."
}
# Archer Ascii Logo
print_archer() {
printf "
_
/\ | |
/ \ _ __ ___| |__ ___ _ __
/ /\ \ | '__/ __| '_ \ / _ \ '__|
/ ____ \| | | (__| | | | __/ |
/_/ \_\_| \___|_| |_|\___|_|
"
}
# Runs only if swap is selected
swap() {
# Partitioning
parted -s $disk mkpart primary linux-swap 512MiB 2560MiB
mkswap $(printf "%s2" "$disk")
swapon $(printf "%s2" "$disk")
}
# Install
install() {
timedatectl set-ntp true
# Disk to use
fdisk -l
echo ""
echo "Select the disk to use: "
echo -n "=> "
read -r disk
# Partitioning
parted -s $disk mklabel gpt
parted -s $disk mkpart primary fat32 0 512MiB
parted -s $disk set 1 esp on
if $swap_partition; then
swap
parted -s $disk mkpart primary ext4 2560MiB 100%
mkfs.fat -F32 $(printf "%s1" "$disk")
mkfs.ext4 $(printf "%s3" "$disk")
mount $(printf "%s3" "$disk") /mnt
mkdir /mnt/efi
mount $(printf "%s1" "$disk") /mnt/efi
else
parted -s $disk mkpart primary ext4 512MiB 100%
mkfs.fat -F32 $(printf "%s1" "$disk")
mkfs.ext4 $(printf "%s2" "$disk")
mount $(printf "%s2" "$disk") /mnt
mkdir /mnt/efi
mount $(printf "%s1" "$disk") /mnt/efi
fi
# Installing
pacstrap -K /mnt base base-devel linux linux-firmware
genfstab -U /mnt > /mnt/etc/fstab
arch-chroot /mnt ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
arch-chroot /mnt hwclock --systohc
arch-chroot /mnt sed -i 's/\#it_IT.UTF-8 UTF-8/it_IT.UTF-8 UTF-8/g' /etc/locale.gen
arch-chroot /mnt sed -i 's/\#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
arch-chroot /mnt locale-gen
echo "LANG=it_IT.UTF-8" > /mnt/etc/locale.conf
echo "KEYMAP=it" > /mnt/etc/vconsole.conf
echo "arch" > /mnt/etc/hostname
arch-chroot /mnt pacman --noconfirm -S grub efibootmgr networkmanager
arch-chroot /mnt systemctl enable NetworkManager
arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg
# Finish
echo "Set root password"
arch-chroot /mnt passwd
echo "Thanks!"
reboot
}
# Start
print_archer
echo ""
echo "Welcome to my automatic ArchLinux installer. See my github repo for more info: https://github.com/FrancescoXD/Archer"
echo "Don't use it, seriously."
echo ""
if [ $# -eq 0 ]; then
usage
exit 1
fi
while test $# -gt 0
do
case $1 in
--install)
install
;;
--no-swap)
swap_partition=false
install
;;
esac
shift
done