chiark / gitweb /
tree-wide: drop !! casts to booleans
[elogind.git] / tools / meson-get-cg-controller.sh
1 #!/bin/sh -eu
2
3 if test -f /proc/self/cgroup; then
4         # If the init system is a cgroup controler, it will be position 1.
5         # Secondary controllers, like cgmanager, do not work.
6         with_cgroupctrl=$(grep "^1:name=" /proc/self/cgroup | \
7                         sed -n 's/.*=//p' | sed -e 's/:.*$//')
8         if test -z "$with_cgroupctrl"; then
9                 # Try to be our own cgroup controller
10                 with_cgroupctrl="elogind"
11         fi
12 else
13         # 'auto' but no cgroup fs is a problem.
14         with_cgroupctrl=""
15 fi
16
17 echo "$with_cgroupctrl"
18 exit 0