summaryrefslogtreecommitdiff
path: root/src/backend/f_modeswitch.sh
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-05-16 23:29:07 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-05-16 23:32:08 +0100
commitf740c9c96890338cfc2c155ae331b525b66b71bc (patch)
tree22ad69b28ffa30fc2ceb069d3687075915036f9d /src/backend/f_modeswitch.sh
parentebd3bb8edd889d8f016303b5bbe3808299238985 (diff)
mixedmode && srcmode : auto adjust MAKEOPTS with a value detected by $(getconf _NPROCESSORS_ONLN)v1.1806
Diffstat (limited to 'src/backend/f_modeswitch.sh')
-rw-r--r--src/backend/f_modeswitch.sh32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/backend/f_modeswitch.sh b/src/backend/f_modeswitch.sh
index 4f6c271..90d6266 100644
--- a/src/backend/f_modeswitch.sh
+++ b/src/backend/f_modeswitch.sh
@@ -15,7 +15,7 @@ rmaddonporttree () {
}
rmportcfgtree () {
- einfo "I am removing ebuild tree configuration"
+ einfo "I am removing portage configuration"
rm ""$jailportcfgtarget"/make.conf" > /dev/null 2>&1
rm ""$jailportcfgtarget"/make.profile" > /dev/null 2>&1
rm "$jailportcfgtarget" > /dev/null 2>&1
@@ -81,7 +81,7 @@ dladdonportmintree () {
dlportcfgtree () {
pushd /opt > /dev/null 2>&1
- einfo "I am injecting ebuild tree configuration"
+ einfo "I am injecting portage configuration"
git clone https://gitlab.com/redcore/redcore-build.git
popd > /dev/null 2>&1
}
@@ -98,44 +98,54 @@ injectportfulltree () {
dlportcfgtree
}
-setbinmodecfg () {
- ln -sf "$jailportcfgsource" "$jailportcfgtarget"
- ln -sf "$jailportcfgtarget"/make.conf.amd64-binmode "$jailportcfgtarget"/make.conf
+setmakeopts () {
+ einfo "I am setting portage to use $(getconf _NPROCESSORS_ONLN) jobs to compile packages"
+ # default MAKEOPTS value is -j64, but that's overkill for lower spec machines
+ # this will adjust MAKEOPTS to a value detected by $(getconf _NPROCESSORS_ONLN)
+ sed -i "s/\-j64/\-j$(getconf _NPROCESSORS_ONLN)/g" "$jailportcfgtarget"/global.conf/makeopts.conf # global makeopts (exclude kernel)
+ sed -i "s/\-j64/\-j$(getconf _NPROCESSORS_ONLN)/g" "$jailportcfgtarget"/env/makenoise.conf # kernel makeopts
+}
+
+setprofile () {
eselect profile set default/linux/amd64/17.0/hardened
env-update
. /etc/profile
}
+setbinmodecfg () {
+ ln -sf "$jailportcfgsource" "$jailportcfgtarget"
+ ln -sf "$jailportcfgtarget"/make.conf.amd64-binmode "$jailportcfgtarget"/make.conf
+}
+
binmode () {
resetmode
injectportmintree
setbinmodecfg
+ setprofile
}
setmixedmodecfg () {
ln -sf "$jailportcfgsource" "$jailportcfgtarget"
ln -sf "$jailportcfgtarget"/make.conf.amd64-mixedmode "$jailportcfgtarget"/make.conf
- eselect profile set default/linux/amd64/17.0/hardened
- env-update
- . /etc/profile
}
mixedmode () {
resetmode
injectportfulltree
setmixedmodecfg
+ setmakeopts
+ setprofile
}
setsrcmodecfg () {
ln -sf "$jailportcfgsource" "$jailportcfgtarget"
ln -sf "$jailportcfgtarget"/make.conf.amd64-srcmode "$jailportcfgtarget"/make.conf
- eselect profile set default/linux/amd64/17.0/hardened
- env-update
- . /etc/profile
}
srcmode() {
resetmode
injectportfulltree
setsrcmodecfg
+ setmakeopts
+ setprofile
}