50-firstboot.sh
63 lines
| 1.9 KiB
| application/x-sh
|
BashLexer
/ bootstrap.d / 50-firstboot.sh
Filip Pytloun
|
r56 | # | ||
# First boot actions | ||||
# | ||||
Jan Wagner
|
r67 | # Load utility functions | ||
Filip Pytloun
|
r56 | . ./functions.sh | ||
Jan Wagner
|
r67 | # Prepare rc.firstboot script | ||
drtyhlpr
|
r94 | cat files/firstboot/10-begin.sh > "${ETC_DIR}/rc.firstboot" | ||
Filip Pytloun
|
r56 | |||
Jan Wagner
|
r67 | # Prepare filesystem auto expand | ||
Filip Pytloun
|
r56 | if [ "$EXPANDROOT" = true ] ; then | ||
Jan Wagner
|
r82 | if [ "$ENABLE_CRYPTFS" = false ] ; then | ||
Yannick Schinko
|
r576 | cat files/firstboot/20-expandroot.sh >> "${ETC_DIR}/rc.firstboot" | ||
Jan Wagner
|
r82 | else | ||
# Regenerate initramfs to remove encrypted root partition auto expand | ||||
Yannick Schinko
|
r576 | cat files/firstboot/21-regenerate-initramfs.sh >> "${ETC_DIR}/rc.firstboot" | ||
Jan Wagner
|
r82 | fi | ||
Yannick Schinko
|
r576 | |||
# Restart dphys-swapfile so the size of the swap file is relative to the resized root partition | ||||
if [ "$ENABLE_DPHYSSWAP" = true ] ; then | ||||
cat files/firstboot/23-restart-dphys-swapfile.sh >> "${ETC_DIR}/rc.firstboot" | ||||
fi | ||||
fi | ||||
# Ensure openssh server host keys are regenerated on first boot | ||||
Unknown
|
r732 | if [ "$SSH_ENABLE" = true ] ; then | ||
Yannick Schinko
|
r576 | cat files/firstboot/30-generate-ssh-keys.sh >> "${ETC_DIR}/rc.firstboot" | ||
Filip Pytloun
|
r56 | fi | ||
Unknown
|
r732 | if [ "$ENABLE_DBUS" = true ] ; then | ||
Jan Wagner
|
r73 | # Ensure that dbus machine-id exists | ||
Yannick Schinko
|
r520 | cat files/firstboot/40-generate-machineid.sh >> "${ETC_DIR}/rc.firstboot" | ||
Unknown
|
r732 | fi | ||
Jan Wagner
|
r73 | |||
# Create /etc/resolv.conf symlink | ||||
Yannick Schinko
|
r520 | cat files/firstboot/41-create-resolv-symlink.sh >> "${ETC_DIR}/rc.firstboot" | ||
Jan Wagner
|
r73 | |||
drtyhlpr
|
r92 | # Configure automatic network interface names | ||
if [ "$ENABLE_IFNAMES" = true ] ; then | ||||
Yannick Schinko
|
r520 | cat files/firstboot/42-config-ifnames.sh >> "${ETC_DIR}/rc.firstboot" | ||
drtyhlpr
|
r92 | fi | ||
Vincent KULAK
|
r741 | # Execute custom firstboot scripts | ||
if [ -d "custom.d/firstboot" ] ; then | ||||
for SCRIPT in custom.d/firstboot/*.sh; do | ||||
. "$SCRIPT" | ||||
done | ||||
fi | ||||
Jan Wagner
|
r67 | # Finalize rc.firstboot script | ||
drtyhlpr
|
r94 | cat files/firstboot/99-finish.sh >> "${ETC_DIR}/rc.firstboot" | ||
chmod +x "${ETC_DIR}/rc.firstboot" | ||||
Filip Pytloun
|
r56 | |||
drtyhlpr
|
r92 | # Install default rc.local if it does not exist | ||
drtyhlpr
|
r94 | if [ ! -f "${ETC_DIR}/rc.local" ] ; then | ||
install_exec files/etc/rc.local "${ETC_DIR}/rc.local" | ||||
drtyhlpr
|
r92 | fi | ||
Jan Wagner
|
r67 | # Add rc.firstboot script to rc.local | ||
drtyhlpr
|
r94 | sed -i '/exit 0/d' "${ETC_DIR}/rc.local" | ||
echo /etc/rc.firstboot >> "${ETC_DIR}/rc.local" | ||||
echo exit 0 >> "${ETC_DIR}/rc.local" | ||||