From owner-svn-src-user@FreeBSD.ORG Mon Dec 6 10:58:13 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 E1FCB1065672; Mon, 6 Dec 2010 10:58:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0F4B8FC20; Mon, 6 Dec 2010 10:58:13 +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 oB6AwDtR030800; Mon, 6 Dec 2010 10:58:13 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB6AwDHb030798; Mon, 6 Dec 2010 10:58:13 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201012061058.oB6AwDHb030798@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 6 Dec 2010 10:58:13 +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: r216228 - user/ae/usr.sbin/sade 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: Mon, 06 Dec 2010 10:58:14 -0000 Author: ae Date: Mon Dec 6 10:58:13 2010 New Revision: 216228 URL: http://svn.freebsd.org/changeset/base/216228 Log: Add "title" field to describe what task is doing. Modified: user/ae/usr.sbin/sade/ufsed.c Modified: user/ae/usr.sbin/sade/ufsed.c ============================================================================== --- user/ae/usr.sbin/sade/ufsed.c Mon Dec 6 10:24:06 2010 (r216227) +++ user/ae/usr.sbin/sade/ufsed.c Mon Dec 6 10:58:13 2010 (r216228) @@ -91,6 +91,11 @@ struct ufsinfo { char *mntonname; /* current mountpoint */ }; +struct ufsed_history_entry { + char *title; + char *cmd; +}; + static int ufslist_add(struct ufslist *, struct de_device *, struct de_part *); static void ufslist_free(struct ufslist *); static int ufslist_count(struct ufslist *); @@ -227,11 +232,20 @@ set_statusline(char *msg) } } +static void +ufsed_history_free(struct ufsed_history_entry *entry) +{ + + free(entry->title); + free(entry->cmd); + free(entry); +} + static int ufsed_history_rollback(void *pentry) { - free(pentry); + ufsed_history_free((struct ufsed_history_entry *)pentry); return (0); } @@ -240,7 +254,7 @@ ufsed_history_play(void *pentry) { /* system(pentry); */ - free(pentry); + ufsed_history_free((struct ufsed_history_entry *)pentry); return (0); } @@ -253,14 +267,17 @@ ufslist_reread(struct ufslist *fslist) } static int -ufsed_history_add(history_t hist, const char *cmd) +ufsed_history_add(history_t hist, const char *title, const char *cmd) { - char *entry; + struct ufsed_history_entry *entry; - entry = strdup(cmd); + entry = malloc(sizeof(*entry)); if (entry == NULL) return (ENOMEM); - + entry->title = strdup(title); + entry->cmd = strdup(cmd); + if (entry->cmd == NULL || entry->title == NULL) + ufsed_history_free(entry); return (history_add_entry(hist, entry)); } @@ -289,7 +306,7 @@ ufsed_tunefs(history_t hist, struct ufsi WINDOW *win; uint32_t flags; int q, h, w, ret, i; - char buf[CMDLEN_MAX], *s; + char buf[CMDLEN_MAX], *s, *prompt; struct { DLG_CHECKBOX *item; uint32_t flag; @@ -306,9 +323,9 @@ ufsed_tunefs(history_t hist, struct ufsi win = savescr(); dlg_init(&dlg); - snprintf(buf, sizeof(buf), - "Change a file system parameters for \"%s\":", pfs->partname); - dlg_add_label(&dlg, 1, 2, 55, 2, buf); + asprintf(&prompt, "Change file system parameters for \"%s\":", + pfs->partname); + dlg_add_label(&dlg, 1, 2, 55, 2, prompt); eLabel = dlg_add_edit(&dlg, 3, 2, 24, "Volume Label:", MAXVOLLEN, pfs->volname); for (i = 0; i < sizeof(checkbox) / sizeof(checkbox[0]); i++) @@ -395,7 +412,7 @@ again: snprintf(buf, sizeof(buf), "%s %s%s", buf, _PATH_DEV, pfs->partname); /* add command to history */ - ret = ufsed_history_add(hist, buf); + ret = ufsed_history_add(hist, prompt, buf); if (ret) dmenu_open_errormsg("Operation failed."); else { /* do fake changes to update current view */ @@ -411,6 +428,7 @@ done: restorescr(win); dlg_close_dialog(&dlg); dlg_free(&dlg); + free(prompt); } static void @@ -425,7 +443,7 @@ ufsed_newfs(history_t hist, struct ufsin WINDOW *win; uint64_t num, tmp; int q, h, w, ret, i; - char buf[CMDLEN_MAX], *s, *volname; + char buf[CMDLEN_MAX], *s, *volname, *prompt; struct { DLG_CHECKBOX *item; uint32_t flag; @@ -444,9 +462,8 @@ ufsed_newfs(history_t hist, struct ufsin win = savescr(); dlg_init(&dlg); - snprintf(buf, sizeof(buf), - "Create new file system on \"%s\":", pfs->partname); - dlg_add_label(&dlg, 1, 2, 55, 2, buf); + asprintf(&prompt, "Create new file system on \"%s\":", pfs->partname); + dlg_add_label(&dlg, 1, 2, 55, 2, prompt); eLabel = dlg_add_edit(&dlg, 3, 2, 24, "Volume Label:", MAXVOLLEN, NULL); eBlock = dlg_add_edit(&dlg, 7, 2, 24, "Block Size:", 8, "16384"); @@ -570,7 +587,7 @@ again: } snprintf(buf, sizeof(buf), "%s %s%s", buf, _PATH_DEV, pfs->partname); /* add newfs command to history */ - ret = ufsed_history_add(hist, buf); + ret = ufsed_history_add(hist, prompt, buf); if (ret) dmenu_open_errormsg("Operation failed."); else { /* do fake changes to update current view */ @@ -598,7 +615,10 @@ again: if (num > 0) { snprintf(buf, sizeof(buf), "%s %s%s", buf, _PATH_DEV, pfs->partname); - ret = ufsed_history_add(hist, buf); + free(prompt); + asprintf(&prompt, "Change file system parameters for \"%s\":", + pfs->partname); + ret = ufsed_history_add(hist, prompt, buf); if (ret) dmenu_open_errormsg("Operation failed."); else { /* do fake changes to update current view */ @@ -609,6 +629,7 @@ done: restorescr(win); dlg_close_dialog(&dlg); dlg_free(&dlg); + free(prompt); } From owner-svn-src-user@FreeBSD.ORG Tue Dec 7 17:54:04 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 CB626106566C; Tue, 7 Dec 2010 17:54:04 +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 BC04B8FC12; Tue, 7 Dec 2010 17:54:04 +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 oB7Hs42M075549; Tue, 7 Dec 2010 17:54:04 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB7Hs4uC075547; Tue, 7 Dec 2010 17:54:04 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201012071754.oB7Hs4uC075547@svn.freebsd.org> From: Doug Barton Date: Tue, 7 Dec 2010 17:54:04 +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: r216260 - user/dougb/portmaster/files 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, 07 Dec 2010 17:54:04 -0000 Author: dougb Date: Tue Dec 7 17:54:04 2010 New Revision: 216260 URL: http://svn.freebsd.org/changeset/base/216260 Log: In the section about doing a complete version upgrade encourage users to back up critical files in /usr/local before completely blowing it away. Inspired by [1] While I'm here add -t to the recommended --clean-distfiles-all command. PR: ports/152167 Submitted by: Ben Grimm Modified: user/dougb/portmaster/files/portmaster.8 Modified: user/dougb/portmaster/files/portmaster.8 ============================================================================== --- user/dougb/portmaster/files/portmaster.8 Tue Dec 7 17:36:17 2010 (r216259) +++ user/dougb/portmaster/files/portmaster.8 Tue Dec 7 17:54:04 2010 (r216260) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 30, 2010 +.Dd December 7, 2010 .Dt PORTMASTER 8 .Os .Sh NAME @@ -796,15 +796,17 @@ Using to do a complete reinstallation of all your ports: .Dl "1. portmaster --list-origins > ~/installed-port-list" .Dl "2. Update your ports tree" -.Dl "3. portmaster --clean-distfiles-all" +.Dl "3. portmaster -t --clean-distfiles-all" .Dl "4. portmaster --check-port-dbdir" .Dl "5. portmaster -Faf" .Dl "6. pkg_delete '*'" .Dl "7. rm -rf /usr/local/lib/compat/pkg" -.Dl "8. Manually check /usr/local and /var/db/pkg" +.Dl "8. Back up any files in /usr/local you wish to save," +.Dl " such as configuration files in /usr/local/etc" +.Dl "9. Manually check /usr/local and /var/db/pkg" .Dl " to make sure that they are really empty" -.Dl "9. Re-install portmaster" -.Dl "10. portmaster `cat ~/installed-port-list`" +.Dl "10. Re-install portmaster" +.Dl "11. portmaster `cat ~/installed-port-list`" .Pp You probably want to use the -D option for the installation and then run --clean-distfiles[-all] again when you are done. From owner-svn-src-user@FreeBSD.ORG Wed Dec 8 07:32:17 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 C70EE106566B; Wed, 8 Dec 2010 07:32:17 +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 B73A28FC08; Wed, 8 Dec 2010 07:32:17 +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 oB87WHlU094373; Wed, 8 Dec 2010 07:32:17 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB87WHe2094371; Wed, 8 Dec 2010 07:32:17 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201012080732.oB87WHe2094371@svn.freebsd.org> From: Doug Barton Date: Wed, 8 Dec 2010 07:32:17 +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: r216289 - 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: Wed, 08 Dec 2010 07:32:18 -0000 Author: dougb Date: Wed Dec 8 07:32:17 2010 New Revision: 216289 URL: http://svn.freebsd.org/changeset/base/216289 Log: Move the getopts routine up to the point right after the --options processing. The -v option was already in use by --check-port-dbdir, and -t was in use by --clean-distfiles. Moving getopts up allows us to use the standard routine rather than duplicating code. More importantly, this will allow us to use getopts flags earlier in other places, and form the basis for some new work. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Wed Dec 8 07:10:25 2010 (r216288) +++ user/dougb/portmaster/portmaster Wed Dec 8 07:32:17 2010 (r216289) @@ -426,6 +426,7 @@ pm_v () { [ -n "$PM_VERBOSE pm_sv () { [ -n "$PM_SU_VERBOSE" ] && echo "===>>> SU $*"; } #=============== End functions we always want to have =============== +#=============== Begin Command Line Option Processing =============== packages_init () { local e1 e2 e3 @@ -517,14 +518,119 @@ for var in "$@" ; do esac done -unset var - [ -n "$PM_INDEX" -a -n "$CHECK_PORT_DBDIR" ] && fail 'The --index* and --check-port-dbdir options are mutually exclusive' [ -n "$PM_PACKAGES_LOCAL" -a -z "$LOCAL_PACKAGEDIR" ] && fail 'The --packages-local option requires --local-packagedir to be defined' +set -- $newopts +unset var newopts + +# Save switches for potential child processes +while getopts 'BCDFGHKLPRabde:fghilm:nop:r:stuvwx:' COMMAND_LINE_ARGUMENT ; do + case "${COMMAND_LINE_ARGUMENT}" in + B) NO_BACKUP=Bopt; ARGS="-B $ARGS" ;; + C) DONT_PRE_CLEAN=Copt; ARGS="-C $ARGS" ;; + D) DONT_SCRUB_DISTFILES=Dopt; ARGS="-D $ARGS" ;; + F) FETCH_ONLY=Fopt; ARGS="-F $ARGS" ;; + G) [ -z "$PM_FORCE_CONFIG" ] && { + PM_NO_MAKE_CONFIG=Gopt; ARGS="-G $ARGS"; } ;; + H) HIDE_BUILD=Hopt; ARGS="-H $ARGS" ;; + K) DONT_POST_CLEAN=Kopt; ARGS="-K $ARGS" ;; + L) LIST_PLUS=Lopt ;; + P) packages_init first ;; + R) RESTART=Ropt ; ARGS="-R $ARGS" ;; + a) UPDATE_ALL=aopt ;; + b) BACKUP=bopt; ARGS="-b $ARGS" ;; + d) ALWAYS_SCRUB_DISTFILES=dopt; ARGS="-d $ARGS" ;; + e) EXPUNGE=$OPTARG ;; + f) export PM_FORCE=fopt ;; + g) MAKE_PACKAGE=gopt; ARGS="-g $ARGS" ;; + h) usage 0 ;; + i) INTERACTIVE_UPDATE=iopt; ARGS="-i $ARGS" ;; + l) LIST=lopt ;; + m) export PM_MAKE_ARGS=$OPTARG # For 'make checksum' + ARGS="-m $PM_MAKE_ARGS $ARGS" ;; + n) NO_ACTION=nopt; ARGS="-n $ARGS" ;; + o) REPLACE_ORIGIN=oopt ;; + p) fail 'The -p option has been deprecated' ;; + r) UPDATE_REQ_BYS=ropt + if [ -d "$pdb/$OPTARG" ]; then + glob_dirs=$OPTARG + else + find_glob_dirs $OPTARG + case $? in + 1) fail "$pdb/$OPTARG does not exist" ;; + 2) fail 'The argument to -r must match only one port' ;; + esac + fi + PM_RBP=${glob_dirs##*/} ; unset glob_dirs + portdir=`origin_from_pdb $PM_RBP` ;; + s) CLEAN_STALE=sopt ;; + t) RECURSE_THOROUGH=topt; ARGS="-t $ARGS" ;; + u) fail 'The -u option has been deprecated' ;; + v) PM_VERBOSE=vopt; ARGS="-v $ARGS" ;; + w) SAVE_SHARED=wopt; ARGS="-w $ARGS" ;; + x) case "$OPTARG" in + -*) fail 'The -x option requires an argument' ;; + esac + PM_EXCL="${PM_EXCL}`globstrip ${OPTARG}` " ;; + *) echo '' ; echo "===>>> Try ${0##*/} --help"; exit 1 ;; + esac +done +shift $(( $OPTIND - 1 )) + +[ -n "$UNATTENDED" ] && fail 'The -u option has been deprecated' + +[ -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" +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 "$PM_NO_MAKE_CONFIG" -a -n "$PM_FORCE_CONFIG" ] && unset PM_NO_MAKE_CONFIG + +if [ -n "$LIST" -o -n "$LIST_PLUS" ]; then + if [ -n "$FETCH_ONLY" -o -n "$RESTART" -o -n "$UPDATE_ALL" -o \ + -n "$EXPUNGE" -o -n "$PM_FORCE" -o -n "$NO_ACTION" -o \ + -n "$REPLACE_ORIGIN" -o -n "$UPDATE_REQ_BYS" -o -n "$CLEAN_STALE" ]; then + fail 'The -[lL] options are not compatible with -FRaefnors' + fi + [ $# -gt 0 ] && fail 'The -[lL] options are not compatible with updates or installs' +fi + +unset my_environment COMMAND_LINE_ARGUMENT +unset -f packages_init cross_idx test_command_line + +#=============== End Command Line Option Processing =============== + # Do this here so it can use the fancy functions above, and default values # can be overridden in the rc files if [ "$$" -eq "$PM_PARENT_PID" ]; then @@ -637,9 +743,6 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then fi fi -set -- $newopts -unset var newopts - #=============== Begin functions relevant to --features and main =============== iport_from_origin () { @@ -1059,7 +1162,7 @@ if [ -n "$CLEAN_DISTFILES" ]; then # Set the file name here since we are usually called in a subshell DI_FILES=`pm_mktemp DI-FILES` - if [ "$1" != '-t' ]; then + if [ -z "$RECURSE_THOROUGH" ]; then read_distinfos else read_distinfos_all @@ -1231,8 +1334,6 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then [ -d "$port_dbdir" ] || fail 'PORT_DBIR is empty, or the directory $port_dbdir does not exist' - if [ "$1" = "-v" ]; then PM_VERBOSE=vopt; fi - unique_list=':' echo "===>>> Building list of installed port names"; echo '' @@ -1296,109 +1397,6 @@ if [ -n "$LIST_ORIGINS" ]; then fi #=============== End code relevant only to --features =============== - -# Save switches for potential child processes -while getopts 'BCDFGHKLPRabde:fghilm:nop:r:stuvwx:' COMMAND_LINE_ARGUMENT ; do - case "${COMMAND_LINE_ARGUMENT}" in - B) NO_BACKUP=Bopt; ARGS="-B $ARGS" ;; - C) DONT_PRE_CLEAN=Copt; ARGS="-C $ARGS" ;; - D) DONT_SCRUB_DISTFILES=Dopt; ARGS="-D $ARGS" ;; - F) FETCH_ONLY=Fopt; ARGS="-F $ARGS" ;; - G) [ -z "$PM_FORCE_CONFIG" ] && { - PM_NO_MAKE_CONFIG=Gopt; ARGS="-G $ARGS"; } ;; - H) HIDE_BUILD=Hopt; ARGS="-H $ARGS" ;; - K) DONT_POST_CLEAN=Kopt; ARGS="-K $ARGS" ;; - L) LIST_PLUS=Lopt ;; - P) packages_init first ;; - R) RESTART=Ropt ; ARGS="-R $ARGS" ;; - a) UPDATE_ALL=aopt ;; - b) BACKUP=bopt; ARGS="-b $ARGS" ;; - d) ALWAYS_SCRUB_DISTFILES=dopt; ARGS="-d $ARGS" ;; - e) EXPUNGE=$OPTARG ;; - f) export PM_FORCE=fopt ;; - g) MAKE_PACKAGE=gopt; ARGS="-g $ARGS" ;; - h) usage 0 ;; - i) INTERACTIVE_UPDATE=iopt; ARGS="-i $ARGS" ;; - l) LIST=lopt ;; - m) export PM_MAKE_ARGS=$OPTARG # For 'make checksum' - ARGS="-m $PM_MAKE_ARGS $ARGS" ;; - n) NO_ACTION=nopt; ARGS="-n $ARGS" ;; - o) REPLACE_ORIGIN=oopt ;; - p) fail 'The -p option has been deprecated' ;; - r) UPDATE_REQ_BYS=ropt - if [ -d "$pdb/$OPTARG" ]; then - glob_dirs=$OPTARG - else - find_glob_dirs $OPTARG - case $? in - 1) fail "$pdb/$OPTARG does not exist" ;; - 2) fail 'The argument to -r must match only one port' ;; - esac - fi - PM_RBP=${glob_dirs##*/} ; unset glob_dirs - portdir=`origin_from_pdb $PM_RBP` ;; - s) CLEAN_STALE=sopt ;; - t) RECURSE_THOROUGH=topt; ARGS="-t $ARGS" ;; - u) fail 'The -u option has been deprecated' ;; - v) PM_VERBOSE=vopt; ARGS="-v $ARGS" ;; - w) SAVE_SHARED=wopt; ARGS="-w $ARGS" ;; - x) case "$OPTARG" in - -*) fail 'The -x option requires an argument' ;; - esac - PM_EXCL="${PM_EXCL}`globstrip ${OPTARG}` " ;; - *) echo '' ; echo "===>>> Try ${0##*/} --help"; exit 1 ;; - esac -done -shift $(( $OPTIND - 1 )) -unset -f packages_init cross_idx - -[ -n "$UNATTENDED" ] && fail 'The -u option has been deprecated' - -[ -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" -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 "$PM_NO_MAKE_CONFIG" -a -n "$PM_FORCE_CONFIG" ] && unset PM_NO_MAKE_CONFIG - -if [ -n "$LIST" -o -n "$LIST_PLUS" ]; then - if [ -n "$FETCH_ONLY" -o -n "$RESTART" -o -n "$UPDATE_ALL" -o \ - -n "$EXPUNGE" -o -n "$PM_FORCE" -o -n "$NO_ACTION" -o \ - -n "$REPLACE_ORIGIN" -o -n "$UPDATE_REQ_BYS" -o -n "$CLEAN_STALE" ]; then - fail 'The -[lL] options are not compatible with -FRaefnors' - fi - [ $# -gt 0 ] && fail 'The -[lL] options are not compatible with updates or installs' -fi -unset my_environment -unset -f test_command_line - #=============== Begin functions for getopts features and main =============== check_state () { From owner-svn-src-user@FreeBSD.ORG Wed Dec 8 08:01:27 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 A11601065679; Wed, 8 Dec 2010 08:01:27 +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 91BA28FC13; Wed, 8 Dec 2010 08:01:27 +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 oB881RVk095012; Wed, 8 Dec 2010 08:01:27 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB881RAw095010; Wed, 8 Dec 2010 08:01:27 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201012080801.oB881RAw095010@svn.freebsd.org> From: Doug Barton Date: Wed, 8 Dec 2010 08:01:27 +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: r216290 - 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: Wed, 08 Dec 2010 08:01:27 -0000 Author: dougb Date: Wed Dec 8 08:01:27 2010 New Revision: 216290 URL: http://svn.freebsd.org/changeset/base/216290 Log: Add a -y option to answer "Yes" to all dialogs that pose a yes/no question Begin implementation of this feature, and enhanced support for -n in the --check-depends feature. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Wed Dec 8 07:32:17 2010 (r216289) +++ user/dougb/portmaster/portmaster Wed Dec 8 08:01:27 2010 (r216290) @@ -528,7 +528,7 @@ set -- $newopts unset var newopts # Save switches for potential child processes -while getopts 'BCDFGHKLPRabde:fghilm:nop:r:stuvwx:' COMMAND_LINE_ARGUMENT ; do +while getopts 'BCDFGHKLPRabde:fghilm:nop:r:stuvwx:y' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in B) NO_BACKUP=Bopt; ARGS="-B $ARGS" ;; C) DONT_PRE_CLEAN=Copt; ARGS="-C $ARGS" ;; @@ -576,6 +576,7 @@ while getopts 'BCDFGHKLPRabde:fghilm:nop -*) fail 'The -x option requires an argument' ;; esac PM_EXCL="${PM_EXCL}`globstrip ${OPTARG}` " ;; + y) PM_YES=yopt; ARGS="-y $ARGS" ;; *) echo '' ; echo "===>>> Try ${0##*/} --help"; exit 1 ;; esac done @@ -870,10 +871,19 @@ IFS=' echo " ===>>> but there is no installed version" echo '' if [ -n "$CHECK_DEPENDS" ]; then - echo -n " ===>>> Delete this dependency data? y/n [n] " - read answer + if [ -z "$PM_YES" -a -z "$NO_ACTION" ]; then + echo -n " ===>>> Delete this dependency data? y/n [n] " + read answer + echo '' + else + if [ -n "$PM_YES" ]; then + answer=y + elif [ -n "$NO_ACTION" ]; then + answer=n + fi + fi case "$answer" in - [yY]) unset prev_line line ; echo '' ; continue ;; + [yY]) unset prev_line line ; continue ;; esac else echo " ===>>> Try ${0##*/} --check-depends"