updateminiupnpcstrings.sh 895 B

123456789101112131415161718192021222324252627282930313233343536
  1. #! /bin/sh
  2. # $Id: updateminiupnpcstrings.sh,v 1.1 2008/10/11 16:39:29 nanard Exp $
  3. FILE=miniupnpcstrings.h
  4. # detecting the OS name and version
  5. OS_NAME=`uname -s`
  6. OS_VERSION=`uname -r`
  7. if [ -f /etc/debian_version ]; then
  8. OS_NAME=Debian
  9. OS_VERSION=`cat /etc/debian_version`
  10. fi
  11. # use lsb_release (Linux Standard Base) when available
  12. LSB_RELEASE=`which lsb_release`
  13. if [ 0 -eq $? ]; then
  14. OS_NAME=`${LSB_RELEASE} -i -s`
  15. OS_VERSION=`${LSB_RELEASE} -r -s`
  16. case $OS_NAME in
  17. Debian)
  18. #OS_VERSION=`${LSB_RELEASE} -c -s`
  19. ;;
  20. Ubuntu)
  21. #OS_VERSION=`${LSB_RELEASE} -c -s`
  22. ;;
  23. esac
  24. fi
  25. echo "Detected OS [$OS_NAME] version [$OS_VERSION]"
  26. EXPR="s/OS_STRING\s\".*\"/OS_STRING \"${OS_NAME}\/${OS_VERSION}\"/"
  27. #echo $EXPR
  28. echo "Backuping $FILE to $FILE.bak."
  29. cp $FILE $FILE.bak
  30. echo "setting OS_STRING macro value to ${OS_NAME}/${OS_VERSION} in $FILE."
  31. cat $FILE.bak | sed -e "$EXPR" > $FILE