##// END OF EJS Templates
Merge pull request #220 from VonOx/custom-firstboot...
drtyhlpr -
r743:55670e666952 Fusion
parent child
Show More
@@ -1,56 +1,63
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 [ "$SSH_ENABLE" = true ] ; then
27 if [ "$SSH_ENABLE" = 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 if [ "$ENABLE_DBUS" = true ] ; then
31 if [ "$ENABLE_DBUS" = true ] ; then
32 # Ensure that dbus machine-id exists
32 # Ensure that dbus machine-id exists
33 cat files/firstboot/40-generate-machineid.sh >> "${ETC_DIR}/rc.firstboot"
33 cat files/firstboot/40-generate-machineid.sh >> "${ETC_DIR}/rc.firstboot"
34 fi
34 fi
35
35
36 # Create /etc/resolv.conf symlink
36 # Create /etc/resolv.conf symlink
37 cat files/firstboot/41-create-resolv-symlink.sh >> "${ETC_DIR}/rc.firstboot"
37 cat files/firstboot/41-create-resolv-symlink.sh >> "${ETC_DIR}/rc.firstboot"
38
38
39 # Configure automatic network interface names
39 # Configure automatic network interface names
40 if [ "$ENABLE_IFNAMES" = true ] ; then
40 if [ "$ENABLE_IFNAMES" = true ] ; then
41 cat files/firstboot/42-config-ifnames.sh >> "${ETC_DIR}/rc.firstboot"
41 cat files/firstboot/42-config-ifnames.sh >> "${ETC_DIR}/rc.firstboot"
42 fi
42 fi
43
43
44 # Execute custom firstboot scripts
45 if [ -d "custom.d/firstboot" ] ; then
46 for SCRIPT in custom.d/firstboot/*.sh; do
47 . "$SCRIPT"
48 done
49 fi
50
44 # Finalize rc.firstboot script
51 # Finalize rc.firstboot script
45 cat files/firstboot/99-finish.sh >> "${ETC_DIR}/rc.firstboot"
52 cat files/firstboot/99-finish.sh >> "${ETC_DIR}/rc.firstboot"
46 chmod +x "${ETC_DIR}/rc.firstboot"
53 chmod +x "${ETC_DIR}/rc.firstboot"
47
54
48 # Install default rc.local if it does not exist
55 # Install default rc.local if it does not exist
49 if [ ! -f "${ETC_DIR}/rc.local" ] ; then
56 if [ ! -f "${ETC_DIR}/rc.local" ] ; then
50 install_exec files/etc/rc.local "${ETC_DIR}/rc.local"
57 install_exec files/etc/rc.local "${ETC_DIR}/rc.local"
51 fi
58 fi
52
59
53 # Add rc.firstboot script to rc.local
60 # Add rc.firstboot script to rc.local
54 sed -i '/exit 0/d' "${ETC_DIR}/rc.local"
61 sed -i '/exit 0/d' "${ETC_DIR}/rc.local"
55 echo /etc/rc.firstboot >> "${ETC_DIR}/rc.local"
62 echo /etc/rc.firstboot >> "${ETC_DIR}/rc.local"
56 echo exit 0 >> "${ETC_DIR}/rc.local"
63 echo exit 0 >> "${ETC_DIR}/rc.local"
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant