From: Michael Tremer Date: Sun, 25 May 2008 16:18:55 +0000 (+0200) Subject: make.sh can now check the rootfiles for errors and fix them. X-Git-Tag: v3.0-alpha1~1012 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd4be397cab9837a25b7e733a7cb9ca89171aba6;p=ipfire-3.x.git make.sh can now check the rootfiles for errors and fix them. --- diff --git a/tools/make-check b/tools/make-check index 4d095ada9..19c9e7f7f 100644 --- a/tools/make-check +++ b/tools/make-check @@ -86,28 +86,63 @@ check_build() { } check_rootfiles() { + ACTION=$1 + echo -n " Running rootfile checks" + + case "$ACTION" in + --fix) + echo -n " and fix" + + # Remove leading pluses and replace them by '#' + sed -e "s/^+/#/g" -i $BASEDIR/src/rootfiles/*/* + + # Fix UCLIBC_DIR and UCLIBC_TARGET + sed -e "s@${UCLIBC_DIR:1}@UCLIBC_DIR@g" \ + -e "s@${UCLIBC_TARGET}@UCLIBC_TARGET@g" \ + -i $BASEDIR/src/rootfiles/installer/* + + # Fix INSTALLER_DIR + sed -e "s@${INSTALLER_DIR:1}/@INSTALLER_DIR/@g" \ + -i $BASEDIR/src/rootfiles/installer/* + ;; + "") + : # If no option was given we do nothing. + ;; + *) + exiterror "This is not a valid option: $ACTION" + ;; + esac + + echo "..." # End the line + + echo -n " Searching for leading slashes..." if grep -n ^/ $BASEDIR/src/rootfiles/*/*; then - exiterror "Please check your rootfiles! There are trailing slashes." + exiterror "Please check your rootfiles! There are leading slashes." + else + beautify message DONE fi + echo -n " Searching for leading pluses..." if grep -n ^+ $BASEDIR/src/rootfiles/*/*; then - exiterror "Please check your rootfiles for trailing pluses." + exiterror "Please check your rootfiles for leading pluses." + else + beautify message DONE fi + echo -n " Searching for emtpy lines..." if grep -n ^$ $BASEDIR/src/rootfiles/*/*; then exiterror "Please check your rootfiles for empty lines." + else + beautify message DONE fi } - check_sanity() { - echo -ne "Checking sanity of working directory..." - - check_rootfiles + echo "Checking sanity of working directory..." - beautify message DONE + check_rootfiles $* } diff --git a/tools/make-interactive b/tools/make-interactive index a249278f0..19d443440 100644 --- a/tools/make-interactive +++ b/tools/make-interactive @@ -169,6 +169,11 @@ gettoolchain) beautify message SKIP fi ;; + +check) + . tools/make-check + check_sanity $2 + ;; othersrc) prepareenv