mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
contrib/check-config.sh: Remove awk dependency
The awk dependency is an issue when running check-config.sh on systems without awk. The use of awk can be replaced with sed, which improves portability. The PR code review discussion iterated via grep to this final sed version that is all Tianon Gravi's art. Co-authored-by: Tianon Gravi <admwiggin@gmail.com> Signed-off-by: Joakim Roubert <joakim.roubert@axis.com>
This commit is contained in:
parent
59e8ebd7f3
commit
ffc6d8d3dd
1 changed files with 1 additions and 1 deletions
|
@ -163,7 +163,7 @@ printf -- '- '
|
|||
if [ "$(stat -f -c %t /sys/fs/cgroup 2> /dev/null)" = '63677270' ]; then
|
||||
wrap_good 'cgroup hierarchy' 'cgroupv2'
|
||||
else
|
||||
cgroupSubsystemDir="$(awk '/[, ](cpu|cpuacct|cpuset|devices|freezer|memory)[, ]/ && $3 == "cgroup" { print $2 }' /proc/mounts | head -n1)"
|
||||
cgroupSubsystemDir="$(sed -rne '/^[^ ]+ ([^ ]+) cgroup ([^ ]*,)?(cpu|cpuacct|cpuset|devices|freezer|memory)[, ].*$/ { s//\1/p; q }' /proc/mounts)"
|
||||
cgroupDir="$(dirname "$cgroupSubsystemDir")"
|
||||
if [ -d "$cgroupDir/cpu" ] || [ -d "$cgroupDir/cpuacct" ] || [ -d "$cgroupDir/cpuset" ] || [ -d "$cgroupDir/devices" ] || [ -d "$cgroupDir/freezer" ] || [ -d "$cgroupDir/memory" ]; then
|
||||
echo "$(wrap_good 'cgroup hierarchy' 'properly mounted') [$cgroupDir]"
|
||||
|
|
Loading…
Reference in a new issue