-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgentoo.html
154 lines (139 loc) · 3.7 KB
/
gentoo.html
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
source config
function createPartitions
{
sgdisk --zap-all $DRIVE
sleep 1
sgdisk --clear \
--new=1:0:+600MiB --typecode=1:ef00 --change-name=1:EFI \
--new=2:0:+500MiB --typecode=2:8300 --change-name=2:BOOT \
--new=3:0:0 --typecode=3:8300 --change-name=3:SYSTEM \
$DRIVE
sleep 1
# Init Filesystem
mkfs.vfat -F32 /dev/disk/by-partlabel/EFI
sleep 1
mkfs.ext4 /dev/disk/by-partlabel/BOOT
sleep 1
mkfs.ext4 /dev/disk/by-partlabel/SYSTEM
}
function setupEncryption
{
modprobe dm-crypt
sleep 1
modprobe dm-mod
sleep 1
cryptsetup luksFormat -v -s 512 -h sha512 /dev/disk/by-partlabel/SYSTEM
sleep 1
cryptsetup --allow-discards --persistent open /dev/disk/by-partlabel/SYSTEM archsystem
sleep 1
}
function setupFilesystemExt4
{
if [ "$ENCRYPT_SYSTEM" = true ]; then
SYSTEM_DRIVE=/dev/mapper/archsystem
else
SYSTEM_DRIVE=/dev/disk/by-partlabel/SYSTEM
fi
mkdir -p /mnt/system
mount $SYSTEM_DRIVE /mnt/system
sleep 1
}
function setupFilesystemBtrfs
{
if [ "$ENCRYPT_SYSTEM" = true ]; then
SYSTEM_DRIVE=/dev/mapper/archsystem
else
SYSTEM_DRIVE=/dev/disk/by-partlabel/SYSTEM
fi
mkfs.btrfs -f -L archbtrfs $SYSTEM_DRIVE
sleep 1
mkdir -p /mnt/system
mount $SYSTEM_DRIVE /mnt/system
sleep 1
# Mount Filesystem
btrfs subvolume create /mnt/system/@
sleep 1
btrfs subvolume create /mnt/system/@home
sleep 1
btrfs subvolume create /mnt/system/@var
sleep 1
btrfs subvolume create /mnt/system/@snapshots
sleep 1
umount /mnt/system
sleep 1
mount -o noatime,compress=lzo,subvol=@ $SYSTEM_DRIVE /mnt/system
sleep 1
mkdir -p /mnt/system/{home,var,.snapshots}
sleep 1
mount -o noatime,compress=lzo,subvol=@home $SYSTEM_DRIVE /mnt/system/home
sleep 1
mount -o noatime,compress=lzo,subvol=@var $SYSTEM_DRIVE /mnt/system/var
sleep 1
mount -o noatime,compress=lzo,subvol=@snapshots $SYSTEM_DRIVE /mnt/system/.snapshots
sleep 1
}
function mountBoot
{
mkdir -p /mnt/system/boot
sleep 1
mount /dev/disk/by-partlabel/BOOT /mnt/system/boot
sleep 1
mkdir /mnt/system/boot/EFI
sleep 1
mount /dev/disk/by-partlabel/EFI /mnt/system/boot/EFI
sleep 1
}
function installSystemArch
{
pacstrap /mnt/system base base-devel linux linux-headers linux-firmware vim curl
sleep 1
genfstab -U /mnt/system >> /mnt/system/etc/fstab
sleep 1
vim /mnt/system/etc/fstab
sleep 1
curl -LJO tomasrejhons.github.io/malis/post-install
sleep 1
cp post-install /mnt/system/post-install
sleep 1
cp config /mnt/system/config
sleep 1
arch-chroot /mnt/system
}
function gentooStage3
{
cd /mnt/system
sleep 1
wget https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/20220315T091810Z/stage3-amd64-openrc-20220315T091810Z.tar.xz
sleep 1
tar xpvf ./stage3-amd64-openrc-20220315T091810Z.tar.xz --xattrs-include='*.*' --numeric-owner
sleep 1
mirrorselect -i -o >> /mnt/system/etc/portage/make.conf
sleep 1
mkdir -p /mnt/system/etc/portage/repos.conf && cp /mnt/system/usr/share/portage/config/repos.conf /mnt/system/etc/portage/repos.conf/gentoo.conf
sleep 1
cp --dereference /etc/resolv.conf /mnt/system/etc/
sleep 1
mount --types proc /proc /mnt/system/proc
sleep 1
mount --rbind /sys /mnt/system/sys
mount --make-rslave /mnt/system/sys
mount --rbind /dev /mnt/system/dev
mount --make-rslave /mnt/system/dev
mount --bind /run /mnt/system/run
mount --make-slave /mnt/system/run
chroot /mnt/system /bin/bash
source /etc/profile
export PS1="[chroot] ${PS1}"
}
createPartitions
if [ "$ENCRYPT_SYSTEM" = true ]; then
setupEncryption
fi
if [ "$USE_BTRFS" = true ]; then
setupFilesystemBtrfs
else
setupFilesystemExt4
fi
mountBoot
gentooStage3