]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
make.sh can now check the rootfiles for errors and fix them.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 25 May 2008 16:18:55 +0000 (18:18 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 25 May 2008 16:18:55 +0000 (18:18 +0200)
tools/make-check
tools/make-interactive

index 4d095ada976a10f73ba3f368d827e24025c05319..19c9e7f7fc3eaaf0025a263394147a1cfc3e0f7c 100644 (file)
@@ -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 $*
 
 }
index a249278f07b406d2c82e7a8a3d891121a5c4d52c..19d443440d9a6374de9815722ee9b15e90bfce41 100644 (file)
@@ -169,6 +169,11 @@ gettoolchain)
                beautify message SKIP
        fi
        ;;
+
+check)
+       . tools/make-check
+       check_sanity $2
+       ;;
        
 othersrc)
        prepareenv