Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Jan 2011 08:14:47 +0000 (UTC)
From:      Alfred Perlstein <alfred@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r218060 - stable/8/usr.sbin/portsnap/portsnap
Message-ID:  <201101290814.p0T8ElWG023548@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alfred
Date: Sat Jan 29 08:14:47 2011
New Revision: 218060
URL: http://svn.freebsd.org/changeset/base/218060

Log:
  MFC: 'alfred' command.

Modified:
  stable/8/usr.sbin/portsnap/portsnap/portsnap.sh

Modified: stable/8/usr.sbin/portsnap/portsnap/portsnap.sh
==============================================================================
--- stable/8/usr.sbin/portsnap/portsnap/portsnap.sh	Sat Jan 29 07:22:33 2011	(r218059)
+++ stable/8/usr.sbin/portsnap/portsnap/portsnap.sh	Sat Jan 29 08:14:47 2011	(r218060)
@@ -140,7 +140,7 @@ parse_cmdline() {
 			if [ ! -z "${SERVERNAME}" ]; then usage; fi
 			shift; SERVERNAME="$1"
 			;;
-		cron | extract | fetch | update)
+		cron | extract | fetch | update | alfred)
 			COMMANDS="${COMMANDS} $1"
 			;;
 		*)
@@ -1040,6 +1040,22 @@ cmd_update() {
 	update_run || exit 1
 }
 
+# Alfred command.  Run 'fetch' or 'cron' depending on
+# whether stdin is a terminal; then run 'update' or
+# 'extract' depending on whether ${PORTSDIR} exists.
+cmd_alfred() {
+    if [ -t 0 ]; then
+	cmd_fetch
+    else
+	cmd_cron
+    fi
+    if [ -d ${PORTSDIR} ]; then
+	cmd_update
+    else
+	cmd_extract
+    fi
+}
+
 #### Entry point
 
 # Make sure we find utilities from the base system



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101290814.p0T8ElWG023548>