#!/bin/bash function detect_distro { HOST=`grep 'openSUSE\|Wind River\|Fedora\| SUSE\|Red Hat\|Ubuntu' /etc/issue| sed 's/.*\(openSUSE\|Wind River\|Fedora\| SUSE\|Red Hat\|Ubuntu\).*/\1/'` if [ -z "$HOST" ];then echo unable to determine host type exit 1 fi TEMP=`mktemp` if [ "$HOST" = "Ubuntu" ]; then NEWEST=10.04 VER=`cat /etc/issue|head -n1 | awk '{print $2}'` dpkg-query -l > $TEMP if [ $? != 0 ];then echo package listing failed exit 1 fi elif [ "$HOST" = "Fedora" ]; then NEWEST=11 VER=`cat /etc/issue|head -n1 | awk '{print $3}'` HOST="Fedora" rpm -qa > $TEMP if [ $? != 0 ];then echo package listing failed exit 1 fi elif [ "$HOST" = "Wind River" ]; then HOST="Windriver" release_ver=`grep Wind /etc/wrs-release | awk '{print $4}'` clib=`grep Wind /etc/wrs-release | awk '{print $5}' | sed -e "s/_.*$//"` VER="${release_ver}-${clib}" elif [ "$HOST" = "Red Hat" ]; then HOST="redhat" release_ver=`rpm -q --queryformat "%{VERSION}" redhat-release` MAJOR="?" if [ `echo ${release_ver} | grep 4` ] ; then MAJOR="4" MINOR=`cat /etc/issue|head -n1 | sed 's/.*\([0-9]\))/\1/'` elif [ `echo ${release_ver} | grep 5` ] ; then MAJOR="5" MINOR=`cat /etc/redhat-release | sed -e "s/^.*\.//" -e "s/ .*$//"` fi VER="${MAJOR}.${MINOR}" elif [ "$HOST" = " SUSE" ]; then NEWEST=11.0 HOST="SLED" VER=`grep SUSE /etc/issue|head -n1 | awk '{print $7}'` if [ "$VER" = "10" ];then VER=10.2 fi rpm -qa > $TEMP if [ $? != 0 ];then echo package listing failed exit 1 fi elif [ "$HOST" = "openSUSE" ]; then NEWEST=11.2 VER=`grep SUSE /etc/issue|head -n1 | awk '{print $4}'` if [ "$VER" = "10" ];then VER=10.2 fi rpm -qa > $TEMP if [ $? != 0 ];then echo package listing failed exit 1 fi else echo unknown host type -- $HOST exit 1 fi W=`tail -n1 /proc/kallsyms |awk '{print $1}'|wc -c` WIDTH=`echo "($W-1)*4"|bc` echo $HOST-$VER-${WIDTH} } distro_name=`detect_distro` echo "${distro_name}"