-
Notifications
You must be signed in to change notification settings - Fork 54
/
docker-entrypoint.sh
executable file
·65 lines (55 loc) · 2.13 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/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 "$@"