build: autocompilation avec choix des révisions et configuration de la compilation
This commit is contained in:
parent
9fb0a7de6d
commit
4cf187aabd
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
docker build . -t cos2000-compiler-alpine
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
docker build . -t cos2000-compiler
|
52
make.sh
52
make.sh
|
@ -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
|
||||
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
|
||||
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
|
||||
docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data $COMPILER make $1
|
||||
fi
|
||||
|
|
8
makefile
8
makefile
|
@ -183,3 +183,11 @@ qemu64: killer
|
|||
$(WAIT2S)
|
||||
$(SPICE)
|
||||
|
||||
config:
|
||||
@echo "*** Options de compilation"
|
||||
@echo "Quelle distribution utiliser avec Docker comme environnement de compilation ?"
|
||||
@echo "Alpine Linux ou Debian [A*/D]"
|
||||
@read line; if [ $$line = "D" ]; then sed -i -r 's/compilation=.*/compilation=debian/' configuration ; else sed -i -r 's/compilation=.*/compilation=alpine/' configuration ; fi
|
||||
@echo "Quel mode vidéo préférez vous utiliser ?"
|
||||
@echo "VESA ou VGA [E*/G]"
|
||||
@read line; if [ $$line = "G" ]; then sed -i -r 's/video=.*/video=vga/' configuration ; else sed -i -r 's/video=.*/video=vesa/' configuration ; fi
|
||||
|
|
41
menu.sh
41
menu.sh
|
@ -3,7 +3,7 @@ PWD=$(pwd)
|
|||
FILE=${PWD}/README.md
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "Les sources ne sont pas complets..."
|
||||
echo "* Récupération des sources"
|
||||
echo "*** Récupération des sources"
|
||||
VERSION=$(git --version|grep version)
|
||||
if [ "${VERSION}" == "" ]; then
|
||||
echo "Git n'est pas installé, veuillez l'installer et relancer le script"
|
||||
|
@ -15,6 +15,10 @@ if [ ! -f "$FILE" ]; then
|
|||
git reset --hard
|
||||
rm -rf ../menu.sh
|
||||
fi
|
||||
FILE=${PWD}/configuration
|
||||
if [ ! -f "$FILE" ]; then
|
||||
./make.sh configuration
|
||||
fi
|
||||
while true
|
||||
do
|
||||
clear
|
||||
|
@ -28,17 +32,18 @@ echo "2u Emulation de COS2000 (uefi)"
|
|||
echo "3l Débuguage de COS2000 (legacy)"
|
||||
echo "3u Débuguage de COS2000 (uefi)"
|
||||
echo "4l Débuguage de COS2000 boot en mode réel (legacy)"
|
||||
echo "4u Débuguage de COS2000 boot en mode réel (legacy)"
|
||||
echo "4u Débuguage de COS2000 boot en mode réel (uefi)"
|
||||
echo "5 Réalisez une sauvegarde"
|
||||
echo "6 Tuer tout les processus"
|
||||
echo "7 Nettoyer les sources"
|
||||
echo "8 Voir le disque en hexadécimal"
|
||||
echo "9 Voir le système en hexadécimal"
|
||||
echo "c Changer la version de developpement"
|
||||
echo "c Changer la version de développement"
|
||||
echo "o Changer les options de développement"
|
||||
echo "0 Quitter"
|
||||
echo "------------------------------------------"
|
||||
echo "Choisissez l'action à réaliser..."
|
||||
read answer
|
||||
read -p"?" answer
|
||||
clear
|
||||
case "${answer}" in
|
||||
0*) exit;;
|
||||
|
@ -54,20 +59,36 @@ case "${answer}" in
|
|||
7*) ./make.sh clean;;
|
||||
8*) ./make.sh view-dsk|more;;
|
||||
9*) ./make.sh view-sys|more;;
|
||||
o*) ./make.sh config;;
|
||||
c*) echo "Version disponibles:"
|
||||
SELECT=$(git branch|grep "*"|tr -d "* ")
|
||||
NUM=1
|
||||
echo "XX Hash d'une révision particulière"
|
||||
while read LINE
|
||||
do
|
||||
echo "${NUM} ${LINE}"
|
||||
(( NUM++ ))
|
||||
done < <(git branch -lr|tr -d "* "|grep -v HEAD|sed s/".*origin\/"//)
|
||||
read ANSWER
|
||||
CHOOSE=$(git branch -lr|tr -d "* "|grep -v HEAD|sed s/".*origin\/"//|tr "\n" " "|cut -d " " -f${ANSWER})
|
||||
echo "vous avez selectionné $ALL..."
|
||||
git checkout $CHOOSE
|
||||
git clean -fd
|
||||
git reset --hard
|
||||
read -p"?" ANSWER
|
||||
COUNT=$(echo -n ${ANSWER}|wc -c)
|
||||
if [ "${COUNT}" == "1" ]; then
|
||||
CHOOSE=$(git branch -lr|tr -d "* "|grep -v HEAD|sed s/".*origin\/"//|tr "\n" " "|cut -d " " -f${ANSWER})
|
||||
echo "vous avez selectionné une branche $CHOOSE..."
|
||||
else
|
||||
EXIST=$(git show ${ANSWER})
|
||||
if [ "${EXIST}" != "" ]; then
|
||||
CHOOSE=${ANSWER}
|
||||
echo "vous avez selectionné une révision ${choose}..."
|
||||
fi
|
||||
fi
|
||||
if [ "${CHOOSE}" != "" ]; then
|
||||
echo "*** Application de la version ${CHOOSE}"
|
||||
git pull
|
||||
git checkout $CHOOSE
|
||||
git clean -fd
|
||||
git reset --hard
|
||||
./make.sh tool
|
||||
fi
|
||||
read
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue