File: cloudinitlocal.tmpl

package info (click to toggle)
cloud-init 25.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,412 kB
  • sloc: python: 135,894; sh: 3,883; makefile: 141; javascript: 30; xml: 22
file content (38 lines) | stat: -rwxr-xr-x 933 bytes parent folder | download | duplicates (2)
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
36
37
38
## template:jinja
#!/bin/sh

# PROVIDE: cloudinitlocal
{#
``cloudinitlocal`` purposefully does not depend on ``dsidentify``.
That makes it easy for image builders to disable ``dsidentify``.
#}
# REQUIRE: ldconfig cleanvar
# BEFORE:  NETWORKING cloudinit cloudconfig cloudfinal

. /etc/rc.subr

PATH="{{ prefix }}/sbin:{{ prefix }}/bin:/usr/sbin:/usr/bin:/sbin:/bin"

name="cloudinitlocal"
command="{{prefix}}/bin/cloud-init"
start_cmd="cloudlocal_start"
stop_cmd=":"
rcvar="cloudinit_enable"

cloudlocal_start()
{
    echo -n "${command} starting"
    if kenv -q kernel_options | grep -q 'cloud-init=disabled'; then
        warn "cloud-init is disabled via kernel_options."
    elif test -e {{prefix}}/etc/cloud/cloud-init.disabled; then
        warn "cloud-init is disabled via cloud-init.disabled file."
    else
        ${command} init --local
    fi
}

load_rc_config 'cloudinit'

: ${cloudinit_enable="NO"}

run_rc_command "$1"