diff options
author | 2018-03-14 23:50:04 -0400 | |
---|---|---|
committer | 2018-03-14 23:50:04 -0400 | |
commit | 30c14caa2b383d7ce5a41019c01fbb77a6e04c17 (patch) | |
tree | e8a2a671903940e5d105020a2c9835e9622d41bc | |
parent | log in as user when possible (diff) | |
download | livecd-tools-30c14caa2b383d7ce5a41019c01fbb77a6e04c17.tar.gz livecd-tools-30c14caa2b383d7ce5a41019c01fbb77a6e04c17.tar.bz2 livecd-tools-30c14caa2b383d7ce5a41019c01fbb77a6e04c17.zip |
update make.conf with some nice defaults for emerge
just for fun, try to sane up the EMERGE_DEFAULT_OPTS for livecd users
-rw-r--r-- | init.d/autoconfig | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/init.d/autoconfig b/init.d/autoconfig index 71e1deb..715350e 100644 --- a/init.d/autoconfig +++ b/init.d/autoconfig @@ -179,8 +179,8 @@ check_svc() { elif [ -n "${3}" ] && rc-service -e "${3}" then echo "${3}" - fi - fi + fi + fi } # Prints an ordered list of services that will be started by autoconfig. @@ -386,12 +386,29 @@ start() { ebegin "Starting autoconfig" echo "0" > /proc/sys/kernel/printk get_config + local numcpu="$(grep -c '^processor[[:space:]]\+:' /proc/cpuinfo)" + eindent + ebegin "Setting sane defaults in /etc/portage/make.conf" + if [ -f "/etc/portage/make.conf" ] && checkpath -W /etc/portage/make.conf; then + if ! grep -q 'EMERGE_DEFAULT_OPTS=.*--jobs' /etc/portage/make.conf; then + printf "EMERGE_DEFAULT_OPTS=\"\${EMERGE_DEFAULT_OPTS} --jobs=${numcpu} --load-average=${numcpu}\"\n" >> /etc/portage/make.conf + fi + elif [ ! -f "/etc/portage/make.conf" ] && [ ! -d "/etc/portage/make.conf" ] && checkpath -W /etc/portage; then + printf "EMERGE_DEFAULT_OPTS=\"\${EMERGE_DEFAULT_OPTS} --jobs=${numcpu} --load-average=${numcpu}\"\n" >> /etc/portage/make.conf + elif [ -d "/etc/portage/make.conf" ]; then + if [ ! -f "/etc/portage/make.conf/livecd-tools-autoconfig" ] && checkpath -W /etc/portage/make.conf/livecd-tools-autoconfig; then + printf "EMERGE_DEFAULT_OPTS=\"\${EMERGE_DEFAULT_OPTS} --jobs=${numcpu} --load-average=${numcpu}\"\n" >> /etc/portage/make.conf/livecd-tools-autoconfig + fi + else + false + fi + eend $? "Unable to write to /etc/portage/make.conf" + eoutdent if yesno "${DETECT}" then eindent ebegin "Hardware detection started" - local numcpu="$(grep -c '^processor[[:space:]]\+:' /proc/cpuinfo)" local arch="$(uname -m)" case ${arch} in |