-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
134 lines (102 loc) · 3.26 KB
/
install.sh
File metadata and controls
134 lines (102 loc) · 3.26 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
read -p "Have you already created the partitions? (Y/N): " partitions_created
case $partitions_created in
[Yy])
# If the user has created partitions, continue with the script
clear
;;
*)
# If the user hasn't created partitions, show the message and exit
echo "You have to create the partitions before executing the script."
exit 1
;;
esac
# Showing your partitions
lsblk
# Asking for the partitions
read -p "Select your boot partition, e.g: sda1: " boot_p
read -p "Select the root partition: " root_p
read -p "Select your swap partition: " swap_p
# Adding /dev/ to the partitions
boot_p="/dev/$boot_p"
swap_p="/dev/$swap_p"
root_p="/dev/$root_p"
# Check if the vars are not null
if [ -z "$boot_p" ] || [ -z "$swap_p" ] || [ -z "$root_p" ]; then
echo "Error: You have to write all the partitions."
exit 1
fi
# Cleaning the screen
clear
# Configuring the NTP
timedatectl set-ntp true
# Formatting boot partition
echo "Formatting the boot partition ($boot_p)..."
mkfs.fat -F32 $boot_p
# Creating the swap parittion and activating it
echo "Creating swap on partition ($swap_p)..."
mkswap $swap_p
swapon $swap_p
# Formatting root partition
echo "Formatting the root partition ($root_p)..."
mkfs.btrfs -f $root_p
# Cleaning the screen
clear
# Mounting the root partition
mount $root_p /mnt
# Creating the subvolumes
echo 'Creating the subvolumes "root, home, .snapshots and var_log"..'
btrfs su cr /mnt/@
btrfs su cr /mnt/@home
btrfs su cr /mnt/@.snapshots
btrfs su cr /mnt/@var_log
# Unmounting /mnt directory
umount /mnt
# Remounting
mount -o noatime,compress=lzo,space_cache=v2,subvol=@ $root_p /mnt
# Creating the directories
echo "Creating the directories for the subvolumes..."
mkdir -p /mnt/{boot,home,.snapshots,var_log}
echo "Mounting the subvolumes..."
mount -o noatime,compress=lzo,space_cache=v2,subvol=@home $root_p /mnt/home
mount -o noatime,compress=lzo,space_cache=v2,subvol=@.snapshots $root_p /mnt/.snapshots
mount -o noatime,compress=lzo,space_cache=v2,subvol=@var_log $root_p /mnt/var/log
# Mounting boot
mount $boot_p /mnt/boot
# Cleaning the screen
clear
# Installing the base directories with the microcode picking
echo "Please, select which microcode you want to install"
select microcode_option in "intel-ucode" "amd-ucode" "None"; do
case $microcode_option in
"intel-ucode")
microcode_package="intel-ucode"
break
;;
"amd-ucode")
microcode_package="amd-ucode"
break
;;
"None")
microcode_package=""
break
;;
*)
echo "Please, select a valid option"
;;
esac
done
# Cleaning the screen
clear
# Installing the basic packages for linux
echo -e "The packages: base linux linux-firmware vim $microcode_package will be installed \n"
read -p "Press Enter to continue"
pacstrap /mnt base linux linux-firmware vim $microcode_package
# Generating the fstab
genfstab -U /mnt >> /mnt/etc/fstab
# Cleaning the screen
clear
# Moving the chroot code into the chroot directory
cp /root/ArchLinux-Install-Script/chroot.sh /mnt
echo -e "Now please do:\n arch-chroot /mnt\nand run the chroot.sh script \n"
read -p "Press Enter to continue"
exit 0