commit: 4afe3e67f65cd7e1cf910b02c25fb0bb6dbc0a1a Author: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org> AuthorDate: Thu Mar 15 18:49:04 2018 +0000 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org> CommitDate: Thu Mar 15 18:49:04 2018 +0000 URL: https://gitweb.gentoo.org/proj/livecd-tools.git/commit/?id=4afe3e67
add some comments when writing make.conf decrease ambiguity with some comments init.d/autoconfig | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/init.d/autoconfig b/init.d/autoconfig index 848a102..fd68011 100644 --- a/init.d/autoconfig +++ b/init.d/autoconfig @@ -382,6 +382,12 @@ detect_netdevices() { return 0 } +write_emerge_default_opts() { + printf "\n# EMERGE_DEFAULT_OPTS is set automatically by livecd-tools autoconfig during first live boot.\n" >> $1 + printf "# This should be equal to number of processors, see \"man emerge\" for details.\n" >> $1 + printf "EMERGE_DEFAULT_OPTS=\"\${EMERGE_DEFAULT_OPTS} --jobs=${numcpu} --load-average=${numcpu}\"\n" >> $1 +} + start() { ebegin "Starting autoconfig" echo "0" > /proc/sys/kernel/printk @@ -392,13 +398,13 @@ start() { 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 + write_emerge_default_opts /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 + write_emerge_default_opts /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 + write_emerge_default_opts /etc/portage/make.conf/livecd-tools-autoconfig fi else false