mirror of the now-defunct rocklinux.org
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.

150 lines
4.3 KiB

  1. #!/bin/bash
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/scripts/Check-System
  11. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. if [ -n "$1" -a "$1" != "-paranoia" ] ; then
  25. echo "Usage: $0 [ -paranoia ]"
  26. echo
  27. echo " Check the build system for and warn about various conditions that will likely"
  28. echo " cause ROCK to not work properly."
  29. echo
  30. exit 1
  31. fi
  32. found_error=0
  33. paranoia=""
  34. if [ "$ROCK_CHECK_SYSTEM_OK" = 1 ]; then
  35. exit 0
  36. fi
  37. if [ "$1" = "-paranoia" ]; then
  38. paranoia=1
  39. fi
  40. if [ -n "$paranoia" ] && \
  41. [ ! -w / -o "$(id -u)" != 0 -a "$(id -g)" != 0 ] ; then
  42. echo
  43. echo "Paranoia Check: You are trying to build as non-root!"
  44. echo "Building ROCK Linux requires root privileges."
  45. echo
  46. echo "You can disable the Paranoia Checks in the Config tool"
  47. echo "on your own risk!"
  48. found_error=1
  49. fi
  50. if [ -n "$paranoia" -a "`date '+%Y'`" -lt 1990 ] ; then
  51. echo
  52. echo "Paranoia Check: Your clock is not set!"
  53. echo "Set you clock using the command: date MMDDhhmm[[CC]YY][.ss]"
  54. echo
  55. echo "You can disable the Paranoia Checks in the Config tool"
  56. echo "on your own risk!"
  57. found_error=1
  58. fi
  59. if [ -n "$paranoia" -a -z "`grep '^/' < /proc/swaps`" ] ; then
  60. echo
  61. echo "Paranoia Check: No active swap partition found!"
  62. echo "That can cause the build scripts to hang your system!. Activate"
  63. echo "a swap partition using the 'swapon' command and try again."
  64. echo
  65. echo "You can disable the Paranoia Checks in the Config tool"
  66. echo "on your own risk!"
  67. found_error=1
  68. fi
  69. if [ ! -L /dev/fd/0 ] ; then
  70. echo
  71. echo "System Check: It seems like you don't have a functional"
  72. echo "/dev/fd symlink! A symlink from /dev/fd to /proc/self/fd"
  73. echo "and a mounted /proc is needed."
  74. found_error=1
  75. fi
  76. if [ -z "`type -p bzip2`" ] ; then
  77. echo
  78. echo "System Check: Program 'bzip2' not found!"
  79. echo "The bzip2 utility is needed for extracting the package"
  80. echo "source tars. Install the latest bzip2 version."
  81. found_error=1
  82. fi
  83. if [ -z "`type -p gawk`" ] ; then
  84. echo
  85. echo "System Check: Program 'gawk' not found!"
  86. echo "The gawk utility is needed for extracting the package"
  87. echo "source tars. Install the latest gawk version."
  88. found_error=1
  89. fi
  90. if [ -n "$paranoia" -a -z "`type -p makeinfo`" ] ; then
  91. echo
  92. echo "Paranoia Check: Program 'makeinfo' not found!"
  93. echo "The makeinfo program is needed for translating Texinfo"
  94. echo "documents. Please make sure that a current version of the"
  95. echo "texinfo package (including makeinfo) is installed on your system."
  96. echo
  97. echo "You can disable the Paranoia Checks in the Config tool"
  98. echo "on your own risk!"
  99. found_error=1
  100. fi
  101. case $BASH_VERSION in
  102. 2.05b*|3.*) ;;
  103. *) echo "The running bash version is not listed as supported version"
  104. echo "You need to update 'bash' to at least version 2.05b."
  105. found_error=1
  106. esac
  107. x="`mktemp -p /tmp 2> /dev/null`"
  108. if [ -z "$x" -o ! -f "$x" ] ; then
  109. echo
  110. echo "System Check: Program 'mktemp' not found or too old!"
  111. echo "You need an 'mktemp' installed which does know about the -p"
  112. echo "option. Install the latest mktemp version."
  113. found_error=1
  114. else
  115. rm -f "$x"
  116. fi
  117. tmpfile=`mktemp`
  118. if [ -z "`type -p sed`" ] || ! sed -i s/a/b/ $tmpfile 2> /dev/null
  119. then
  120. echo
  121. echo "System Check: Program 'sed' not found or too old!"
  122. echo "You need a 'sed' installed which does know about the -i option"
  123. echo "(GNU/sed since 2001-09-25). Install the latest sed version."
  124. found_error=1
  125. fi
  126. rm -f $tmpfile
  127. if [ $found_error -ne 0 ] ; then
  128. echo
  129. echo "System Check found errors -> not doing anything."
  130. echo
  131. fi
  132. exit $found_error