summaryrefslogtreecommitdiff
path: root/hooks/build-os/80-firstboot-repart-growfs
blob: 97acefff0ec531c94d480bc5685779aa4e1603ab (plain)
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
#!/bin/bash -xe

set -o pipefail

# Configure systemd-growfs-root
mkdir "${root:?}"/etc/systemd/system/systemd-growfs-root.service.d

cat > "${root:?}"/etc/systemd/system/systemd-growfs-root.service.d/override.conf << EOF
[Unit]
ConditionFirstBoot=yes

[Service]
ExecStart=/usr/lib/systemd/systemd-growfs /sysroot

[Install]
WantedBy=multi-user.target
EOF

chroot "${root:?}" systemctl enable systemd-growfs-root.service

# Configure systemd-repart

mkdir "${root:?}"/etc/repart.d

cat > "${root:?}"/etc/repart.d/50-root.conf << EOF
[Partition]
Type=linux-generic
GrowFileSystem=yes
EOF

chroot "${root:?}" apt-get install -y systemd-repart

# Configure systemd-firstboot

mkdir "${root:?}"/etc/systemd/system/systemd-firstboot.service.d
cat > "${root:?}"/etc/systemd/system/systemd-firstboot.service.d/install.conf << EOF
[Service]
ExecStart=
ExecStart=/usr/bin/systemd-firstboot

[Install]
WantedBy=sysinit.target
EOF

chroot "${root:?}" systemctl enable systemd-firstboot.service

rm "${root:?}"/etc/machine-id