-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make entrypoint systemd instead of cmd
- Loading branch information
Showing
5 changed files
with
43 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#! env python3 | ||
""" | ||
Systemd entrypoint hack. | ||
Writes /cmd.sh from the arguments passed to the script. Then execve systemd so | ||
systemd will be process 1. The target rescue will execute /cmd.sh using /bin/sh. | ||
This is needed so our ENTRYPOINT can be systemd with a target and CMD can be | ||
customized at runtime as expected. | ||
""" | ||
from __future__ import annotations | ||
|
||
import os | ||
import sys | ||
|
||
with open("/cmd.sh", "w") as fp: | ||
fp.write(" ".join(sys.argv[1:])) | ||
os.environ["PYTHONPATH"] = os.pathsep.join(sys.path) | ||
cmd = "/usr/lib/systemd/systemd" | ||
if os.execve in os.supports_fd: | ||
with open(cmd, "rb") as fp: | ||
sys.stdout.flush() | ||
sys.stderr.flush() | ||
args = ["--systemd", "--unit=rescue.target"] | ||
os.execve(fp.fileno(), args, os.environ) | ||
else: | ||
args = [cmd, "--systemd", "--unit=rescue.target"] | ||
os.execve(cmd, args, os.environ) |
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 |
---|---|---|
@@ -1,7 +1,3 @@ | ||
include: | ||
- .config | ||
- .pkgs | ||
|
||
{%- if pillar.get('github_actions_runner', False) %} | ||
- github-actions-runner | ||
{%- endif %} |
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