Changeset 249d4ad


Ignore:
Timestamp:
11/16/2023 03:10:46 PM (6 months ago)
Author:
Pierre Labastie <pierre.labastie@…>
Branches:
ablfs-more, trunk
Children:
078ef3c
Parents:
09ac7fc
Message:

Fix (again) the run-in-cgroup.sh script

When using "sh << EOF", what is between this line and EOF runs
with no attached terminal. But we need a terminal for running the
build. So we have to use "sh -c ". But then nesting of double
quotes, $, etc is too complicated. So run as root, and become back
user only when exec'ing. For some reason $@ does not work, so use
a variable set to $@.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/run-in-cgroup.sh

    r09ac7fc r249d4ad  
    55        exit 1
    66fi
     7
     8ARGS="$@"
    79
    810set +e
     
    1820   (
    1921      sudo sh -c "echo $BASHPID > /sys/fs/cgroup/jhalfs/cgroup.procs"
    20       sudo -u $(whoami) sh <<EOF
     22      sudo sh -c "
    2123         SESS_CGROUP=/sys/fs/cgroup/\$XDG_SESSION_ID
    22          sudo sh -c "echo \\"$CPUSPEC\\" > \$SESS_CGROUP/cpuset.cpus"
    23          (sudo sh -c "echo \$BASHPID > \$SESS_CGROUP/cgroup.procs" &&
    24             exec $@)
    25 EOF
     24         echo $CPUSPEC > \$SESS_CGROUP/cpuset.cpus
     25         ( echo \$BASHPID > \$SESS_CGROUP/cgroup.procs &&
     26                 exec sudo -u $(whoami) $ARGS )"
    2627   )
    2728   sudo rmdir /sys/fs/cgroup/jhalfs
Note: See TracChangeset for help on using the changeset viewer.