Skip to content

Commit

Permalink
systemd: generator: mv reboot flag file creation to generator
Browse files Browse the repository at this point in the history
We can't wait until the service runs to create the flag file
(`/run/coreos-installer-reboot`) because systemd unit conditions
are evaluated way before the coreos-installer.service runs. Let's
do it in the generator instead.
  • Loading branch information
dustymabe committed Jan 6, 2020
1 parent 2d61ae3 commit cb6dc61
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 13 additions & 0 deletions systemd/coreos-installer-generator
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@ karg() {
echo "${value}"
}

karg_bool() {
local value=$(karg "$@")
case "$value" in
""|0|no|off) return 1;;
*) return 0;;
esac
}

if [ -n "$(karg coreos.inst.install_dev)" ]; then
ln -sf "/usr/lib/systemd/system/coreos-installer.target" \
"${UNIT_DIR}/default.target"

# Create precondition for coreos-installer-reboot.service if requested
if ! karg_bool coreos.inst.skip_reboot; then
touch /run/coreos-installer-reboot
fi
fi
4 changes: 0 additions & 4 deletions systemd/coreos-installer-service
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,3 @@ udevadm settle
echo "coreos-installer ${args[@]}"
coreos-installer "${args[@]}"

# Create precondition for coreos-installer-reboot.service if requested
if ! karg_bool coreos.inst.skip_reboot; then
touch /run/coreos-installer-reboot
fi

0 comments on commit cb6dc61

Please sign in to comment.