patch_profile() { local script="/root/installer/firstrun_script.sh" [ -x "$script" ] || perror "Firstrun script not found ($script)" if grep -qF "$script" /root/.profile; then echo "# first_run script already in root's .profile, doing nothing." else echo "# Patching root's .profile" echo "$script" >> /root/.profile fi } drop_script() { mkdir -p "/root/installer" # So we know all the paths and the mysql password cat "${BASEDIR}/includes/00-dirs.inc" "${CONFIGDIR}/config" > "/root/installer/config" chmod 0600 /root/installer/config } drop_firstrun_script () { patch_profile drop_script systemctl daemon-reload systemctl enable firstboot.service || perror "Could not enable firstboot service" }