mirror of https://git.ia64.cc/perso/cos2000v2.git
Nicolas Hordé
4 years ago
7 changed files with 76 additions and 27 deletions
@ -1,2 +0,0 @@
|
||||
#!/bin/bash |
||||
docker build . -t cos2000-compiler-alpine |
@ -1,2 +0,0 @@
|
||||
#!/bin/bash |
||||
docker build . -t cos2000-compiler |
@ -1,23 +1,47 @@
|
||||
#!/bin/bash |
||||
|
||||
function tool { |
||||
echo "*** Fabrication des outils de compilation par Docker (version ${VERSION} config ${CONFIGURATION})" |
||||
docker build - -t $COMPILER < ./docker/dockerfile.${CONFIGURATION} |
||||
} |
||||
|
||||
function configuration { |
||||
echo "*** Création du fichier de configuration" |
||||
echo -en "compilation=alpine\nvideo=vesa" > ./configuration |
||||
} |
||||
|
||||
echo "Autorisation de docker à se connecter à l'écran :0" |
||||
xhost +local:docker |
||||
DOCKER=$(docker -v| grep build) |
||||
ALPINE=$(docker image ls| grep cos2000-compiler-alpine) |
||||
COMPILER=$(docker image ls| grep cos2000-compiler) |
||||
PWD=$(pwd) |
||||
FILE=${PWD}/configuration |
||||
if [ ! -f "$FILE" ]; then |
||||
configuration |
||||
fi |
||||
DOCKER=$(docker -v| grep build) |
||||
if [ "${DOCKER}" == "" ]; then |
||||
echo "Docker n'est pas installé..." |
||||
echo "*** installation si sous gestionnaire de paquet debian (.deb)" |
||||
sudo apt-get install docker |
||||
exit |
||||
elif [ "${ALPINE}" != "" ]; then |
||||
echo "*** lancement de la version Alpine Linux" |
||||
docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data cos2000-compiler-alpine make $1 |
||||
elif [ "${COMPILER}" != "" ]; then |
||||
echo "*** lancement de la version Debian" |
||||
docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data cos2000-compiler make $1 |
||||
exit |
||||
fi |
||||
CONFIGURATION=$(sed -rn 's/^compilation=([^\n]+)$/\1/p' ./configuration) |
||||
VERSION=$(git rev-parse --short HEAD) |
||||
COMPILER=cos2000-compiler-${CONFIGURATION}-${VERSION} |
||||
if [ "$1" == "tool" ]; then |
||||
tool |
||||
exit |
||||
fi |
||||
if [ "$1" == "configuration" ]; then |
||||
configuration |
||||
exit |
||||
fi |
||||
PRESENT=$(docker image ls| grep $COMPILER) |
||||
if [ "${PRESENT}" == "" ]; then |
||||
tool |
||||
fi |
||||
echo "*** lancement de la version ${VERSION}" |
||||
if [ "$1" == "config" ]; then |
||||
docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data $COMPILER make $1 |
||||
else |
||||
echo "Docker est installé mais aucune image docker n'est fonctionnelle..." |
||||
echo "*** compilation de l'image docker" |
||||
docker build ${PWD}/docker/alpine -t cos2000-compiler-alpine |
||||
docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data $COMPILER make $1 |
||||
fi |
||||
|
Loading…
Reference in new issue