From owner-svn-src-user@FreeBSD.ORG Tue Apr 6 05:53:54 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE16F106566C; Tue, 6 Apr 2010 05:53:54 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 939408FC13; Tue, 6 Apr 2010 05:53:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o365rshl063339; Tue, 6 Apr 2010 05:53:54 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o365rsP2063337; Tue, 6 Apr 2010 05:53:54 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201004060553.o365rsP2063337@svn.freebsd.org> From: Doug Barton Date: Tue, 6 Apr 2010 05:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206250 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2010 05:53:54 -0000 Author: dougb Date: Tue Apr 6 05:53:54 2010 New Revision: 206250 URL: http://svn.freebsd.org/changeset/base/206250 Log: For the command line options -d/-D and -b/-B, allow the command line version to override values the user has in ~/.portmaster rc For the -F/-G conflict, just unset -G. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Tue Apr 6 05:52:22 2010 (r206249) +++ user/dougb/portmaster/portmaster Tue Apr 6 05:53:54 2010 (r206250) @@ -36,6 +36,8 @@ if [ -z "$PM_PARENT_PID" ]; then [ -r "$HOME/.portmasterrc" ] && . $HOME/.portmasterrc set +o allexport + my_environment=`set` + # If we are already root, unset this to avoid potential conflict euid=`ps -o uid $$` ; euid=${euid##* } [ "$euid" -eq 0 ] && unset PM_SU_CMD PM_SU_VERBOSE @@ -1062,20 +1064,44 @@ unset -f packages_init [ -n "$PM_EXCL" ] && export PM_EXCL +test_command_line () { + local var envar + + for var in $my_environment; do + case "$var" in + ${1}=*) envar=$1 ;; + ${2}=*) envar=$2 ;; + esac + done + + if [ -n "$envar" ]; then + unset $envar + return 0 + fi + + return 1 +} + # Error checking for getopts [ -n "$PM_FORCE" -a "$INTERACTIVE_UPDATE" ] && fail "The -f and -i options are mutually exclusive" -[ -n "$BACKUP" -a -n "$NO_BACKUP" ] && - fail "The -b and -B options are mutually exclusive" -[ -n "$ALWAYS_SCRUB_DISTFILES" -a -n "$DONT_SCRUB_DISTFILES" ] && - fail "The -d and -D options are mutually exclusive" +if [ -n "$BACKUP" -a -n "$NO_BACKUP" ]; then + test_command_line NO_BACKUP BACKUP || + fail "The -b and -B options are mutually exclusive" +fi +if [ -n "$ALWAYS_SCRUB_DISTFILES" -a -n "$DONT_SCRUB_DISTFILES" ]; then + test_command_line ALWAYS_SCRUB_DISTFILES DONT_SCRUB_DISTFILES || + fail "The -d and -D options are mutually exclusive" +fi [ -n "$FETCH_ONLY" -a -n "$NO_RECURSIVE_CONFIG" ] && - fail "The -F and -G options are mutually exclusive" + unset NO_RECURSIVE_CONFIG [ -n "$NO_RECURSIVE_CONFIG" -a -n "$PM_PACKAGES_BUILD" ] && fail 'The --packages-build and -G options are mutually exclusive' [ -n "$NO_RECURSIVE_CONFIG" -a -n "$PM_DEL_BUILD_ONLY" ] && fail 'The --delete-build-only and -G options are mutually exclusive' +unset my_environment + #=============== Begin functions for getopts features and main =============== check_state () {