diff options
author | cperciva <cperciva@FreeBSD.org> | 2009-12-30 06:28:47 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2009-12-30 06:28:47 +0000 |
commit | 0fabff56c275bf0c079062f5391b09d459e25c25 (patch) | |
tree | 3dc580f50fcd52fea3682d20d39de6181f4d49d5 /usr.sbin | |
parent | 55e0fdf678c1bd5ef1fe790a10be38286ad08ad1 (diff) | |
download | FreeBSD-src-0fabff56c275bf0c079062f5391b09d459e25c25.zip FreeBSD-src-0fabff56c275bf0c079062f5391b09d459e25c25.tar.gz |
Add undocumented 'portsnap alfred' command, which runs (fetch|cron)
based on whether fd 0 is a terminal, and then runs (extract|update)
based on whether ${PORTSDIR} exists.
Requested by: alfred
MFC after: 1 month
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/portsnap/portsnap/portsnap.sh | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh index 0660b41..f554809 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.sh +++ b/usr.sbin/portsnap/portsnap/portsnap.sh @@ -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 |