|

楼主 |
发表于 2005-5-4 00:54:35
|
显示全部楼层
刚才修改了一下,然后用 Gentoo 的配置文件试验了一把,成功了 
- $ ls
- cfgpri
- $ cat cfgpri
- #!/bin/sh
- # int sourcefile(file f)
- sourcefile()
- {
- local tmpfile='/tmp/dipmtcfg'
- local varname
- local line
- rm -f $tmpfile
- for i in `grep -n '^[^#]' $1 | sed 's/:.*//'` ; do
- varname=`sed -n $i','${i}p $1 | sed 's/^[ ]*//
- s/[ ]*=.*//'`
- line=`sed -n $i','${i}p $1 | sed 's/^[ ]*//
- s/[ ]*=[ ]*/=/'`
- echo "if test -z $varname ; then $line ; done" >>$tmpfile
- done
- cat $tmpfile
- }
- # int sourcecfg(file cfg1, file cfg2, ...)
- sourcecfg()
- {
- :
- }
- sourcefile $1
- $ cat ~/tmp/make.globals
- # Copyright 1999-2004 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
- # $Header: /var/cvsroot/gentoo-src/portage/cnf/make.globals,v 1.56.2.3 2005/04/17 09:01:55 jstubbs Exp $
- # System-wide defaults for the Portage system
- # *****************************
- # ** DO NOT EDIT THIS FILE **
- # ***************************************************
- # **** CHANGES TO make.conf *OVERRIDE* THIS FILE ****
- # ***************************************************
- # ** Incremental Variables Accumulate Across Files **
- # ** USE, CONFIG_*, and FEATURES are incremental **
- # ***************************************************
- # Default rsync mirror
- SYNC="rsync://rsync.gentoo.org/gentoo-portage"
- # Default distfiles mirrors
- GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
- # Repository Paths
- PORTDIR=/usr/portage
- DISTDIR=/usr/portage/distfiles
- PKGDIR=/usr/portage/packages
- RPMDIR=/usr/portage/rpm
- # Temporary build directory
- PORTAGE_TMPDIR=/var/tmp
- # Fetching command (5 tries, passive ftp for firewall compatibility)
- FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp -P \${DISTDIR} \${URI}"
- RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp -P \${DISTDIR} \${URI}"
- # Default user options
- FEATURES="sandbox distlocks"
- # Default chunksize for binhost comms
- PORTAGE_BINHOST_CHUNKSIZE="3000"
- # By default wait 5 secs before cleaning a package
- CLEAN_DELAY="5"
- # By default wait 10 secs on an important warning
- EMERGE_WARNING_DELAY="10"
- # Automatically clean installed packages after they are updated.
- # This option will be removed and forced to yes.
- AUTOCLEAN="yes"
- # Number of times 'emerge --sync' will run before giving up.
- RSYNC_RETRIES="3"
- # Number of seconds rsync will wait before timing out.
- RSYNC_TIMEOUT="180"
- # *****************************
- # ** DO NOT EDIT THIS FILE **
- # ***************************************************
- # **** CHANGES TO make.conf *OVERRIDE* THIS FILE ****
- # ***************************************************
- # ** Incremental Variables Accumulate Across Files **
- # ** USE, CONFIG_*, and FEATURES are incremental **
- # ***************************************************
- $ ./cfgpri ~/tmp/make.globals
- if test -z SYNC ; then SYNC="rsync://rsync.gentoo.org/gentoo-portage" ; done
- if test -z GENTOO_MIRRORS ; then GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" ; done
- if test -z PORTDIR ; then PORTDIR=/usr/portage ; done
- if test -z DISTDIR ; then DISTDIR=/usr/portage/distfiles ; done
- if test -z PKGDIR ; then PKGDIR=/usr/portage/packages ; done
- if test -z RPMDIR ; then RPMDIR=/usr/portage/rpm ; done
- if test -z PORTAGE_TMPDIR ; then PORTAGE_TMPDIR=/var/tmp ; done
- if test -z FETCHCOMMAND ; then FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp -P \${DISTDIR} \${URI}" ; done
- if test -z RESUMECOMMAND ; then RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp -P \${DISTDIR} \${URI}" ; done
- if test -z FEATURES ; then FEATURES="sandbox distlocks" ; done
- if test -z PORTAGE_BINHOST_CHUNKSIZE ; then PORTAGE_BINHOST_CHUNKSIZE="3000" ; done
- if test -z CLEAN_DELAY ; then CLEAN_DELAY="5" ; done
- if test -z EMERGE_WARNING_DELAY ; then EMERGE_WARNING_DELAY="10" ; done
- if test -z AUTOCLEAN ; then AUTOCLEAN="yes" ; done
- if test -z RSYNC_RETRIES ; then RSYNC_RETRIES="3" ; done
- if test -z RSYNC_TIMEOUT ; then RSYNC_TIMEOUT="180" ; done
- $
复制代码 |
|