summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2000-07-10 13:40:08 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2000-07-10 13:40:08 +0000
commit3af264c879d3ad4d22ec9bddaf8933debb3294c9 (patch)
treeecedd99d9bf819e04d9b3e95bab206fb25fcce48 /Tools
parentUpgrade to 1.6.2.2. (diff)
Add "-s" (silent) option useful for shell scripts.
Notes
Notes: svn path=/head/; revision=30441
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/checknewver.sh59
1 files changed, 41 insertions, 18 deletions
diff --git a/Tools/scripts/checknewver.sh b/Tools/scripts/checknewver.sh
index e6d061b83d22..60202086201a 100755
--- a/Tools/scripts/checknewver.sh
+++ b/Tools/scripts/checknewver.sh
@@ -5,7 +5,7 @@
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp):
-# Maxim Sobolev <sobomax@altavista.net wrote this file. As long as you retain
+# Maxim Sobolev <sobomax@FreeBSD.org wrote this file. As long as you retain
# this notice you can do whatever you want with this stuff. If we meet some
# day, and you think this stuff is worth it, you can buy me a beer in return.
#
@@ -16,40 +16,63 @@
#
# MAINTAINER= sobomax@FreeBSD.org
-if [ x`which ftpls` = x"" ]; then
- echo -n "ERROR: Couldn't find ftpls program, which is part of " >&2
- echo "ports/ftp/ftpcopy port." >&2
- echo " Please make sure that it is installed and try again." >&2
+display_warn () {
+ if [ x"${SILENT}" != x"yes" ]; then
+ echo "WARN: ${@}" >&2
+ fi
+}
+
+display_err () {
+ if [ x"${SILENT}" != x"yes" ]; then
+ echo "ERROR: ${@}" >&2
+ fi
exit 1
+}
+
+display_msg () {
+ if [ x"${SILENT}" != x"yes" ]; then
+ echo "${@}" >&2
+ fi
+}
+
+while getopts "s" COMMAND_LINE_ARGUMENT ; do
+ case "${COMMAND_LINE_ARGUMENT}" in
+ s)
+ SILENT=yes
+ ;;
+ esac
+done
+
+if [ x`which ftpls` = x"" ]; then
+ display_err "Couldn't find ftpls program, which is part of" \
+ "ports/ftp/ftpcopy port. Please make sure that it is installed" \
+ "and try again."
fi
if [ ! -e Makefile ]; then
- echo "ERROR: Couldn't find Makefile here." >&2
- exit 1
+ display_err "Couldn't find Makefile here."
fi
PORTNAME=`make -V PORTNAME`
PORTVERSION=`make -V PORTVERSION`
DISTFILES=`make -V DISTFILES`
if [ x"${PORTNAME}" = x"" -o x"${PORTVERSION}" = x"" -o x"${DISTFILES}" = x"" ]; then
- echo "ERROR: either PORTNAME, PORTVERSION or DISTFILES is undefined in Makefile." >&2
- exit 1
+ display_err "Either PORTNAME, PORTVERSION or DISTFILES is undefined in Makefile."
fi
MASTER_SITES=`env MASTER_SITE_BACKUP=\"\" make -V MASTER_SITES | xargs -n1 echo | grep ^ftp://`
if [ x"${MASTER_SITES}" = x"" ]; then
- echo "ERROR: either MASTER_SITES is undefined in Makefile or it doesn't contain any ftp sites." >&2
- exit 1
+ display_err "Either MASTER_SITES is undefined in Makefile or it doesn't contain any ftp sites."
fi
-echo "Checking for updated version of ${PORTNAME}..." >&2
+display_msg "Checking for updated version of ${PORTNAME}..."
PV_PATR=`echo ${PORTVERSION} | sed 's=\.=\\\\.=g'`
for DISTNAME in ${DISTFILES}; do
DF_PATR=`echo ${DISTNAME} | sed "s=${PV_PATR}=.*=" | \
sed 's=\.=\\\\.=g ; s=\\\.\*=.*='`
DF_CHECK=`echo ${DISTNAME} | sed 's=\.=\\\\.=g`
if [ x"${DF_PATR}" = x"${DF_CHECK}" ]; then
- echo "WARN: Couldn't construct searching pattern - ${DISTNAME} ignored." >&2
+ display_warn "Couldn't construct searching pattern - ${DISTNAME} ignored."
else
DF_PATRNS="${DF_PATRNS} ${DF_PATR}"
F_DISTFILES="${F_DISTFILES} ${DISTNAME}"
@@ -57,14 +80,14 @@ for DISTNAME in ${DISTFILES}; do
done
if [ x"${F_DISTFILES}" = x"" ]; then
- echo "WARN: Nothing to check - exitting." >&2
+ display_warn "Nothing to check - exitting."
exit 0
fi
DISTFILES="${F_DISTFILES}"
for MASTER_SITE in ${MASTER_SITES}; do
- echo "...checking ${MASTER_SITE}" >&2
+ display_msg "...checking ${MASTER_SITE}"
FTPLIST=`ftpls ${MASTER_SITE} 2>/dev/null | grep -v ^dir | awk '{print $6}'`
for DISTNAME in ${DISTFILES}; do
DF_PATR=`echo ${DISTNAME} | sed "s=${PV_PATR}=.*=" | \
@@ -78,8 +101,8 @@ for MASTER_SITE in ${MASTER_SITES}; do
done
if [ x"${NEW}" != x"" ]; then
- echo ""
- echo "Hmm, is seems that there is newest version(s) at:"
+ display_msg ""
+ display_msg "Hmm, is seems that there is newest version(s) at:"
echo "${NEW}" | xargs -n1 echo
- echo ""
+ display_msg ""
fi