Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 267109 Details for
Bug 357729
sys-apps/openrc: bashism in init scripts
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for /etc/init.d/cgconfig
cgconfig.patch (text/plain), 3.26 KB, created by
Christian
on 2011-03-24 17:18:23 UTC
(
hide
)
Description:
patch for /etc/init.d/cgconfig
Filename:
MIME Type:
Creator:
Christian
Created:
2011-03-24 17:18:23 UTC
Size:
3.26 KB
patch
obsolete
>--- /usr/portage/tree/official/dev-libs/libcgroup/files/cgconfig.initd 2011-03-05 18:35:52.000000000 +0100 >+++ /etc/init.d/cgconfig 2011-03-24 16:36:59.456984290 +0100 >@@ -13,18 +13,18 @@ > RULES_FILE="/etc/cgroup/cgrules.conf" > > # Support multiple mount points >-MAX_INDEX=0 >-declare -a MOUNT_POINTS MOUNT_OPTIONS >+#MAX_INDEX=0 >+local MOUNT_POINTS MOUNT_OPTIONS > > move_all_to_init_class() { > local i >- for i in $(seq 1 ${MAX_INDEX}); do >- cd ${MOUNT_POINTS[$i]} >+ for i in ${MOUNT_POINTS}; do >+ cd ${i} > >- if grep -qw ${MOUNT_POINTS[$i]} ${MOUNTS_FILE}; then >+ if grep -qw ${i} ${MOUNTS_FILE}; then > local directory > for directory in $(find . -depth -type d); do >- if [[ ${directory} != "." ]]; then >+ if [ ${directory} != "." ]; then > # cat fails with "Argument list too long" error > sed -nu p < ${directory}/tasks > tasks > rmdir ${directory} >@@ -41,19 +41,19 @@ > parse_mounts() { > local device mount_point fs_type options other > while read device mount_point fs_type options other; do >- if grep -q ${device} <<< ${CGROUP_FS}; then >- let MAX_INDEX++ >- MOUNT_POINTS[${MAX_INDEX}]=${mount_point} >- MOUNT_OPTIONS[${MAX_INDEX}]=${options} >+ if [ "${fs_type}" = "${CGROUP_FS}" ]; then >+ #let MAX_INDEX++ >+ MOUNT_POINTS="${MOUNT_POINTS} ${mount_point}" >+ MOUNT_OPTIONS="${MOUNT_OPTIONS} ${options}" > fi > done < ${MOUNTS_FILE} > } > > umount_fs() { > local i >- for i in $(seq 1 ${MAX_INDEX}); do >- umount ${MOUNT_POINTS[$i]} >- rmdir ${MOUNT_POINTS[$i]} >+ for i in ${MOUNT_POINTS}; do >+ umount ${i} >+ rmdir ${i} > done > } > >@@ -74,38 +74,40 @@ > > # Find default cgroup name in rules file > local default_cgroup >- if [[ -f ${RULES_FILE} ]]; then >+ if [ -f ${RULES_FILE} ]; then > local user controller >- read user controller default_cgroup <<< $(grep -m1 ^\* ${RULES_FILE}) >- if [[ $default_cgroup == "*" ]]; then >+ read user controller default_cgroup <<E >+$(grep -m1 ^* ${RULES_FILE}) >+E >+ if [ "$default_cgroup" = "*" ]; then > ewarn "${RULES_FILE} incorrect" > ewarn "Overriding it" > default_cgroup= > fi > fi > # Use predefined name if none was found >- if [[ -z ${default_cgroup} ]]; then >+ if [ -z ${default_cgroup} ]; then > default_cgroup=sysdefault > fi > > # Create a default cgroup for tasks to return back to > local i >- for i in $(seq 1 ${MAX_INDEX}); do >+ for i in ${MOUNT_POINTS}; do > # Ignore if directory already exists >- mkdir -p ${MOUNT_POINTS[$i]}/${default_cgroup} >- find ${MOUNT_POINTS[$i]}/ -name tasks | xargs chmod a+rw >- chmod go-w ${MOUNT_POINTS[$i]}/tasks >+ mkdir -p ${i}/${default_cgroup} >+ find ${i}/ -name tasks | xargs chmod a+rw >+ chmod go-w ${i}/tasks > > # Special rule for cpusets >- if grep -qw cpuset <<< ${MOUNT_OPTIONS[$i]}; then >- cat ${MOUNT_POINTS[$i]}/cpuset.cpus > ${MOUNT_POINTS[$i]}/${default_cgroup}/cpuset.cpus >- cat ${MOUNT_POINTS[$i]}/cpuset.mems > ${MOUNT_POINTS[$i]}/${default_cgroup}/cpuset.mems >+ if grep -qw cpuset < ${i}; then >+ cat ${i}/cpuset.cpus > ${i}/${default_cgroup}/cpuset.cpus >+ cat ${i}/cpuset.mems > ${i}/${default_cgroup}/cpuset.mems > fi > > # Classify everything to default cgroup > local j > for j in $(ps --no-headers -eL o tid); do >- echo $j > ${MOUNT_POINTS[$i]}/${default_cgroup}/tasks 2>/dev/null >+ echo $j > ${i}/${default_cgroup}/tasks 2>/dev/null > done > done >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 357729
:
265117
|
265119
|
265275
|
267109
|
267111