Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* distro, tools-version.sh: New files. distro comes from distro-0.8.1(h…
…ttp://distro.pipfield.ca/). distro and tools-version.sh should be included only in CVS version of sodipodi. * autogen.sh: Call tools-version.sh.
- Loading branch information
Showing
4 changed files
with
320 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,271 @@ | ||
#! /bin/sh | ||
# distro.in: print distribution information | ||
# $Id: distro,v 1.1 2003/01/23 07:47:03 masata-y Exp $ | ||
|
||
# Copyright (C) 2001-2002 Matthew R. MacIntyre <matt@pipfield.ca> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
# | ||
|
||
PN=`basename $0` | ||
VER="0.8.1" | ||
|
||
# | ||
# Fatal($msg,$retval) | ||
# | ||
# Display an error message to stderr and exit | ||
# | ||
function Fatal { | ||
echo -e "${PN}: $1\nTerminating...." 1>&2 | ||
test -n "$2" && exit $2 | ||
exit 1 | ||
} | ||
|
||
|
||
# | ||
# Help() | ||
# | ||
# Display help information and exit | ||
# | ||
function Help { | ||
cat <<EOF | ||
Usage: ${PN} [OPTION]... | ||
Print certain distribution information. With no OPTION, same as -f. | ||
Options: | ||
-a, --all print all information | ||
-c, --codename print the distribution code name | ||
-f, --ftp-name print the ftp name of the distribution | ||
-n, --name print the distribution name | ||
-r, --release print the distribution release | ||
-h, --help display this help and exit | ||
-v, --version output version information and exit | ||
Report bugs to <matt@pipfield.ca>. | ||
EOF | ||
exit 0 | ||
} | ||
|
||
# | ||
# Version() | ||
# | ||
# Display version information and exit | ||
# | ||
function Version { | ||
cat <<EOF | ||
${PN} v${VER} | ||
Written by Matthew R. MacIntyre. | ||
Copyright (c) 2001-2002 Matthew R. MacIntyre. | ||
This is free software; see the source for copying conditions. There is NO | ||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
EOF | ||
exit 0 | ||
} | ||
|
||
|
||
####################### | ||
# Program starts here # | ||
####################### | ||
|
||
# | ||
# Set initial values for our configuration variables | ||
# | ||
ALL=0 | ||
CODENAME=0 | ||
FTPNAME=0 | ||
NAME=0 | ||
RELEASE=0 | ||
|
||
|
||
# | ||
# Parse the command-line arguments | ||
# | ||
|
||
OPTERR=0 | ||
while getopts "\-:acfhnrv" opt; do | ||
case $opt in | ||
h) Help; shift ;; | ||
v) Version; shift ;; | ||
a) ALL=1 ; shift; break;; | ||
c) CODENAME=1; shift; break;; | ||
f) FTPNAME=1; shift; break;; | ||
n) NAME=1; shift; break;; | ||
r) RELEASE=1; shift; break;; | ||
-) # long options | ||
case "$OPTARG" in | ||
help) Help; shift ;; | ||
version) Version; shift ;; | ||
all) ALL=1 ; shift ; break ;; | ||
codename) CODENAME=1 ; shift ; break ;; | ||
ftp-name) FTPNAME=1 ; shift ; break ;; | ||
name) NAME=1; shift ; break ;; | ||
release) RELEASE=1; shift ; break ;; | ||
*) Fatal "Illegal option -- \"--$OPTARG\"\nTry ${PN} --help for more information." 1 ;; | ||
esac ;; | ||
*) Fatal "Illegal option -- \"-$OPTARG\"\nTry ${PN} --help for more information." 1 ;; | ||
esac | ||
done | ||
|
||
# | ||
# Find the contents from the appropriate file, and store it in | ||
# $contents. Store the filename in $filename. | ||
# | ||
contents="" | ||
filename="" | ||
|
||
case "`uname`" in | ||
OpenBSD|FreeBSD|NetBSD|CYGWIN*) contents="`uname -a`" ;; | ||
Linux) | ||
files="/etc/mandrake-release /etc/SuSE-release \ | ||
/etc/redhat-release /etc/debian_version \ | ||
/etc/slackware-version /etc/.issue \ | ||
/etc/ROCK-LINUX" | ||
for file in $files; do | ||
if test -f "$file"; then | ||
filename="$file" | ||
contents="`cat $file`" | ||
break | ||
fi | ||
done | ||
if test -z "$filename"; then | ||
Fatal "Cannot find distribution information" | ||
fi | ||
;; | ||
SunOS) | ||
contents="`cat /etc/release`" | ||
filename='/etc/release' | ||
;; | ||
*) Fatal "Cannot find distribution information" ;; | ||
esac | ||
|
||
|
||
# | ||
# Output the appropriate information | ||
# | ||
sum="`expr $ALL + $CODENAME + $FTPNAME + $NAME + $RELEASE`" | ||
if test $sum -eq 0 || test $FTPNAME -eq 1; then | ||
# FIXME: incorporate this bit into the case statement | ||
name="`echo $filename | sed -e 's!/etc/!!' -e 's!-*release$!!' -e 's!_version$!!' -e 's!-version!!' -e 's!\.issue!!' | tr '[A-Z]' '[a-z]' | tr -d '-'`" | ||
# If that didn't work, then we likely have Solaris, Debian, | ||
# FreeBSD, or maybe even ROCK LINUX | ||
|
||
if test -z "$name"; then | ||
case "`uname`" in | ||
CYGWIN*) name="cygwin" ;; | ||
OpenBSD|FreeBSD|NetBSD) name="`uname | tr '[A-Z]' '[a-z]'`" ;; | ||
Linux) | ||
if test -n "`grep debian $filename`"; then | ||
name="debian" | ||
elif test -n "`grep -i caldera $filename`"; then | ||
name="openlinux" | ||
fi | ||
;; | ||
SunOS) name="solaris" ;; | ||
*) Fatal "Cannot determine ftp-name for this system: `uname`" 1 ;; | ||
esac | ||
fi | ||
|
||
# Get the version number | ||
case $name in | ||
cygwin) version="`uname -r | sed -e 's!\.!!g' -e 's!^\([0-9][0-9]*\).*$!\1!'`" ;; | ||
debian) version="`sed -e 's!\.!!'g -e 's!^testing/!-!' $filename`" ;; | ||
freebsd) version="`uname -r | sed -e 's!\([0-9][0-9]*\)\.\([0-9][0-9]*\).*!\1\2!'`" ;; | ||
openbsd|netbsd) version="`uname -r | sed -e 's!\.!!g'`" ;; | ||
rocklinux) version="`sed -e 's!^.*Linux \([0-9]\.[0-9]\.*[0-9]*\).*$!\1!' $filename | tr -d '.' | sed -e 's!0$!!'`" ;; | ||
slackware) version="`sed -e 's!\.!!g' -e 's!\([0-9]*\).*$!\1!' -e 's!\([0-9][0-9]*\)0$!\1!' $filename`" ;; | ||
solaris) version="`echo $contents | sed -e 's!^European !!' -e 's!^Solaris \([0-9]\.*[0-9]*\) .*$!\1!' -e 's!\.!!g'`" ;; | ||
*) | ||
# This is just a reasonable guess | ||
version="`echo $contents | sed -n '1,1'p | sed -e 's!.*\([0-9][0-9]*\.[0-9][0-9]*[a-z]*\).*!\1!' -e 's!\([0-9][0-9]*\)\.\([0-9][0-9]*[a-z]*\)!\1\2!'`" ;; | ||
esac | ||
echo "$name$version" | ||
elif test $CODENAME -eq 1 ; then | ||
# Certain systems (Solaris) don't have codenames. This checks to see | ||
# if there is one before figuring out what it is | ||
codename="" | ||
# check for a codename, but strip out the *BSD stuff, a misleading entry in ROCK-Linux, | ||
# and an ix86 bit in the various SuSE releases. | ||
if test -n "`echo $contents | sed -e 's!(GENERIC)!!' -e 's!(native, .*)!!' -e 's!(i[3456]86)!!' | egrep "^.* \(.*\).*$"`"; then | ||
codename="`echo $contents | sed -e 's!.*(\(.*\)).*$!\1!'`" | ||
elif test -n "`echo $filename | grep debian`"; then | ||
# For debian, we have to determine them manually | ||
case "`cat $filename`" in | ||
testing/unstable) codename='woody' ;; | ||
2.2) codename='potato' ;; | ||
2.1) codename='slink' ;; | ||
2.0) codename='hamm' ;; | ||
1.3*) codename='bo' ;; | ||
1.2) codename='rex' ;; | ||
1.1) codename='buzz' ;; | ||
esac | ||
fi | ||
if test -n "$codename"; then | ||
echo "$codename" | ||
fi | ||
elif test $ALL -eq 1 ; then | ||
# Call the script recursively to get the desired string, since the | ||
# Solaris format isn't the same. It is done through bash as a hack | ||
# to help when developing the script, and it isn't executable | ||
string="`bash $0 --name`" | ||
if test "`uname`" = "Linux"; then | ||
# We only want to add the word "release" for Linux | ||
# distributions. It's not a convention to use the word | ||
# "release" for any other type of system. | ||
|
||
# Don't add the word 'release' if we're on debian testing | ||
if test "`bash $0 --release`" != "testing/unstable"; then | ||
string="$string release" | ||
fi | ||
fi | ||
string="$string `bash $0 --release`" | ||
if test -n "`bash $0 --codename`"; then | ||
string="$string (`bash $0 --codename`)" | ||
fi | ||
# Strip out instances of too many spaces | ||
string="`echo $string | tr ' ' ' '`" | ||
echo "$string" | ||
elif test $NAME -eq 1 ; then | ||
case "`uname`" in | ||
Linux|SunOS) | ||
# It is done this way because the string for Solaris is a | ||
# little different than the various versions of Linux | ||
name="`echo $contents | sed -e 's![0-9].*$!!' -e 's![\ ]*release[\ ]*!!' -e 's![\ ][\ ]*$!!g'`" | ||
# Hmmmm .... some are a little different | ||
if test -n "`echo $filename | grep debian`"; then | ||
name="Debian GNU/Linux" | ||
elif test -n "`echo $filename | grep slackware`"; then | ||
name="Slackware Linux" | ||
fi | ||
;; | ||
CYGWIN*) name="Cygwin" ;; # FIXME: not sure if we have to differentiate between NT and others | ||
*) name="`uname`" ;; | ||
esac | ||
echo "$name" | ||
elif test $RELEASE -eq 1 ; then | ||
case "`uname`" in | ||
OpenBSD|FreeBSD|NetBSD|CYGWIN*) release="`uname -r | sed -e 's!(.*$!!'`" ;; | ||
*) | ||
# Cut letters and spaces out up to the first number | ||
release="`echo $contents | sed -e 's!^[A-Za-z\ ]*\([0-9]\.*[0-9]*\.*[0-9]*[a-z]*\).*$!\1!'`" | ||
;; | ||
esac | ||
echo "$release" | ||
else | ||
Fatal "Something unexpected has happened!" | ||
fi | ||
|
||
# All done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
# Report the version of distro and tools building autotrace | ||
# (derived from sodipodi) | ||
# | ||
# You can get the latest distro command from | ||
# distro web page: http://distro.pipfield.ca/ | ||
|
||
# Please add a tool you want to check | ||
TOOLS="m4 autoconf autoheader automake automake-1.6 aclocal aclocal-1.6 gettextize libtoolize " | ||
ENVPATTERN='PATH\|FLAGS\|LANG' | ||
|
||
srcdir=`dirname $0` | ||
test -z "$srcdir" && srcdir=. | ||
|
||
echo '=============================================================================' | ||
echo 'When you report a trouble about building CVS version of autotrace ' | ||
echo 'Please report following information about distro and tools version, too. ' | ||
echo | ||
(echo '--1. distribution------------------------------------------------------------' | ||
$srcdir/distro -a | ||
echo ) | ||
|
||
(echo '--2. tools-------------------------------------------------------------------' | ||
for x in $TOOLS; do | ||
echo "which $x: `which $x`" | ||
y=`echo $x | cut -f1 -d-` | ||
$x --version | grep $y | ||
done | ||
echo ) | ||
|
||
(echo '--3. environment variables---------------------------------------------------' | ||
env | grep -e $ENVPATTERN | ||
echo ) | ||
echo '=============================================================================' |