-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_install
More file actions
executable file
·80 lines (61 loc) · 2.51 KB
/
script_install
File metadata and controls
executable file
·80 lines (61 loc) · 2.51 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
#!/bin/bash
partition_boot="$1"
partition_systeme="$2"
type_ucode="intel-ucode"
if [[ "$3" = "amd" ]]
then
type_ucode="amd-ucode"
fi
echo -en "\033[34m\t----- Partie serveur -----\033[0m\n\n"
echo -e "\033[34m--- Chiffrement da la partition principale ---\033[0m"
cryptsetup luksFormat \
--type luks2 \
--hash sha256 \
--align-payload 8192 \
--iter-time 5000 \
--cipher aes-xts-plain64 \
--key-size 512 \
--pbkdf argon2id \
--verify-passphrase /dev/$partition_systeme
echo -e "\033[34m--- Ouvrir la partition chiffrée ---\033[0m"
cryptsetup open /dev/$partition_systeme system
echo -e "\033[34m--- Créer les fichiers systèmes ---\033[0m"
mkfs.fat -F 32 /dev/$partition_boot
mkfs.btrfs /dev/mapper/system
echo -e "\033[34m--- Monter la partition ---\033[0m"
mount -t btrfs /dev/mapper/system /mnt
echo -e "\033[34m--- Créer les sous-volumes ---\033[0m"
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@snapshots
btrfs subvolume create /mnt/@swap
echo -e "\033[34m--- Démonter la partition ---\033[0m"
umount -R /mnt
echo -e "\033[34m--- Rémonter la partition avec les bonnes options ---\033[0m"
mount -t btrfs -o defaults,x-mount.mkdir,compress=zstd,ssd,noatime,subvol=@ /dev/mapper/system /mnt
mount -t btrfs -o defaults,x-mount.mkdir,compress=zstd,ssd,noatime,subvol=@home /dev/mapper/system /mnt/home
mount -t btrfs -o defaults,x-mount.mkdir,compress=zstd,ssd,noatime,subvol=@snapshots /dev/mapper/system /mnt/.snapshots
mount -t btrfs -o defaults,x-mount.mkdir,compress=zstd,ssd,noatime,subvol=@swap /dev/mapper/system /mnt/swap
echo -e "\033[34m--- Monter la partition boot ---\033[0m"
mount /dev/$partition_boot --mkdir /mnt/boot
echo -e "\033[34m--- Installer les paquets de bases ---\033[0m"
pacstrap -K /mnt base
echo -e "\033[34m--- Générer le fichier fstab ---\033[0m"
genfstab -U -p /mnt >> /mnt/etc/fstab
cat << EOF >> /mnt/etc/fstab
# swap pour l'hibernation
/swap/swapfile none swap defaults 0 0
# disque dur de backup
UUID=e1ac2b27-f11a-4f83-b8b1-afa2dbb0eef1 /home/adrien/mymount ext4 rw,user,noauto 0 0
EOF
echo -e "\033[34m--- Rentrer dans le système ---\033[0m"
cp script_install_in /mnt
cp install_package /mnt
arch-chroot /mnt ./script_install_in $partition_systeme $type_ucode
rm /mnt/script_install_in
rm /mnt/install_package
echo -en "\n\033[34m\t----- Fin de l'installlation -----\033[0m\n\n"
echo -e "\033[34m--- Démonter le système ---\033[0m"
umount -R /mnt
echo -e "\033[34m--- Fermer la partition chiffrée ---\033[0m"
cryptsetup close system