@@ -1,54 +1,61 | |||
|
1 | 1 | # |
|
2 | 2 | # First boot actions |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | # Prepare rc.firstboot script |
|
9 | 9 | cat files/firstboot/10-begin.sh > "${ETC_DIR}/rc.firstboot" |
|
10 | 10 | |
|
11 | 11 | # Prepare filesystem auto expand |
|
12 | 12 | if [ "$EXPANDROOT" = true ] ; then |
|
13 | 13 | if [ "$ENABLE_CRYPTFS" = false ] ; then |
|
14 | 14 | cat files/firstboot/20-expandroot.sh >> "${ETC_DIR}/rc.firstboot" |
|
15 | 15 | else |
|
16 | 16 | # Regenerate initramfs to remove encrypted root partition auto expand |
|
17 | 17 | cat files/firstboot/21-regenerate-initramfs.sh >> "${ETC_DIR}/rc.firstboot" |
|
18 | 18 | fi |
|
19 | 19 | |
|
20 | 20 | # Restart dphys-swapfile so the size of the swap file is relative to the resized root partition |
|
21 | 21 | if [ "$ENABLE_DPHYSSWAP" = true ] ; then |
|
22 | 22 | cat files/firstboot/23-restart-dphys-swapfile.sh >> "${ETC_DIR}/rc.firstboot" |
|
23 | 23 | fi |
|
24 | 24 | fi |
|
25 | 25 | |
|
26 | 26 | # Ensure openssh server host keys are regenerated on first boot |
|
27 | 27 | if [ "$ENABLE_SSHD" = true ] ; then |
|
28 | 28 | cat files/firstboot/30-generate-ssh-keys.sh >> "${ETC_DIR}/rc.firstboot" |
|
29 | 29 | fi |
|
30 | 30 | |
|
31 | 31 | # Ensure that dbus machine-id exists |
|
32 | 32 | cat files/firstboot/40-generate-machineid.sh >> "${ETC_DIR}/rc.firstboot" |
|
33 | 33 | |
|
34 | 34 | # Create /etc/resolv.conf symlink |
|
35 | 35 | cat files/firstboot/41-create-resolv-symlink.sh >> "${ETC_DIR}/rc.firstboot" |
|
36 | 36 | |
|
37 | 37 | # Configure automatic network interface names |
|
38 | 38 | if [ "$ENABLE_IFNAMES" = true ] ; then |
|
39 | 39 | cat files/firstboot/42-config-ifnames.sh >> "${ETC_DIR}/rc.firstboot" |
|
40 | 40 | fi |
|
41 | 41 | |
|
42 | # Execute custom firstboot scripts | |
|
43 | if [ -d "custom.d/firstboot" ] ; then | |
|
44 | for SCRIPT in custom.d/firstboot/*.sh; do | |
|
45 | . "$SCRIPT" | |
|
46 | done | |
|
47 | fi | |
|
48 | ||
|
42 | 49 | # Finalize rc.firstboot script |
|
43 | 50 | cat files/firstboot/99-finish.sh >> "${ETC_DIR}/rc.firstboot" |
|
44 | 51 | chmod +x "${ETC_DIR}/rc.firstboot" |
|
45 | 52 | |
|
46 | 53 | # Install default rc.local if it does not exist |
|
47 | 54 | if [ ! -f "${ETC_DIR}/rc.local" ] ; then |
|
48 | 55 | install_exec files/etc/rc.local "${ETC_DIR}/rc.local" |
|
49 | 56 | fi |
|
50 | 57 | |
|
51 | 58 | # Add rc.firstboot script to rc.local |
|
52 | 59 | sed -i '/exit 0/d' "${ETC_DIR}/rc.local" |
|
53 | 60 | echo /etc/rc.firstboot >> "${ETC_DIR}/rc.local" |
|
54 | 61 | echo exit 0 >> "${ETC_DIR}/rc.local" |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant