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