summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes/10-script_dropper.inc
blob: 62d1b58ec67e35af95c1cc48a737bcbf7b06e26f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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"
}