1.1 --- a/tools/checkconfig.sh Tue May 29 19:02:55 2018 +0200
1.2 +++ b/tools/checkconfig.sh Tue May 29 22:26:18 2018 +0200
1.3 @@ -1,39 +1,66 @@
1.4 #!/bin/sh
1.5
1.6 -if ! which realpath > /dev/null ; then
1.7 - echo "Please install the realpath program." 1>&2
1.8 - exit 1
1.9 -fi
1.10 -
1.11 THISDIR=`dirname "$0"`
1.12 -DIRNAME=`realpath "$THISDIR/.."`
1.13 +DIRNAME=`readlink -f "$THISDIR/.."`
1.14 PROGNAME=`basename "$0"`
1.15
1.16 if [ "$1" = '--help' ] || [ ! "$1" ] ; then
1.17 cat 1>&2 <<EOF
1.18 -Usage: $PROGNAME <platform> | <build directory>
1.19 +Usage: $PROGNAME <platform> | <l4 directory>
1.20
1.21 -Update platform-specific files for the indicated platform type. If a build
1.22 -directory is specified, try and obtain a configured platform type and use that
1.23 +Update platform-specific files for the indicated platform type. If a directory
1.24 +is specified instead, try and obtain a configured platform type and use that
1.25 to update the files.
1.26
1.27 -This program updates files in the distribution. They must then be installed
1.28 -using the install program:
1.29 +If a platform type is explicitly indicated, this program will update files in
1.30 +the distribution. They must then be installed using the install program:
1.31
1.32 $THISDIR/install.sh
1.33 +
1.34 +If a directory is specified instead, this program will update installed files,
1.35 +leaving the distribution alone.
1.36 EOF
1.37 exit 1
1.38 fi
1.39
1.40 # Check for a build directory and obtain a platform type.
1.41
1.42 -if [ -e "$1" ] && [ -e "$1/.config.platform" ] ; then
1.43 - PLATFORM=`grep -e 'CONFIG_PLATFORM_TYPE=' "$1/.config.platform" | sed 's/^.*"\(.*\)".*$/\1/'`
1.44 +if [ -e "$1" ] ; then
1.45 +
1.46 + # Look for the configuration in a subdirectory.
1.47 +
1.48 + for FILENAME in "$1/"*"/.config.platform" ; do
1.49 +
1.50 + # Test for a valid file since the expansion will yield the pattern
1.51 + # itself if no files match.
1.52 +
1.53 + if [ -e "$FILENAME" ] ; then
1.54 +
1.55 + # Set the platform and the installation as target.
1.56 +
1.57 + PLATFORM=`grep -e 'CONFIG_PLATFORM_TYPE=' "$FILENAME" | sed 's/^.*"\(.*\)".*$/\1/'`
1.58 + TARGETDIR="$1"
1.59 + break
1.60 + else
1.61 + cat 1>&2 <<EOF
1.62 +The specified directory does not contain an existing, configured build
1.63 +directory. Make sure that the configuration has been checked with the
1.64 +appropriate tool specifying a platform as argument:
1.65 +
1.66 +$DIRNAME/$PROGNAME <platform>
1.67 +EOF
1.68 + exit 1
1.69 + fi
1.70 + done
1.71
1.72 # Check for a recognised platform type.
1.73
1.74 elif grep -q -F -e "$1" "$DIRNAME/conf/landfall-examples/platforms.txt" ; then
1.75 +
1.76 + # Set the platform and the distribution as target.
1.77 +
1.78 PLATFORM="$1"
1.79 + TARGETDIR="$DIRNAME"
1.80
1.81 # Show an error for anything else.
1.82
1.83 @@ -44,9 +71,9 @@
1.84 exit 1
1.85 fi
1.86
1.87 -# Panel configuration file in this distribution.
1.88 +# Panel configuration file in the target area.
1.89
1.90 -PANELCONF="$DIRNAME/conf/landfall-examples/mips-jz4740-panel.txt"
1.91 +PANELCONF="$TARGETDIR/conf/landfall-examples/mips-jz4740-panel.txt"
1.92
1.93 # Determine the required value of the panel configuration.
1.94