public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "KARL BOTTS" <kdbotts@usa.net>
To: <cygwin@cygwin.com>
Subject: Re: How to check cygwin version?
Date: Thu, 02 Jul 2020 11:13:17 -0500	[thread overview]
Message-ID: <499ygBqmR2384Set.1593706397@web06.cms.usa.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 70 bytes --]


Hack the attached at will...

---
Karl Botts, kdbotts@usa.net


[-- Attachment #2: cygver --]
[-- Type: application/octet-stream, Size: 2493 bytes --]

#!/bin/bash

function EmitHelp() {
expand -t4 << __End_of_Help__

Emits various info about the cygwin installation.

By default, just emits the main version number on one short line,
then quits.  (For many purposes, that is sufficient.)

With -v (verbose) does the following stuff, too:

Then emits a couple of envars of interest, and the timestamps of a few files.

Then runs 'cygcheck -csv' into a temp file, and greps the output to display the
version and status of various cygwin packages that Karl considers "interesting".

With -t FILENAME, uses the arg as the temp file, and does not delete it.

With -r, gives cygcheck the options that make it dig around in the Windows
Registry looking for extra stuff about cygwin.  Slow, and rarely needed.

__End_of_Help__
}
test "$1" == '--help' && { EmitHelp; exit; }


declare ExtraCygcheckOpts=
declare TempFn=
declare VerboseFlag=
while getopts 'vrt:' Opt
do
	case "$Opt" in
	v) VerboseFlag=1	;;
	r) ExtraCygcheckOpts+=" -r"; VerboseFlag=1	;;	# This is slow!
	t) TempFn="$OPTARG"; VerboseFlag=1	;;
	*) echo "$0: see --help" 1>&2; exit 1	;;
	esac
done
shift $((OPTIND -1))

declare UnameR=$(uname -r)
echo ${UnameR%%(*}
test "$VerboseFlag" || exit 0


echo
echo -n 'uname -a: '
uname -a
echo "CYGWIN=$CYGWIN"
echo "TMPDIR=$TMPDIR"

# Emit the last modstamp, for a few files that always get updated when cygwin is updated.
for Fn in /etc/setup/setup.rc /etc/setup/timestamp /bin/cygwin1.dll
do
	echo -n "$Fn: "
	stat -c %y "$Fn" | cut -d' ' -f1
done

echo

# Run cygcheck -c into a temp file, and grep some interesting stuff out of it.
if ! test "$TempFn"
then
	declare TempFn=$(mktemp -t cygver.XXXXXX)
	trap "rm $TempFn" EXIT
fi

cygcheck -csv $ExtraCygcheckOpts > $TempFn 2>&1

egrep -e 'Key: .* Path: .*$' $TempFn | sed -E 's/^[[:blank:]]*//'
egrep -e '^cygdrive prefix ' $TempFn
egrep -e '^Last downloaded files from: ' $TempFn

echo

# Packages:  I do this with several greps, basically to form groups: most interesting first.
# Note the trailing whitespace: it is intentional, for packages that have several sub-packages, to pick the main one.
egrep -e '^(cygwin |windows-)' $TempFn
echo

{
egrep -e '^(bash |subversion |git |mintty |vim )' $TempFn
egrep -e '^(less |perl |python[0-9]* |ruby |gawk |sed )' $TempFn
egrep -e '^(gcc|binutils |make )' $TempFn
egrep -e '^(diffutils |coreutils |findutils |cygutils|inetutils)' $TempFn
egrep -e '^(curl |file |grep |pcre |pcre2 |iperf )' $TempFn
egrep -e '^(glib|openss|zip)' $TempFn
} | sort


             reply	other threads:[~2020-07-02 16:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02 16:13 KARL BOTTS [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-07-01 13:36 Jeffrey Walton
2020-07-01 13:51 ` Thomas Wolff
2020-07-01 13:58 ` Eric Lilja
2020-07-01 15:58 ` Phill Ramsden
2020-07-02  5:20 ` Brian Inglis
2020-07-02 15:34   ` Norton Allen

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=499ygBqmR2384Set.1593706397@web06.cms.usa.net \
    --to=kdbotts@usa.net \
    --cc=cygwin@cygwin.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).