From 4e501cddf797b0df2f3ce7ba2f98f036f36b617a Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 10 Oct 2004 11:30:19 +0000 Subject: [PATCH] Clifford Wolf and Tobias Hintze: Also call Check-System from Config and Build-Pkg Don't disable entire Check-System when disabling paranoia checks Now also check for gawk and /dev/fd [2004092222044920814] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@4442 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- scripts/Build-Pkg | 2 ++ scripts/Build-Target | 2 ++ scripts/Check-System | 58 ++++++++++++++++++++++++++++++++++---------- scripts/Config | 2 ++ 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/scripts/Build-Pkg b/scripts/Build-Pkg index 7aa655bbb..eed646ecc 100755 --- a/scripts/Build-Pkg +++ b/scripts/Build-Pkg @@ -129,6 +129,8 @@ if [ $# = 0 ] ; then help_msg ; exit 1 fi +./scripts/Check-System || exit 1 + . ./scripts/functions . ./scripts/parse-config diff --git a/scripts/Build-Target b/scripts/Build-Target index 75194379e..ba8cc08f7 100755 --- a/scripts/Build-Target +++ b/scripts/Build-Target @@ -84,6 +84,8 @@ build_logs="$build_rock/logs" ; mkdir -p "${build_logs}" build_pkgs="$build_rock/pkgs" ; mkdir -p "${build_root}" if [ "$ROCKCFG_PARANOIA_CHECK" = 1 ] ; then + ./scripts/Check-System -paranoia || exit 1 +else ./scripts/Check-System || exit 1 fi diff --git a/scripts/Check-System b/scripts/Check-System index c92a2e192..5fe390ae9 100755 --- a/scripts/Check-System +++ b/scripts/Check-System @@ -22,8 +22,8 @@ # # --- ROCK-COPYRIGHT-NOTE-END --- -if [ "$1" ] ; then - echo "Usage: $0" +if [ -n "$1" -a "$1" != "-paranoia" ] ; then + echo "Usage: $0 [ -paranoia ]" echo echo " Check the build system for and warn about various conditions that will likely" echo " cause ROCK to not work properly." @@ -32,32 +32,55 @@ if [ "$1" ] ; then fi found_error=0 +paranoia="" -if [ ! -w / -o "$(id -u)" != 0 -a "$(id -g)" != 0 ] ; then +if [ "$1" = "-paranoia" ]; then + paranoia=1 +fi + +if [ -n "$paranoia" ] && \ + [ ! -w / -o "$(id -u)" != 0 -a "$(id -g)" != 0 ] ; then echo echo "Paranoia Check: You are trying to build as non-root!" echo "Building ROCK Linux requires root privileges." + echo + echo "You can disable the Paranoia Checks in the Config tool" + echo "on your own risk!" found_error=1 fi -if [ "`date '+%Y'`" -lt 1990 ] ; then +if [ -n "$paranoia" -a "`date '+%Y'`" -lt 1990 ] ; then echo echo "Paranoia Check: Your clock is not set!" echo "Set you clock using the command: date MMDDhhmm[[CC]YY][.ss]" + echo + echo "You can disable the Paranoia Checks in the Config tool" + echo "on your own risk!" found_error=1 fi -if [ -z "`grep '^/' < /proc/swaps`" ] ; then +if [ -n "$paranoia" -a -z "`grep '^/' < /proc/swaps`" ] ; then echo echo "Paranoia Check: No active swap partition found!" echo "That can cause the build scripts to hang your system!. Activate" echo "a swap partition using the 'swapon' command and try again." + echo + echo "You can disable the Paranoia Checks in the Config tool" + echo "on your own risk!" + found_error=1 +fi + +if [ ! -L /dev/fd/0 ] ; then + echo + echo "System Check: It seams like you don't have a functional" + echo "/dev/fd symlink! A symlink from /dev/fd to /proc/self/fd" + echo "and a mounted /proc is needed." found_error=1 fi if [ -z "`type -p curl`" ] ; then echo - echo "Paranoia Check: Program 'curl' not found!" + echo "System Check: Program 'curl' not found!" echo "The curl utility is needed for Downloading the package" echo "source tars. Install the latest curl version." found_error=1 @@ -65,18 +88,29 @@ fi if [ -z "`type -p bzip2`" ] ; then echo - echo "Paranoia Check: Program 'bzip2' not found!" + echo "System Check: Program 'bzip2' not found!" echo "The bzip2 utility is needed for extracting the package" echo "source tars. Install the latest bzip2 version." found_error=1 fi -if [ -z "`type -p makeinfo`" ] ; then +if [ -z "`type -p gawk`" ] ; then + echo + echo "System Check: Program 'gawk' not found!" + echo "The gawk utility is needed for extracting the package" + echo "source tars. Install the latest gawk version." + found_error=1 +fi + +if [ -n "$paranoia" -a -z "`type -p makeinfo`" ] ; then echo echo "Paranoia Check: Program 'makeinfo' not found!" echo "The makeinfo program is needed for translating Texinfo" echo "documents. Please make sure that a current version of the" echo "texinfo package (including makeinfo) is installed on your system." + echo + echo "You can disable the Paranoia Checks in the Config tool" + echo "on your own risk!" found_error=1 fi @@ -91,7 +125,7 @@ esac x="`mktemp -p /tmp 2> /dev/null`" if [ -z "$x" -o ! -f "$x" ] ; then echo - echo "Paranoia Check: Program 'mktemp' not found or too old!" + echo "System Check: Program 'mktemp' not found or too old!" echo "You need an 'mktemp' installed which does know about the -p" echo "option. Install the latest mktemp version." found_error=1 @@ -103,7 +137,7 @@ tmpfile=`mktemp` if [ -z "`type -p sed`" ] || ! sed -i s/a/b/ $tmpfile 2> /dev/null then echo - echo "Paranoia Check: Program 'sed' not found or too old!" + echo "System Check: Program 'sed' not found or too old!" echo "You need a 'sed' installed which does know about the -i option" echo "(GNU/sed since 2001-09-25). Install the latest sed version." found_error=1 @@ -112,9 +146,7 @@ rm -f $tmpfile if [ $found_error -ne 0 ] ; then echo - echo "Paranoia Check found errors -> not doing anything." - echo "You can disable the Paranoia Checks in the Config tool" - echo "on your own risk!" + echo "System Check found errors -> not doing anything." echo fi diff --git a/scripts/Config b/scripts/Config index 0beaf4629..8e72d13a6 100755 --- a/scripts/Config +++ b/scripts/Config @@ -72,6 +72,8 @@ while [ "$1" ] ; do esac done +./scripts/Check-System || exit 1 + if [ $delete_mode = 1 ] ; then rm -rv config/$config exit $?