# HG changeset patch # User Paul Boddie # Date 1527625578 -7200 # Node ID b99553d569c044d36626291f48eff28464c76ced # Parent 37b1f1aefe070c1372fe0a54fdeb073fd3fdf12f Changed checkconfig.sh to accept the l4 directory and to deduce the build directory, also making it update installed files if a directory is specified, with the distribution being updated otherwise. The script is then run by install.sh to automatically make updated resources consistent with the configured platform. Changed realpath invocations to "readlink -f" invocations, eliminating the dependency. diff -r 37b1f1aefe07 -r b99553d569c0 tools/checkconfig.sh --- a/tools/checkconfig.sh Tue May 29 19:02:55 2018 +0200 +++ b/tools/checkconfig.sh Tue May 29 22:26:18 2018 +0200 @@ -1,39 +1,66 @@ #!/bin/sh -if ! which realpath > /dev/null ; then - echo "Please install the realpath program." 1>&2 - exit 1 -fi - THISDIR=`dirname "$0"` -DIRNAME=`realpath "$THISDIR/.."` +DIRNAME=`readlink -f "$THISDIR/.."` PROGNAME=`basename "$0"` if [ "$1" = '--help' ] || [ ! "$1" ] ; then cat 1>&2 < | +Usage: $PROGNAME | -Update platform-specific files for the indicated platform type. If a build -directory is specified, try and obtain a configured platform type and use that +Update platform-specific files for the indicated platform type. If a directory +is specified instead, try and obtain a configured platform type and use that to update the files. -This program updates files in the distribution. They must then be installed -using the install program: +If a platform type is explicitly indicated, this program will update files in +the distribution. They must then be installed using the install program: $THISDIR/install.sh + +If a directory is specified instead, this program will update installed files, +leaving the distribution alone. EOF exit 1 fi # Check for a build directory and obtain a platform type. -if [ -e "$1" ] && [ -e "$1/.config.platform" ] ; then - PLATFORM=`grep -e 'CONFIG_PLATFORM_TYPE=' "$1/.config.platform" | sed 's/^.*"\(.*\)".*$/\1/'` +if [ -e "$1" ] ; then + + # Look for the configuration in a subdirectory. + + for FILENAME in "$1/"*"/.config.platform" ; do + + # Test for a valid file since the expansion will yield the pattern + # itself if no files match. + + if [ -e "$FILENAME" ] ; then + + # Set the platform and the installation as target. + + PLATFORM=`grep -e 'CONFIG_PLATFORM_TYPE=' "$FILENAME" | sed 's/^.*"\(.*\)".*$/\1/'` + TARGETDIR="$1" + break + else + cat 1>&2 < +EOF + exit 1 + fi + done # Check for a recognised platform type. elif grep -q -F -e "$1" "$DIRNAME/conf/landfall-examples/platforms.txt" ; then + + # Set the platform and the distribution as target. + PLATFORM="$1" + TARGETDIR="$DIRNAME" # Show an error for anything else. @@ -44,9 +71,9 @@ exit 1 fi -# Panel configuration file in this distribution. +# Panel configuration file in the target area. -PANELCONF="$DIRNAME/conf/landfall-examples/mips-jz4740-panel.txt" +PANELCONF="$TARGETDIR/conf/landfall-examples/mips-jz4740-panel.txt" # Determine the required value of the panel configuration. diff -r 37b1f1aefe07 -r b99553d569c0 tools/install.sh --- a/tools/install.sh Tue May 29 19:02:55 2018 +0200 +++ b/tools/install.sh Tue May 29 22:26:18 2018 +0200 @@ -1,12 +1,7 @@ #!/bin/sh -if ! which realpath > /dev/null ; then - echo "Please install the realpath program." 1>&2 - exit 1 -fi - THISDIR=`dirname "$0"` -DIRNAME=`realpath "$THISDIR/.."` +DIRNAME=`readlink -f "$THISDIR/.."` PROGNAME=`basename "$0"` if [ "$1" = '--help' ]; then @@ -53,6 +48,10 @@ CLEAN= fi +# Check the configuration, if possible. + +"$THISDIR/checkconfig.sh" "$L4DIR" + # Generate binaries if appropriate. if [ ! "$CLEAN" ] ; then @@ -68,7 +67,7 @@ # Copy (or remove) each of the objects. for OBJTYPE in 'conf' 'pkg' ; do - TARGETDIR=`realpath "$L4DIR"`/$OBJTYPE + TARGETDIR=`readlink -f "$L4DIR"`/$OBJTYPE SOURCEDIR="$DIRNAME/$OBJTYPE" # If cleaning, remove all objects. @@ -76,7 +75,7 @@ if [ "$CLEAN" ] ; then for OBJECT in "$SOURCEDIR/"* ; do OBJNAME=`basename "$OBJECT"` - ORIGIN=`realpath "$OBJECT"` + ORIGIN=`readlink -f "$OBJECT"` TARGET="$TARGETDIR/$OBJNAME" if [ -d "$TARGET" ] ; then @@ -92,7 +91,7 @@ # Make directories. for OBJECT in `find "$SOURCEDIR" -type d -print` ; do - ORIGIN=`realpath "$OBJECT"` + ORIGIN=`readlink -f "$OBJECT"` RELPATH=${ORIGIN#$SOURCEDIR/} # Skip top-level directories. @@ -111,7 +110,7 @@ # Copy new files. for OBJECT in `find "$SOURCEDIR" -type f -not -name '.*' -not -name '*.orig' -not -name '*.rej' -print` ; do - ORIGIN=`realpath "$OBJECT"` + ORIGIN=`readlink -f "$OBJECT"` RELPATH=${ORIGIN#$SOURCEDIR/} TARGET="$TARGETDIR/$RELPATH" @@ -124,7 +123,7 @@ for OBJECT in "$SOURCEDIR/"* ; do OBJNAME=`basename "$OBJECT"` - ORIGIN=`realpath "$OBJECT"` + ORIGIN=`readlink -f "$OBJECT"` # Examine the target object directory for files that are not provided # by the distribution. @@ -132,7 +131,7 @@ TARGET="$TARGETDIR/$OBJNAME" for FILENAME in `find "$TARGET" -type f -not -name '.*' -not -name '*.orig' -not -name '*.rej' -print` ; do - PATHNAME=`realpath "$FILENAME"` + PATHNAME=`readlink -f "$FILENAME"` RELPATH=${PATHNAME#$TARGET} SOURCE="$ORIGIN/$RELPATH" @@ -144,7 +143,7 @@ # Remove obsolete directories. for FILENAME in `find "$TARGET" -depth -type d -print` ; do - PATHNAME=`realpath "$FILENAME"` + PATHNAME=`readlink -f "$FILENAME"` RELPATH=${PATHNAME#$TARGET} SOURCE="$ORIGIN/$RELPATH" diff -r 37b1f1aefe07 -r b99553d569c0 tools/makefonts.sh --- a/tools/makefonts.sh Tue May 29 19:02:55 2018 +0200 +++ b/tools/makefonts.sh Tue May 29 22:26:18 2018 +0200 @@ -1,12 +1,7 @@ #!/bin/sh -if ! which realpath > /dev/null ; then - echo "Please install the realpath program." 1>&2 - exit 1 -fi - THISDIR=`dirname "$0"` -DIRNAME=`realpath "$THISDIR/.."` +DIRNAME=`readlink -f "$THISDIR/.."` PROGNAME=`basename "$0"` UNIFONT='/usr/share/unifont/unifont.hex'