summaryrefslogtreecommitdiff
path: root/src/backend/f_modeswitch.sh
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-01-27 04:22:03 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-01-27 04:22:03 +0000
commit4461a01202018c5120d19f6b997e402f85ee66cd (patch)
treeec29bc7b9d2c4e1cf256110d7bf6e301bd91bffa /src/backend/f_modeswitch.sh
parent5ebe15d1c7588ac5784a874d68cdb556bff776a6 (diff)
* improve the MAKEOPTS variable adaptation from any value, not just defaults, to a value detected by $(getconf _NPROCESSORS_ONLN)HEADv2.1812.2masterlegacy
* expose new --adapt option so one can call it directly whenever CPU's are added or removed, or when CPU cores are enabled or disabled * document the new option in the --help menu * refactor some functions
Diffstat (limited to 'src/backend/f_modeswitch.sh')
-rw-r--r--src/backend/f_modeswitch.sh33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/backend/f_modeswitch.sh b/src/backend/f_modeswitch.sh
index b257daa..432aa7c 100644
--- a/src/backend/f_modeswitch.sh
+++ b/src/backend/f_modeswitch.sh
@@ -58,8 +58,8 @@ setjobs () {
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"/make.conf/00-makeopts.conf # global makeopts (exclude kernel)
- sed -i "s/\-j64/\-j$(getconf _NPROCESSORS_ONLN)/g" "$jailportcfgtarget"/env/makenoise.conf # kernel makeopts
+ sed -i "s/\-j\([0-9]\+\)/\-j$(getconf _NPROCESSORS_ONLN)/g" "$jailportcfgtarget"/make.conf/00-makeopts.conf # global makeopts (exclude kernel)
+ sed -i "s/\-j\([0-9]\+\)/\-j$(getconf _NPROCESSORS_ONLN)/g" "$jailportcfgtarget"/env/makenoise.conf # kernel makeopts
}
setprofile () {
@@ -68,22 +68,37 @@ setprofile () {
. /etc/profile
}
-reset () {
- checkifroot
+dopurge () {
delmainporttree
deladdonporttree
delportcfgtree
}
-setup () {
- checkifroot
- delmainporttree
- deladdonporttree
- delportcfgtree
+doinject () {
getmainporttree
getaddonporttree
getportcfgtree
+}
+
+dosetup () {
setportage
setjobs
setprofile
}
+
+adapt () {
+ checkifroot
+ setjobs
+}
+
+reset () {
+ checkifroot
+ dopurge
+}
+
+setup () {
+ checkifroot
+ dopurge
+ doinject
+ dosetup
+}