1 1.1 christos #!/bin/sh 2 1.1 christos # generate long version of output from config.guess 3 1.1 christos # part of am-utils-6.x 4 1.1 christos # Erez Zadok <ezk (at] cs.columbia.edu> 5 1.1 christos # 6 1.1 christos #set -x 7 1.1 christos 8 1.1 christos # find a single word that prints the version number of the release 9 1.1 christos getver () { 10 1.1 christos l=`head $1` 11 1.1 christos set $l 12 1.1 christos for i in $* 13 1.1 christos do 14 1.1 christos case "$i" in 15 1.1 christos # look for one digit followed by a sequence of non-spaces 16 1.1 christos # so it'll catch 7.3 as well as 2.1AW 17 1.1 christos *[0-9]* ) echo $i; return ;; 18 1.1 christos esac 19 1.1 christos done 20 1.1 christos } 21 1.1 christos 22 1.1 christos if test "x$GCONFIG" = "x" ; then 23 1.1 christos # find dirname of this script 24 1.1 christos base=`echo $0 | sed 's/\/[^\/]*$//' 2>/dev/null` 25 1.1 christos PATH=$base:$PATH 26 1.1 christos export PATH 27 1.1 christos GCONFIG=`config.guess || echo unknown-config` 28 1.1 christos fi 29 1.1 christos case "${GCONFIG}" in 30 1.1 christos *linux* ) 31 1.1 christos GCONFIG=`echo ${GCONFIG} | sed -e 's/i.86/i386/' -e 's/linux-gnu/linux/'` 32 1.1 christos if test -f /etc/redhat-release ; then 33 1.1 christos long=`getver /etc/redhat-release` 34 1.1 christos if grep 'Red Hat Enterprise Linux' /etc/redhat-release > /dev/null 2>&1 ; then 35 1.1 christos echo ${GCONFIG}-rhel${long} 36 1.1 christos elif grep 'Fedora Core' /etc/redhat-release > /dev/null 2>&1 ; then 37 1.1 christos echo ${GCONFIG}-fc${long} 38 1.1 christos elif grep 'CentOS' /etc/redhat-release > /dev/null 2>&1 ; then 39 1.1 christos echo ${GCONFIG}-centos${long} 40 1.1 christos else 41 1.1 christos echo ${GCONFIG}-rh${long} 42 1.1 christos fi 43 1.1 christos exit 0 44 1.1 christos elif test -f /etc/SuSE-release ; then 45 1.1 christos long=`getver /etc/SuSE-release` 46 1.1 christos if grep 'Enterprise Server' /etc/SuSE-release > /dev/null 2>&1 ; then 47 1.1 christos echo ${GCONFIG}-sles${long} 48 1.1 christos else 49 1.1 christos echo ${GCONFIG}-suse${long} 50 1.1 christos fi 51 1.1 christos exit 0 52 1.1 christos elif test -f /etc/debian_version ; then 53 1.1 christos long=`getver /etc/debian_version` 54 1.1 christos echo ${GCONFIG}-deb${long} 55 1.1 christos exit 0 56 1.1 christos elif test -f /etc/gentoo-release ; then 57 1.1 christos long=`getver /etc/gentoo-release` 58 1.1 christos echo ${GCONFIG}-gentoo${long} 59 1.1 christos exit 0 60 1.1 christos elif test -f /etc/yellowdog-release ; then 61 1.1 christos long=`getver /etc/yellowdog-release` 62 1.1 christos echo ${GCONFIG}-yellowdog${long} 63 1.1 christos exit 0 64 1.1 christos else 65 1.1 christos echo ${GCONFIG} 66 1.1 christos fi 67 1.1 christos ;; 68 1.1 christos *netbsdelf3* ) # remove trailing '.' from beta 69 1.1 christos echo ${GCONFIG} | sed 's/\.$//g' 70 1.1 christos ;; 71 1.1 christos 72 1.1 christos *solaris* ) 73 1.1 christos if grep -i nexentaos /etc/release > /dev/null 2>&1 ; then 74 1.1 christos echo ${GCONFIG}-nexentaos 75 1.1 christos else 76 1.1 christos echo ${GCONFIG} 77 1.1 christos fi 78 1.1 christos ;; 79 1.1 christos * ) 80 1.1 christos echo ${GCONFIG} 81 1.1 christos ;; 82 1.1 christos esac 83 1.1 christos exit 0 84