@@ -0,0 +1,5 | |||
|
1 | # Restart dphys-swapfile service if it exists | |
|
2 | logger -t "rc.firstboot" "Restarting dphys-swapfile" | |
|
3 | ||
|
4 | systemctl enable dphys-swapfile | |
|
5 | systemctl restart dphys-swapfile |
@@ -96,6 +96,9 Set default system timezone. All available timezones can be found in the `/usr/s | |||
|
96 | 96 | ##### `EXPANDROOT`=true |
|
97 | 97 | Expand the root partition and filesystem automatically on first boot. |
|
98 | 98 | |
|
99 | ##### `ENABLE_DPHYSSWAP`=true | |
|
100 | Enable swap. The size of the swapfile is chosen relative to the size of the root partition. It'll use the `dphys-swapfile` package for that. | |
|
101 | ||
|
99 | 102 | ##### `ENABLE_QEMU`=false |
|
100 | 103 | Generate kernel (`vexpress_defconfig`), file system image (`qcow2`) and DTB files that can be used for QEMU full system emulation (`vexpress-A15`). The output files are stored in the `$(pwd)/images/qemu` directory. You can find more information about running the generated image in the QEMU section of this readme file. |
|
101 | 104 |
@@ -193,6 +193,11 else | |||
|
193 | 193 | echo "enable_uart=0" >> "${BOOT_DIR}/config.txt" |
|
194 | 194 | fi |
|
195 | 195 | |
|
196 | # Disable dphys-swapfile service. Will get enabled on first boot | |
|
197 | if [ "$ENABLE_DPHYSSWAP" = true ] ; then | |
|
198 | chroot_exec systemctl disable dphys-swapfile | |
|
199 | fi | |
|
200 | ||
|
196 | 201 | if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then |
|
197 | 202 | # Create temporary directory for systemd-swap sources |
|
198 | 203 | temp_dir=$(as_nobody mktemp -d) |
@@ -8,30 +8,35 | |||
|
8 | 8 | # Prepare rc.firstboot script |
|
9 | 9 | cat files/firstboot/10-begin.sh > "${ETC_DIR}/rc.firstboot" |
|
10 | 10 | |
|
11 | # Ensure openssh server host keys are regenerated on first boot | |
|
12 | if [ "$ENABLE_SSHD" = true ] ; then | |
|
13 | cat files/firstboot/21-generate-ssh-keys.sh >> "${ETC_DIR}/rc.firstboot" | |
|
14 | fi | |
|
15 | ||
|
16 | 11 | # Prepare filesystem auto expand |
|
17 | 12 | if [ "$EXPANDROOT" = true ] ; then |
|
18 | 13 | if [ "$ENABLE_CRYPTFS" = false ] ; then |
|
19 |
cat files/firstboot/2 |
|
|
14 | cat files/firstboot/20-expandroot.sh >> "${ETC_DIR}/rc.firstboot" | |
|
20 | 15 | else |
|
21 | 16 | # Regenerate initramfs to remove encrypted root partition auto expand |
|
22 |
cat files/firstboot/2 |
|
|
17 | cat files/firstboot/21-regenerate-initramfs.sh >> "${ETC_DIR}/rc.firstboot" | |
|
18 | fi | |
|
19 | ||
|
20 | # Restart dphys-swapfile so the size of the swap file is relative to the resized root partition | |
|
21 | if [ "$ENABLE_DPHYSSWAP" = true ] ; then | |
|
22 | cat files/firstboot/23-restart-dphys-swapfile.sh >> "${ETC_DIR}/rc.firstboot" | |
|
23 | fi | |
|
23 | 24 |
|
|
25 | ||
|
26 | # Ensure openssh server host keys are regenerated on first boot | |
|
27 | if [ "$ENABLE_SSHD" = true ] ; then | |
|
28 | cat files/firstboot/30-generate-ssh-keys.sh >> "${ETC_DIR}/rc.firstboot" | |
|
24 | 29 | fi |
|
25 | 30 | |
|
26 | 31 | # Ensure that dbus machine-id exists |
|
27 |
cat files/firstboot/ |
|
|
32 | cat files/firstboot/40-generate-machineid.sh >> "${ETC_DIR}/rc.firstboot" | |
|
28 | 33 | |
|
29 | 34 | # Create /etc/resolv.conf symlink |
|
30 |
cat files/firstboot/ |
|
|
35 | cat files/firstboot/41-create-resolv-symlink.sh >> "${ETC_DIR}/rc.firstboot" | |
|
31 | 36 | |
|
32 | 37 | # Configure automatic network interface names |
|
33 | 38 | if [ "$ENABLE_IFNAMES" = true ] ; then |
|
34 |
cat files/firstboot/2 |
|
|
39 | cat files/firstboot/42-config-ifnames.sh >> "${ETC_DIR}/rc.firstboot" | |
|
35 | 40 | fi |
|
36 | 41 | |
|
37 | 42 | # Finalize rc.firstboot script |
@@ -66,11 +66,3 EOF2 | |||
|
66 | 66 | partprobe && |
|
67 | 67 | resize2fs /dev/${ROOT_PART} && |
|
68 | 68 | logger -t "rc.firstboot" "Root partition successfully resized." |
|
69 | ||
|
70 | # Restart dphys-swapfile service if it exists | |
|
71 | if systemctl list-units | grep -q dphys-swapfile ; then | |
|
72 | if systemctl is-enabled dphys-swapfile ; then | |
|
73 | logger -t "rc.firstboot" "Restarting dphys-swapfile" | |
|
74 | systemctl restart dphys-swapfile | |
|
75 | fi | |
|
76 | fi |
|
1 | NO CONTENT: file renamed from files/firstboot/23-regenerate-initramfs.sh to files/firstboot/21-regenerate-initramfs.sh |
|
1 | NO CONTENT: file renamed from files/firstboot/21-generate-ssh-keys.sh to files/firstboot/30-generate-ssh-keys.sh |
|
1 | NO CONTENT: file renamed from files/firstboot/24-generate-machineid.sh to files/firstboot/40-generate-machineid.sh |
|
1 | NO CONTENT: file renamed from files/firstboot/25-create-resolv-symlink.sh to files/firstboot/41-create-resolv-symlink.sh |
|
1 | NO CONTENT: file renamed from files/firstboot/26-config-ifnames.sh to files/firstboot/42-config-ifnames.sh |
@@ -97,6 +97,7 USER_PASSWORD=${USER_PASSWORD:=raspberry} | |||
|
97 | 97 | DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"} |
|
98 | 98 | TIMEZONE=${TIMEZONE:="Europe/Berlin"} |
|
99 | 99 | EXPANDROOT=${EXPANDROOT:=true} |
|
100 | ENABLE_DPHYSSWAP=${ENABLE_DPHYSSWAP:=true} | |
|
100 | 101 | |
|
101 | 102 | # Keyboard settings |
|
102 | 103 | XKB_MODEL=${XKB_MODEL:=""} |
@@ -542,6 +543,11 if [ "$EXPANDROOT" = true ] ; then | |||
|
542 | 543 | APT_INCLUDES="${APT_INCLUDES},parted" |
|
543 | 544 | fi |
|
544 | 545 | |
|
546 | # Add dphys-swapfile package, required to enable swap | |
|
547 | if [ "$ENABLE_DPHYSSWAP" = true ] ; then | |
|
548 | APT_INCLUDES="${APT_INCLUDES},dphys-swapfile" | |
|
549 | fi | |
|
550 | ||
|
545 | 551 | # Add dbus package, recommended if using systemd |
|
546 | 552 | if [ "$ENABLE_DBUS" = true ] ; then |
|
547 | 553 | APT_INCLUDES="${APT_INCLUDES},dbus" |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant