Fork of FusionPBX but with LDAP kinda working
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.7 KiB

  1. #!/bin/sh
  2. #make sure lsb release is installed
  3. apt-get install lsb-release
  4. #operating system details
  5. os_name=$(lsb_release -is)
  6. os_codename=$(lsb_release -cs)
  7. os_mode='unknown'
  8. #cpu details
  9. cpu_name=$(uname -m)
  10. cpu_architecture='unknown'
  11. cpu_mode='unknown'
  12. #set the environment path
  13. export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  14. #check what the CPU and OS are
  15. if [ .$cpu_name = .'armv6l' ]; then
  16. # RaspberryPi Zero
  17. os_mode='32'
  18. cpu_mode='32'
  19. cpu_architecture='arm'
  20. elif [ .$cpu_name = .'armv7l' ]; then
  21. # RaspberryPi 3 is actually armv8l but current Raspbian reports the cpu as armv7l and no Raspbian 64Bit has been released at this time
  22. os_mode='32'
  23. cpu_mode='32'
  24. cpu_architecture='arm'
  25. elif [ .$cpu_name = .'armv8l' ]; then
  26. # No test case for armv8l
  27. os_mode='unknown'
  28. cpu_mode='64'
  29. cpu_architecture='arm'
  30. elif [ .$cpu_name = .'aarch64' ]; then
  31. os_mode='64'
  32. cpu_mode='64'
  33. cpu_architecture='arm'
  34. elif [ .$cpu_name = .'i386' ]; then
  35. os_mode='32'
  36. if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then
  37. cpu_mode='64'
  38. else
  39. cpu_mode='32'
  40. fi
  41. cpu_architecture='x86'
  42. elif [ .$cpu_name = .'i686' ]; then
  43. os_mode='32'
  44. if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then
  45. cpu_mode='64'
  46. else
  47. cpu_mode='32'
  48. fi
  49. cpu_architecture='x86'
  50. elif [ .$cpu_name = .'x86_64' ]; then
  51. os_mode='64'
  52. if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then
  53. cpu_mode='64'
  54. else
  55. cpu_mode='32'
  56. fi
  57. cpu_architecture='x86'
  58. else
  59. error "You are using an unsupported cpu '$cpu_name'"
  60. exit 3
  61. fi
  62. if [ .$cpu_architecture = .'arm' ]; then
  63. if [ .$os_mode = .'32' ]; then
  64. verbose "Correct CPU and Operating System detected, using the ARM repo"
  65. elif [ .$os_mode = .'64' ]; then
  66. error "You are using a 64bit arm OS this is unsupported"
  67. switch_source=true
  68. switch_package=false
  69. else
  70. error "Unknown OS mode $os_mode this is unsupported"
  71. switch_source=true
  72. switch_package=false
  73. fi
  74. elif [ .$cpu_architecture = .'x86' ]; then
  75. if [ .$os_mode = .'32' ]; then
  76. error "You are using a 32bit OS this is unsupported"
  77. if [ .$cpu_mode = .'64' ]; then
  78. warning " Your CPU is 64bit you should consider reinstalling with a 64bit OS"
  79. fi
  80. switch_source=true
  81. switch_package=false
  82. elif [ .$os_mode = .'64' ]; then
  83. verbose "Correct CPU and Operating System detected"
  84. else
  85. error "Unknown Operating System mode '$os_mode' is unsupported"
  86. switch_source=true
  87. switch_package=false
  88. fi
  89. else
  90. error "You are using an unsupported architecture '$cpu_architecture'"
  91. warning "Detected environment was :-"
  92. warning "os_name:'$os_name'"
  93. warning "os_codename:'$os_codename'"
  94. warning "os_mode:'$os_mode'"
  95. warning "cpu_name:'$cpu_name'"
  96. exit 3
  97. fi