OpenSDE Framework (without history before r20070)
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.

207 lines
4.7 KiB

  1. #!/bin/bash
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: bin/sde-check-system
  6. # Copyright (C) 2006 - 2020 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. if [ $# -gt 0 ] ; then
  18. echo "Usage: $0" ; exit 1
  19. fi
  20. found_error=0
  21. if [ $UID -ne 0 ] ; then
  22. cat <<-EOT
  23. Paranoia Check: You are building as non-root!
  24. This does not yet work for many configurations such as
  25. whole system builds that require chroot().
  26. EOT
  27. fi
  28. if [ "`date '+%Y'`" -lt 1990 ] ; then
  29. cat <<-EOT
  30. Paranoia Check: Your clock is not set!
  31. Set you clock using the command: date MMDDhhmm[[CC]YY][.ss]
  32. EOT
  33. found_error=1
  34. fi
  35. if [ -z "`grep '^/' < /proc/swaps`" ] ; then
  36. cat <<-EOT
  37. Paranoia Check: No active swap partition found!
  38. That can cause the build scripts to hang your system!. Activate
  39. a swap partition using the 'swapon' command and try again.
  40. EOT
  41. found_error=1
  42. fi
  43. if [ -z "`type -p curl`" ] ; then
  44. cat <<-EOT
  45. Paranoia Check: Program 'curl' not found!
  46. The curl utility is needed for Downloading the package
  47. source tars. Install the latest curl version.
  48. EOT
  49. found_error=1
  50. fi
  51. if [ -z "`type -p flex`" ] ; then
  52. cat <<-EOT
  53. Paranoia Check: Program 'Flex' not found!
  54. The Flex utility is needed for scanning
  55. Install the latest Flex version.
  56. EOT
  57. found_error=1
  58. fi
  59. if [ -z "`type -p m4`" ] ; then
  60. cat <<-EOT
  61. Paranoia Check: Program 'm4' not found!
  62. The m4 utility is needed as a front
  63. end for gcc. Install the latest m4 version.
  64. EOT
  65. found_error=1
  66. fi
  67. if [ -z "`type -p patch`" ] ; then
  68. cat <<-EOT
  69. Paranoia Check: Program 'patch' not found!
  70. The patch program is needed to work
  71. with source files. Install the latest patch version.
  72. EOT
  73. found_error=1
  74. fi
  75. if [ -z "`type -p bzip2`" ] ; then
  76. cat <<-EOT
  77. Paranoia Check: Program 'bzip2' not found!
  78. The bzip2 utility is needed for extracting the package
  79. source tars. Install the latest bzip2 version.
  80. EOT
  81. found_error=1
  82. fi
  83. if [ -z "`type -p makeinfo`" ] ; then
  84. cat <<-EOT
  85. Paranoia Check: Program 'makeinfo' not found!
  86. The makeinfo program is needed for translating Texinfo
  87. documents. Please make sure that a current version of the
  88. texinfo package (including makeinfo) is installed on your system.
  89. EOT
  90. found_error=1
  91. fi
  92. if [ -z "`type -p bison`" ] ; then
  93. cat <<-EOT
  94. Paranoia Check: Program 'bison' not found!
  95. The bison program is needed for compiling targets.
  96. Please make sure that a current version of the
  97. bison package is installed on your system.
  98. EOT
  99. found_error=1
  100. fi
  101. if [ -z "`type -p bc`" ] ; then
  102. cat <<-EOT
  103. Paranoia Check: Program 'bc' not found!
  104. The bc program is needed for compiling linux kernels >= 3.10.
  105. Please make sure that a current version of the bc package is
  106. installed on your system.
  107. EOT
  108. found_error=1
  109. fi
  110. case $BASH_VERSION in
  111. 2.05b*) ;;
  112. 3.*) ;;
  113. 4.*) ;;
  114. 5.*) ;;
  115. *) cat <<-EOT
  116. Paranoia Check: Invalid 'bash' version ($BASH_VERSION)
  117. The running bash version is not listed as supported version
  118. You need to update 'bash' to at least version 2.05b.
  119. EOT
  120. found_error=1
  121. esac
  122. if [ -z "$(ls -1d /usr/lib*/libc.a /usr/lib*/*/libc.a 2> /dev/null)" ]; then
  123. cat <<-EOT
  124. Paranoia Check: File '/usr/lib*/libc.a' not found!
  125. Without the static library of your libC you wont be able to
  126. build targets.
  127. EOT
  128. found_error=1
  129. fi
  130. x="`mktemp -p /tmp 2> /dev/null`"
  131. if [ -z "$x" -o ! -f "$x" ] ; then
  132. cat <<-EOT
  133. Paranoia Check: Program 'mktemp' not found or too old!
  134. You need an 'mktemp' installed which does know about the -p
  135. option. Install the latest mktemp version.
  136. EOT
  137. found_error=1
  138. else
  139. rm -f "$x"
  140. fi
  141. x="`mktemp`" ; touch $x
  142. if [ -z "`type -p sed`" ] || ! sed -i s/a/b/ $x; then
  143. cat <<-EOT
  144. Paranoia Check: Program 'sed' not found or too old!
  145. You need a 'sed' installed which does know about the -i option
  146. (GNU/sed since 2001-09-25). Install the latest sed version.
  147. EOT
  148. found_error=1
  149. fi
  150. rm -f $x 2> /dev/null
  151. x=tmp/null
  152. mkdir -p tmp
  153. mknod $x c 1 3
  154. if ! cat $x; then
  155. cat <<-EOT
  156. Device nodes can not be created or are not functional on the
  157. partition used for the build. Most probably the partitions is
  158. mounted with the 'nodev' option.
  159. EOT
  160. found_error=1
  161. fi
  162. rm -f $x
  163. if [ $found_error -ne 0 ] ; then
  164. cat <<-EOT
  165. Paranoia Check found errors -> not doing anything.
  166. You can disable the Paranoia Checks in the Config tool
  167. on your own risk!
  168. EOT
  169. fi
  170. exit $found_error