SYSLIBFILE=/lib/lsb/init-functions
OLDSYSLIBFILE=/etc/init.d/functions
if [[ -x $SYSLIBFILE ]] ; then
+ # shellcheck disable=SC1090
source $SYSLIBFILE
elif [[ -x $OLDSYSLIBFILE ]] ; then
+ # shellcheck disable=SC1090
source $OLDSYSLIBFILE
log_warning_msg() ( warning "$@" ; printf "\n" 1>&2 ; )
log_failure_msg() ( failure "$@" ; printf "\n" 1>&2 ; )
# read the config
CREATE_DEFAULT=yes
if [ -e /etc/sysconfig/cgconfig ]; then
+ # shellcheck disable=SC1091
source /etc/sysconfig/cgconfig
fi
defaultcgroup=
if [ -f /etc/cgrules.conf ]; then
- read user ctrl defaultcgroup <<< \
- $(grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf)
+ # shellcheck disable=SC2034
+ read -r user ctrl defaultcgroup <<< \
+ "$(grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf)"
if [[ ( -n "$defaultcgroup" ) && ( "$defaultcgroup" = "*" ) ]]; then
log_warning_msg "/etc/cgrules.conf incorrect"
log_warning_msg "Overriding it"
# Create the default group, ignore errors when the default group
# already exists.
#
- cgcreate -f 664 -d 775 -g $controllers:$defaultcgroup 2>/dev/null
+ cgcreate -f 664 -d 775 -g "$controllers":"$defaultcgroup" 2>/dev/null
#
# special rule for cpusets
#
- if echo $controllers | grep -q -w cpuset; then
+ if echo "$controllers" | grep -q -w cpuset; then
cpus=$(cgget -nv -r cpuset.cpus /)
- cgset -r cpuset.cpus=$cpus $defaultcgroup
+ cgset -r cpuset.cpus="$cpus $defaultcgroup"
mems=$(cgget -nv -r cpuset.mems /)
- cgset -r cpuset.mems=$mems $defaultcgroup
+ cgset -r cpuset.mems="$mems $defaultcgroup"
fi
#
# Classify everything to default cgroup. Ignore errors, some processes
# may exit after ps is run and before cgclassify moves them.
#
- cgclassify -g $controllers:$defaultcgroup $(ps --no-headers -eL o tid) \
+ cgclassify -g "$controllers:$defaultcgroup $(ps --no-headers -eL o tid)" \
2>/dev/null || :
}