public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Richard Farina" <zerochaos@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/livecd-tools:master commit in: init.d/
Date: Thu, 15 Mar 2018 03:51:11 +0000 (UTC)	[thread overview]
Message-ID: <1521085804.30c14caa2b383d7ce5a41019c01fbb77a6e04c17.zerochaos@gentoo> (raw)

commit:     30c14caa2b383d7ce5a41019c01fbb77a6e04c17
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 03:50:04 2018 +0000
Commit:     Richard Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 03:50:04 2018 +0000
URL:        https://gitweb.gentoo.org/proj/livecd-tools.git/commit/?id=30c14caa

update make.conf with some nice defaults for emerge

just for fun, try to sane up the EMERGE_DEFAULT_OPTS for livecd users

 init.d/autoconfig | 23 ++++++++++++++++++++---
 1 file 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


             reply	other threads:[~2018-03-15  3:51 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15  3:51 Richard Farina [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-27 16:57 [gentoo-commits] proj/livecd-tools:master commit in: init.d/ Ben Kohler
2021-07-29  4:05 Georgy Yakovlev
2021-02-25 23:12 Ben Kohler
2020-11-06  0:58 Matt Turner
2020-11-06  0:29 Matt Turner
2020-11-05 23:49 Matt Turner
2020-11-05 23:49 Matt Turner
2020-11-05 23:49 Matt Turner
2020-04-23 18:08 Rick Farina
2019-09-20 19:32 Matt Turner
2019-09-20 19:32 Matt Turner
2018-09-14  5:27 Matt Turner
2018-08-24 14:57 Richard Farina
2018-03-16  1:07 Richard Farina
2018-03-15 18:49 Richard Farina
2018-03-15 17:07 Richard Farina
2018-03-15  4:34 William Hubbs
2017-08-28 18:43 Richard Farina
2017-02-25  0:50 Robin H. Johnson
2016-07-09  4:27 William Hubbs
2015-12-11 17:53 William Hubbs
2015-12-11 17:53 William Hubbs
2015-11-01 20:44 Richard Farina
2014-05-22 16:30 Richard Farina
2013-07-05 21:55 William Hubbs
2013-07-05 21:46 William Hubbs
2013-01-03 18:20 William Hubbs
2012-10-03 14:17 William Hubbs
2011-10-25  2:37 William Hubbs
2011-09-19  1:41 Jorge Manuel B. S. Vicetto
2011-06-30 20:29 William Hubbs
2011-06-30 20:12 William Hubbs
2011-06-28  5:22 William Hubbs
2011-06-28  5:18 William Hubbs
2011-06-28  5:13 William Hubbs
2011-05-01  3:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1521085804.30c14caa2b383d7ce5a41019c01fbb77a6e04c17.zerochaos@gentoo \
    --to=zerochaos@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox