linuxsystemtest.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. systemname=`uname -a`
  2. #echo $systemname
  3. OSDEFINFO=$(echo "DEFINES += SYSTEM_UBUNTU1804")
  4. ubuntu1804="18.04."
  5. ubuntu1604="16.04."
  6. ubuntu2004="20.04."
  7. resultos=$(echo $systemname | grep "tegra")
  8. if [ "$resultos" != "" ]
  9. then
  10. OSDEFINFO=$(echo "DEFINES += SYSTEM_AGX")
  11. else
  12. resultos=$(echo $systemname | grep "Ubuntu")
  13. if [ "$resultos" != "" ]
  14. then
  15. systemname=`lsb_release -a`
  16. result=$(echo $systemname | grep "${ubuntu1804}")
  17. if [ "$result" != "" ]
  18. then
  19. # echo "ubuntu 18.04"
  20. OSDEFINFO=$(echo "DEFINES += SYSTEM_UBUNTU1804")
  21. fi
  22. result=$(echo $systemname | grep "${ubuntu1604}")
  23. if [ "$result" != "" ]
  24. then
  25. # echo "ubuntu 16.04"
  26. OSDEFINFO=$(echo "DEFINES += SYSTEM_UBUNTU1604")
  27. fi
  28. result=$(echo $systemname | grep "${ubuntu2004}")
  29. if [ "$result" != "" ]
  30. then
  31. # echo "ubuntu 20.04"
  32. OSDEFINFO=$(echo "DEFINES += SYSTEM_UBUNTU1804") # 20210930 parameters of 20.04 temporarily same as 18.04
  33. fi
  34. fi
  35. fi
  36. if [ -f "systemdef.pri" ]; then
  37. # echo "file exist."
  38. OLDOSDEFINFO=$(sed -n '/DEFINES += SYSTEM/p' systemdef.pri)
  39. # echo "old:"$OLDOSDEFINFO
  40. if [ ! "$OSDEFINFO"x = "$OLDOSDEFINFO"x ]; then
  41. echo "replace DEFINES in systemdef.pri"
  42. sed -i "s/^.*DEFINES += SYSTEM.*$/$OSDEFINFO/" systemdef.pri
  43. fi
  44. else
  45. echo "systemdef.pri not exist."
  46. echo $OSDEFINFO >> systemdef.pri
  47. fi