mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-21 13:29:36 +00:00
6931631adc
Define a docker-entrypoint.sh that checks for the environment variables INTERFACES. If INTERFACES is set to "universal" then we do the following: - If the universal/RIncludes directory is not empty, assume that the Universal interfaces are already installed. Call interfaces-and-libraries.sh to link the Universal interfaces instead of the default multiversal interfaces. - Otherwise check the INTERFACESFILE environment variable to locate a suitable Macbinary DiskCopy image of MPW-GM.img.bin containing the "Interfaces&Libraries" directory, which can be a path within the container image itself or an external URL. If the file is a URL then download it first, then decompress the file using ConvertDiskImage and then use the in-built hfsutils to extract the relevant files under /tmp/InterfacesAndLibraries. Finally call interfaces-and-libraries.sh to link the Universal interfaces instead of the default multiversal interfaces. Otherwise use the multiversal interfaces which are included by default.
66 lines
2.1 KiB
Bash
Executable File
66 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
TMPDIR=/tmp
|
|
BUILDDIR=/Retro68-build
|
|
|
|
if [[ $INTERFACES == "universal" ]];
|
|
then
|
|
# If the universal RIncludes directory is empty, download and install the universal headers
|
|
if [ ! "$(ls -A $BUILDDIR/toolchain/universal/RIncludes 2> /dev/null)" ]; then
|
|
# If INTERFACESFILE is empty, exit
|
|
if [[ -z $INTERFACESFILE ]];
|
|
then
|
|
echo -n "Universal interfaces not present, please specify the location of a suitable "
|
|
echo "MacBinary DiskCopy image using the INTERFACESFILE environment variable."
|
|
exit 1
|
|
fi
|
|
|
|
BASEINTERFACESFILE=`basename $INTERFACESFILE`
|
|
|
|
# If INTERFACESFILE is a URL, download it first to TMPDIR. Otherwise assume the file is
|
|
# already present and copy it to TMPDIR for installation
|
|
if [[ $INTERFACESFILE == http* ]];
|
|
then
|
|
echo "Downloading Universal interfaces from MacBinary DiskCopy image $BASEINTERFACESFILE..."
|
|
curl -s $INTERFACESFILE -o $TMPDIR/$BASEINTERFACESFILE
|
|
echo "done"
|
|
else
|
|
if [[ -z $INTERFACESFILE ]];
|
|
then
|
|
echo "Unable to locate universal interfaces file $INTERFACESFILE"
|
|
exit 1
|
|
else
|
|
echo "Using Universal intefaces from MacBinary Diskcopy image $BASEINTERFACESFILE"
|
|
cp $INTERFACESFILE $TMPDIR/$BASEINTERFACESFILE
|
|
fi
|
|
fi
|
|
|
|
# Extract the file
|
|
$BUILDDIR/bin/install-universal-interfaces.sh $TMPDIR $BASEINTERFACESFILE
|
|
|
|
# Switch to universal
|
|
echo "Linking Universal interfaces..."
|
|
$BUILDDIR/bin/interfaces-and-libraries.sh $BUILDDIR/toolchain $TMPDIR/InterfacesAndLibraries
|
|
echo "done"
|
|
else
|
|
echo "Linking Universal interfaces..."
|
|
|
|
# Link to existing universal interfaces
|
|
PREFIX=$BUILDDIR/toolchain
|
|
. "$BUILDDIR/bin/interfaces-and-libraries.sh"
|
|
BUILD_68K=true
|
|
BUILD_PPC=true
|
|
|
|
unlinkInterfacesAndLibraries
|
|
linkInterfacesAndLibraries "universal"
|
|
echo "done"
|
|
fi
|
|
else
|
|
echo "Using multiversal interfaces"
|
|
fi
|
|
|
|
# Execute command
|
|
exec "$@"
|