diff options
| author | Sankar Tanguturi <stanguturi@stanguturi-rhel> | 2016-03-17 14:30:46 -0700 |
|---|---|---|
| committer | Sankar Tanguturi <stanguturi@stanguturi-rhel> | 2016-03-17 14:30:46 -0700 |
| commit | f1f0619010ec59b0ad2641e6d2faf0ae2ce8a09f (patch) | |
| tree | 4719aaa98096cb1b062b29768888eb1fa3785fc8 /systemd/cloud-init-generator | |
| parent | 13a32d7599a939370ee0bc0e7257da2c59b4bd61 (diff) | |
| parent | 56402e91e95960f54a39eb18cbda391f00f95b6e (diff) | |
| download | vyos-cloud-init-f1f0619010ec59b0ad2641e6d2faf0ae2ce8a09f.tar.gz vyos-cloud-init-f1f0619010ec59b0ad2641e6d2faf0ae2ce8a09f.zip | |
- Merged with trunk.
Diffstat (limited to 'systemd/cloud-init-generator')
| -rwxr-xr-x | systemd/cloud-init-generator | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/systemd/cloud-init-generator b/systemd/cloud-init-generator index 9d1e22f0..2d319695 100755 --- a/systemd/cloud-init-generator +++ b/systemd/cloud-init-generator @@ -3,7 +3,7 @@ set -f LOG="" DEBUG_LEVEL=1 -LOG_D="/run" +LOG_D="/run/cloud-init" ENABLE="enabled" DISABLE="disabled" CLOUD_SYSTEM_TARGET="/lib/systemd/system/cloud-init.target" @@ -17,7 +17,8 @@ debug() { [ "$lvl" -gt "$DEBUG_LEVEL" ] && return if [ -z "$LOG" ]; then local log="$LOG_D/${0##*/}.log" - { : > "$log"; } >/dev/null 2>&1 && LOG="$log" || + { [ -d "$LOG_D" ] || mkdir -p "$LOG_D"; } && + { : > "$log"; } >/dev/null 2>&1 && LOG="$log" || LOG="/dev/kmsg" fi echo "$@" >> "$LOG" @@ -32,15 +33,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 + if { _RET=$(tr '\0' ' ' < /proc/1/cmdline); } 2>/dev/null; then + _RET_MSG="container[$ctname]: pid 1 cmdline" + return + fi _RET="" + _RET_MSG="container[$ctname]: pid 1 cmdline not available" return 0 fi |
