summaryrefslogtreecommitdiff
path: root/sysvinit/freebsd/cloudinitlocal
blob: 854c79d658ede2fa692f4d3b9fb822017f3b68ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

# PROVIDE: cloudinitlocal
# REQUIRE: mountcritlocal 
# BEFORE:  NETWORKING FILESYSTEMS cloudinit cloudconfig cloudfinal

. /etc/rc.subr

name="cloudinitlocal"
command="/usr/bin/cloud-init"
start_cmd="cloudlocal_start"
stop_cmd=":"
rcvar="cloudinit_enable"
start_precmd="cloudinit_override"
start_cmd="cloudlocal_start"

: ${cloudinit_config}:="/etc/cloud/cloud.cfg"}


cloudinit_override()
{
	# If there exist sysconfig/default variable override files use it...
	if [ -f /etc/default/cloud-init ]; then
		. /etc/default/cloud-init
	fi
}

cloudlocal_start()
{
	echo -n "${command} starting"
	${command} ${cloudinit_config} init --local
}

load_rc_config $name
run_rc_command "$1"