-
Notifications
You must be signed in to change notification settings - Fork 856
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BSD: add dsidentify to early startup scripts (#4182)
in #4159, we removed the artifically restricted datasource_list for BSD. This can now lead in some cases to very long boot times. In this patch we add an RC script for ds-identify, similarly to how it's run in systemd's generator stage. The script is added in such a way that it will run before cloudinitlocal, but can easily be removed by people building custom images. Additionally, the rc scripts are now templated. This makes it now easier for ports / pkgsrc users to move cloud-init package from the standard `$LOCALBASE` to another location. Sponsored by: The FreeBSD Foundation
- Loading branch information
Showing
15 changed files
with
174 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,5 +181,3 @@ main() { | |
} | ||
|
||
main "$@" | ||
|
||
# vi: ts=4 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
sysvinit/freebsd/cloudinitlocal → sysvinit/freebsd/cloudinitlocal.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## template:jinja | ||
#!/bin/sh | ||
|
||
# PROVIDE: dsidentify | ||
{# | ||
once we are correctly using ``paths.run_dir`` / ``paths.get_runpath()`` in the | ||
python code-base, we can start thinking about how to bring that into | ||
``ds-identify`` itself, and then!, then we can depend on (``REQUIRE``) | ||
``var_run`` instead of ``mountcritlocal`` here. | ||
#} | ||
# REQUIRE: mountcritlocal | ||
# BEFORE: cloudinitlocal | ||
|
||
. /etc/rc.subr | ||
|
||
PATH="{{ prefix }}/sbin:{{ prefix }}/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
|
||
name="dsidentify" | ||
command="{{ prefix }}/lib/cloud-init/ds-identify" | ||
start_cmd="dsidentify_start" | ||
stop_cmd=":" | ||
rcvar="cloudinit_enable" | ||
|
||
dsidentify_start() | ||
{ | ||
echo "${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-init.disabled; then | ||
warn "cloud-init is disabled via cloud-init.disabled file." | ||
else | ||
${command} | ||
fi | ||
} | ||
|
||
load_rc_config 'cloudinit' | ||
|
||
: ${cloudinit_enable="NO"} | ||
|
||
run_rc_command "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## template:jinja | ||
#!/bin/sh | ||
|
||
# PROVIDE: dsidentify | ||
# REQUIRE: CRITLOCALMOUNTED | ||
# BEFORE: cloudinitlocal | ||
|
||
$_rc_subr_loaded . /etc/rc.subr | ||
|
||
name="dsidentify" | ||
start_cmd="start_dsidentify" | ||
start_dsidentify() | ||
{ | ||
test -e {{prefix}}/etc/cloud/cloud-init.disabled \ | ||
&& warn "cloud-init disabled by cloud-init.disabled file" \ | ||
&& exit 0 | ||
{{prefix}}/lib/cloud-init/ds-identify | ||
} | ||
|
||
load_rc_config $name | ||
run_rc_command "$1" |
Oops, something went wrong.