public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Mueller (ulm)" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in app-admin/eselect-emacs/files: emacs-updater
Date: Sat, 08 Mar 2008 06:53:06 +0000	[thread overview]
Message-ID: <E1JXsva-0004El-Rq@stork.gentoo.org> (raw)

ulm         08/03/08 06:53:06

  Modified:             emacs-updater
  Log:
  Update emacs-updater to version 0.6.
  (Portage version: 2.1.4.4)

Revision  Changes    Path
1.3                  app-admin/eselect-emacs/files/emacs-updater

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-emacs/files/emacs-updater?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-emacs/files/emacs-updater?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-emacs/files/emacs-updater?r1=1.2&r2=1.3

Index: emacs-updater
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-admin/eselect-emacs/files/emacs-updater,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- emacs-updater	21 Feb 2008 11:06:20 -0000	1.2
+++ emacs-updater	8 Mar 2008 06:53:06 -0000	1.3
@@ -1,11 +1,14 @@
 #!/bin/bash
 
-# Licensed under GPL version 2
+# Copyright 2007-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: emacs-updater,v 1.3 2008/03/08 06:53:06 ulm Exp $
+
 # Authors:
 # Christian Faulhammer <opfer@gentoo.org>
 # Ulrich Mueller <ulm@gentoo.org>
 
-VERSION=0.4
+VERSION=0.6
 SITELISP=/usr/share/emacs/site-lisp
 TMPFILE="$(mktemp /tmp/emacs-updater.XXXXXX)"
 
@@ -17,32 +20,44 @@
 
 EOF
 
+usage() {
+    sed -e 's/^X//' <<-EOF
+	Usage: ${0##*/} [OPTION]...
+	X  -n, --nocolour   disable colour in output
+	X  -p, --pretend    don't actually emerge packages
+	X  -h, --help       display this help and exit
+	EOF
+    exit ${1}
+}
+
 # Read in all command-line options and force English output
 OPTIONS=$(LC_ALL=C getopt -o hpn --long help,pretend,nocolour \
      -n 'emacs-updater' -- "$@")
+[ $? -eq 0 ] || usage 1
 
 eval set -- "${OPTIONS}"
 
 while true
 do
     case "${1}" in
-	-h|--help) echo "You have the following options: --pretend|-p and/or --no-colour|-n" ; exit 0 ;;
-	-p|--pretend) PRETEND="true"; shift 1 ;;
-	-n|--nocolour) NOCOLOUR="true"; shift 1;;
-	--) shift ; break ;;
+	-h|--help)      usage 0 ;;
+	-p|--pretend)   PRETEND="true"; shift 1 ;;
+	-n|--nocolour)  NOCOLOUR="true"; shift 1 ;;
+	--)             shift; break ;;
     esac
 done
 
 # Only set colours if output is not redirected or the --no-colour
 # option is not set
-if tty -s <&1 && [ -z ${NOCOLOUR} ] ; then
-    BLUE=$'\e[34;01m'
-    GREEN=$'\e[32;01m'
-    RED=$'\e[31;01m'
-    YELLOW=$'\e[33;01m'
-    CYAN=$'\e[36;01m'
-    BOLD=$'\e[0;01m'
-    NORMAL=$'\e[0m'
+if [ -t 1 ] && [ -z "${NOCOLOUR}" ] ; then
+    RED=$(tput -S <<<$'setaf 1\nbold')
+    GREEN=$(tput -S <<<$'setaf 2\nbold')
+    YELLOW=$(tput -S <<<$'setaf 3\nbold')
+    BLUE=$(tput -S <<<$'setaf 4\nbold')
+    MAGENTA=$(tput -S <<<$'setaf 5\nbold')
+    CYAN=$(tput -S <<<$'setaf 6\nbold')
+    BOLD=$(tput bold)
+    NORMAL=$(tput sgr0)
 fi
 
 message() {
@@ -79,10 +94,13 @@
     exit 2
 fi
 
-message "Packages with site files in the wrong location:"
+NO_OF_PACKAGES=$(sed -n '$=' "${TMPFILE}")
+
+[ ${NO_OF_PACKAGES} -eq 1 ] && s= || s=s
+message "${NO_OF_PACKAGES} package${s} with site files in the wrong location:"
 cat "${TMPFILE}"
 
-if [ ${PRETEND} ]; then
+if [ "${PRETEND}" ]; then
     exit 3
 fi
 



-- 
gentoo-commits@lists.gentoo.org mailing list



             reply	other threads:[~2008-03-08  6:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-08  6:53 Ulrich Mueller (ulm) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-10-25 23:18 [gentoo-commits] gentoo-x86 commit in app-admin/eselect-emacs/files: emacs-updater Ulrich Mueller (ulm)
2008-05-25 17:26 Ulrich Mueller (ulm)
2008-02-21 11:06 Christian Faulhammer (opfer)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1JXsva-0004El-Rq@stork.gentoo.org \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox