mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +02:00
refactor(build_library): Add a function for enabling systemd units.
This commit is contained in:
parent
38fa0f92a8
commit
a93cb921d8
@ -104,6 +104,19 @@ emerge_to_image() {
|
|||||||
sudo -E ROOT="${root_fs_dir}" env-update
|
sudo -E ROOT="${root_fs_dir}" env-update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: systemd_enable /root default.target something.service
|
||||||
|
# Or: systemd_enable /root default.target some@.service some@thing.service
|
||||||
|
systemd_enable() {
|
||||||
|
local root_fs_dir="$1"
|
||||||
|
local target="$2"
|
||||||
|
local unit_file="$3"
|
||||||
|
local unit_alias="${4:-$3}"
|
||||||
|
local wants_dir="${root_fs_dir}/usr/lib/systemd/system/${target}.wants"
|
||||||
|
|
||||||
|
sudo mkdir -p "${wants_dir}"
|
||||||
|
sudo ln -sf "../${unit_file}" "${wants_dir}/${unit_alias}"
|
||||||
|
}
|
||||||
|
|
||||||
start_image() {
|
start_image() {
|
||||||
local image_name="$1"
|
local image_name="$1"
|
||||||
local disk_layout="$2"
|
local disk_layout="$2"
|
||||||
|
@ -94,9 +94,7 @@ EOF
|
|||||||
|
|
||||||
# Remount the system partition read-write by default.
|
# Remount the system partition read-write by default.
|
||||||
# The remount services are provided by coreos-base/coreos-init
|
# The remount services are provided by coreos-base/coreos-init
|
||||||
local fs_wants="${root_fs_dir}/usr/lib/systemd/system/local-fs.target.wants"
|
systemd_enable "${root_fs_dir}" "local-fs.target" "remount-usr.service"
|
||||||
sudo mkdir -p "${fs_wants}"
|
|
||||||
sudo ln -s ../remount-usr.service "${fs_wants}"
|
|
||||||
|
|
||||||
finish_image "${disk_layout}" "${root_fs_dir}" "${update_group}"
|
finish_image "${disk_layout}" "${root_fs_dir}" "${update_group}"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user