summaryrefslogtreecommitdiff
path: root/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'systemd')
-rwxr-xr-xsystemd/cloud-init-generator17
1 files changed, 9 insertions, 8 deletions
diff --git a/systemd/cloud-init-generator b/systemd/cloud-init-generator
index 9d1e22f0..b7a2f17a 100755
--- a/systemd/cloud-init-generator
+++ b/systemd/cloud-init-generator
@@ -32,15 +32,16 @@ etc_file() {
}
read_proc_cmdline() {
- if [ "$CONTAINER" = "lxc" ]; then
- _RET_MSG="ignored: \$container=$CONTAINER"
- _RET=""
- return 0
- fi
-
- if systemd-detect-virt --container --quiet; then
- _RET_MSG="ignored: detect-virt is container"
+ # return /proc/cmdline for non-container, and /proc/1/cmdline for container
+ local ctname="systemd"
+ if [ -n "$CONTAINER" ] && ctname=$CONTAINER || systemd-detect-virt --container --quiet; then
+ local
+ if _RET=$(tr '\0' ' ' < /proc/1/cmdline) >/dev/null 2>&1; then
+ _RET_MSG="container[$ctname]: pid 1 cmdline"
+ return
+ fi
_RET=""
+ _RET_MSG="container[$ctname]: pid 1 cmdline not available"
return 0
fi