Commit f26b6141 authored by PENGUEN Julien's avatar PENGUEN Julien
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !4
parents 125c1754 9137f609
......@@ -6,7 +6,7 @@
CONF_REPO_ETC42=conf-etc42
IMAGE_ETC42=image_etc42
CONTAINER_NAME_ETC42=etc42
ETC42_VERSION=?
ETC42_VERSION=1.0.3
###########
# VARIOUS #
......@@ -14,3 +14,4 @@ ETC42_VERSION=?
CESAM_URL='http://cesam.lam.fr/Apps/ETC/webstart/'
OUTPUT_DIRECTORY=./.temp
SCRIPT_VERSION=0.1
......@@ -25,64 +25,58 @@ To launch ETC42-docker-shell there are two scripts:
2. For MAC-OS users:
* You must have docker on your mac.(see [Mac-OS docker installation](https://docs.docker.com/docker-for-mac/install/))
* You have to install XQuartz with command line `brew cask install xquartz` (see [XQuartz installation](https://www.xquartz.org/index.html) for MacPorts or others installations type)
* You have to install XQuartz with command line `brew cask install xquartz` (see [XQuartz installation](https://www.xquartz.org/index.html) for MacPorts or others installations type).
# Installation
__*note*__: don't forget to select __Allow connections from network clients__ on XQuartz preferences (preferences -> security)
1. Create a folder for the project ETC42 that will contain all the files needed to run an instance etc42:
```
mkdir ETC42
cd ETC42
```
# Installation
2. Clone the etc42-docker-shell repository:
1. Clone the etc42-docker-shell repository:
```
git clone git@gitlab.lam.fr:etc42/etc42-docker-shell.git etc42-docker
git clone git@gitlab.lam.fr:etc42/etc42-docker-shell.git
```
3. Launch the `etc42.sh` (or `osx_etc42.sh` for MAC-OS users) to create etc42 docker image, build and launch etc42 docker container :
2. Launch the `etc42.sh` (or `osx_etc42.sh` for MAC-OS users) to create etc42 docker image, build and launch etc42 docker container :
```
cd etc42-docker
chmod +x script.sh
./script.sh
./etc42.sh
```
# How to use ETC42
To see all options available for a good use of `etc42.sh` (or `osx_etc42.sh` for MAC-OS users) make:
```
./script.sh -h OR --help
./etc42.sh -h OR --help
```
here are the options available in detail:
1. Get etc42 script information, options available:
```
./script.sh -h OR --help
./etc42.sh -h OR --help
```
2. Get etc42 image version available on CeSAM server and on localhost:
```
./script.sh -i OR --infos
./etc42.sh -i OR --infos
```
3. Build etc42 image with selected VERSION:
```
./script.sh -b VERSION OR --build VERSION
./etc42.sh -b VERSION OR --build VERSION
```
4. Rebuild an localhost existante VERSION of etc42 image:
4. Select a specific etc42 image VERSION:
```
./script.sh -rb VERSION OR --rebuild VERSION
./etc42.sh --select VERSION
```
5. Update the current etc42 image:
```
./script.sh -u OR --update
./etc42.sh -u OR --update
```
6. Remove etc42 image with selected VERSION:
```
./script.sh -rm VERSION OR --remove VERSION
./etc42.sh -rm VERSION OR --remove VERSION
```
7. Give etc42 current version number:
7. Give script etc42.sh current version number:
```
./script.sh -v OR --version
./etc42.sh -v OR --version
```
For the ETC42 user documentation see [ETC42 documentations](https://projets.lam.fr/projects/etc/wiki/Documentation)
......@@ -291,22 +291,9 @@ case $1 in
;;
"-b"|"--build")
#####################################
#################################
# use: ./etc42.sh -b OR --build #
#####################################
#---------------------------------#
#call function function_build_image
function_build_image $2
#---------------------------------#
;;
"-rb"|"--rebuild")
####################################
# use: ./etc42.sh -rb OR --rebuild #
####################################
#################################
version=$2
......@@ -427,39 +414,24 @@ case $1 in
echo ""
echo "-------------------------------------------------------------------"
echo "etc42 versions available on ${CESAM_URL}:"
echo "-------------------------------------------------------------------"
echo " etc42 versions available on :"
echo ""
for jar in ${list_jar}
do
echo -e "\033[31m- CeSAM server : ${CESAM_URL}\033[31m"
echo -e "\033[32m- Localhost\033[0m"
number_version=$(echo ${jar:8} | sed 's/\.jar//')
echo "${number_version}"
done
echo ""
echo "-------------------------------------------------------------------"
echo "etc42 image versions present on localhost:"
echo "-------------------------------------------------------------------"
echo ""
list_image=$(sudo docker images | awk '/^image_etc42-/{print $1}')
list_image_version=$(echo ${list_image:12})
for image in ${list_image}
for jar in ${list_jar}
do
image_version=$(echo ${image:12})
if [ ${image_version} == ${ETC42_VERSION} ]; then
echo "${image_version} => version currently used"
else
number_version=$(echo ${jar:8} | sed 's/\.jar//')
if [ ${number_version} == ${ETC42_VERSION} ]; then
echo -e " \033[32m *\033[0m \033[31m${number_version}\033[0m"
else
echo -e " \033[31m ${number_version}\033[0m"
echo "${image_version}"
fi
fi
done
......@@ -478,7 +450,7 @@ case $1 in
# use: ./etc42.sh -v OR --version #
#####################################
echo '- etc42 version: ' ${ETC42_VERSION}
echo '- etc42.sh version: ' ${SCRIPT_VERSION}
#---------------------------------#
;;
......@@ -534,13 +506,12 @@ case $1 in
echo ""
echo "-i, --infos give informations about versions available on cesam server"
echo " and give informations about etc42 image present on localhost"
echo "-b version, --build version create etc42 image with selected version"
echo "-rb version, --rebuild version rebuild etc42 image with selected version"
echo "-b version, --build version build etc42 image with selected version"
echo "--select version run etc42 with selected version number"
echo "-u, --update update etc42 image version"
echo "-rm version, --remove version remove etc42 image with selected version"
echo "-h, --help show this help message and exit"
echo "-v, --version give etc42 current version number"
echo "-v, --version give etc42.sh current version number"
echo ""
echo "====================="
echo ""
......@@ -564,13 +535,12 @@ case $1 in
echo ""
echo "-i, --infos give informations about versions available on cesam server"
echo " and give informations about etc42 image present on localhost"
echo "-b version, --build version create etc42 image with selected version"
echo "-rb version, --rebuild version rebuild etc42 image with selected version"
echo "-b version, --build version build etc42 image with selected version"
echo "--select version run etc42 with selected version number"
echo "-u, --update update etc42 image version"
echo "-rm version, --remove version remove etc42 image with selected version"
echo "-h, --help show this help message and exit"
echo "-v, --version give etc42 current version number"
echo "-v, --version give etc42.sh current version number"
echo ""
echo "====================="
echo ""
......
......@@ -15,7 +15,7 @@ fonction_get_rtrn()
# returns:
# return result part
echo `echo $1|cut --delimiter=, -f $2`
echo `echo $1|cut -d "," -f $2`
}
function_jar_updated_search()
......@@ -25,7 +25,7 @@ function_jar_updated_search()
# return version number_version
curl -s ${CESAM_URL} | awk -F">" '/ETC-Jar/{print $7, $10}' > .temp
sed -re 's/<\/a/ /g' .temp | awk -F" " '{print$2,$1}' > .temp2
sed -Ee 's/<\/a/ /g' .temp | awk -F" " '{print$2,$1}' > .temp2
version=$(sort -r .temp2 | head -1 | awk '{print $3}')
number_version=$(echo ${version:8} | sed 's/\.jar//')
echo "$version,$number_version"
......@@ -51,7 +51,7 @@ function_build_image()
version=$1
curl -s ${CESAM_URL} | awk -F">" '/ETC-Jar/{print $7, $10}' > .temp
sed -re 's/<\/a/ /g' .temp | awk -F" " '{print$2,$1}' > .temp2
sed -Ee 's/<\/a/ /g' .temp | awk -F" " '{print$2,$1}' > .temp2
list_jar=$(sort -r .temp2 | awk '{print $3}')
present=$(echo $list_jar| grep $version)
......@@ -65,7 +65,7 @@ function_build_image()
echo ''
echo 'To see the available version(s):'
echo ''
echo "Please make ./etc42.sh -i OR --infos"
echo "Please make ./etc42_osx.sh -i OR --infos"
echo ''
echo '------------------------------------'
echo ''
......@@ -92,7 +92,7 @@ function_build_image()
#build
echo "- Creating the etc42-${version} docker image in progress ..."
echo '------------------------------------------------------------------'
docker build --build-arg username=$USER --build-arg uidval=$UID --build-arg home=$HOME --build-arg etc42_version=${version} -t ${IMAGE_ETC42}-${version} ${CONF_REPO_ETC42}
docker build --build-arg username=$USER --build-arg uidval=$UID --build-arg home=/home/$USER --build-arg etc42_version=${version} -t ${IMAGE_ETC42}-${version} ${CONF_REPO_ETC42}
echo "=> creating the etc42-${version} docker image successfully"
echo '------------------------------------------------------------------'
echo ''
......@@ -119,9 +119,9 @@ function_build_image()
case $1 in
""|"--select")
####################
# use: ./etc42.sh #
####################
#######################
# use: ./etc42_osx.sh #
#######################
# ------------------------------------------ #
version_init=$(cat .env | grep ETC42_VERSION)
......@@ -138,7 +138,7 @@ case $1 in
etc42_last_version=`fonction_get_rtrn $RESULT 1`
etc42_last_number_version=`fonction_get_rtrn $RESULT 2`
#----------------------------------------#
sed -i "s/ETC42_VERSION=?/ETC42_VERSION=${etc42_last_number_version}/" .env
sed -i '' "s/ETC42_VERSION=?/ETC42_VERSION=${etc42_last_number_version}/" .env
rm .temp
rm .temp2
......@@ -159,7 +159,7 @@ case $1 in
# --------------- #
curl -s ${CESAM_URL} | awk -F">" '/ETC-Jar/{print $7, $10}' > .temp
sed -re 's/<\/a/ /g' .temp | awk -F" " '{print$2,$1}' > .temp2
sed -Ee 's/<\/a/ /g' .temp | awk -F" " '{print$2,$1}' > .temp2
list_jar=$(sort -r .temp2 | awk '{print $3}')
present=$(echo $list_jar| grep $2)
......@@ -173,7 +173,7 @@ case $1 in
echo ''
echo 'To see the available version(s):'
echo ''
echo "Please make ./etc42.sh -i OR --infos"
echo "Please make ./etc42_osx.sh -i OR --infos"
echo ''
echo '------------------------------------'
echo ''
......@@ -220,7 +220,7 @@ case $1 in
echo ''
echo 'COMMAND TO UPDATE ETC42 VERSION:'
echo ''
echo '=> ./etc42.sh -u OR --update'
echo '=> ./etc42_osx.sh -u OR --update'
echo '------------------------------------'
echo ''
echo ''
......@@ -289,22 +289,9 @@ case $1 in
"-b"|"--build")
#####################################
# use: ./etc42.sh -b OR --build #
# use: ./etc42_osx.sh -b OR --build #
#####################################
#---------------------------------#
#call function function_build_image
function_build_image $2
#---------------------------------#
;;
"-rb"|"--rebuild")
####################################
# use: ./etc42.sh -rb OR --rebuild #
####################################
version=$2
list_jar=$(docker images | awk '/^image_etc42-/{print $1}')
......@@ -320,7 +307,7 @@ case $1 in
echo ''
echo 'To see the available version(s):'
echo ''
echo "Please make ./etc42.sh -i OR --infos"
echo "Please make ./etc42_osx.sh -i OR --infos"
echo ''
echo '------------------------------------'
echo ''
......@@ -345,9 +332,9 @@ case $1 in
;;
"-u"|"--update")
###################################
# use: ./etc42.sh -u OR --update #
###################################
######################################
# use: ./etc42_osx.sh -u OR --update #
######################################
#----------------------------------------#
#call function function_jar_updated_search
......@@ -412,51 +399,36 @@ case $1 in
;;
"-i"|"--infos")
#################################
# use: ./etc42.sh -i OR --infos #
#################################
#####################################
# use: ./etc42_osx.sh -i OR --infos #
#####################################
curl -s ${CESAM_URL} | awk -F">" '/ETC-Jar/{print $7, $10}' > .temp
sed -re 's/<\/a/ /g' .temp | awk -F" " '{print$2,$1}' > .temp2
sed -Ee 's/<\/a/ /g' .temp | awk -F" " '{print$2,$1}' > .temp2
list_jar=$(sort -r .temp2 | awk '{print $3}')
id_image=$(docker inspect --format="{{.Id}}" ${IMAGE_ETC42}-${ETC42_VERSION})
echo ""
echo "-------------------------------------------------------------------"
echo "etc42 versions available on ${CESAM_URL}:"
echo "-------------------------------------------------------------------"
echo " etc42 versions available on :"
echo ""
for jar in ${list_jar}
do
number_version=$(echo ${jar:8} | sed 's/\.jar//')
echo "${number_version}"
done
echo "\033[31m- CeSAM server : ${CESAM_URL}\033[31m"
echo "\033[32m- Localhost\033[0m"
echo ""
echo "-------------------------------------------------------------------"
echo "etc42 image versions present on localhost:"
echo "-------------------------------------------------------------------"
echo ""
list_image=$(docker images | awk '/^image_etc42-/{print $1}')
list_image_version=$(echo ${list_image:12})
for image in ${list_image}
for jar in ${list_jar}
do
image_version=$(echo ${image:12})
if [ ${image_version} == ${ETC42_VERSION} ]; then
echo "${image_version} => version currently used"
else
number_version=$(echo ${jar:8} | sed 's/\.jar//')
if [ ${number_version} == ${ETC42_VERSION} ]; then
echo " \033[32m *\033[0m \033[31m${number_version}\033[0m"
else
echo " \033[31m ${number_version}\033[0m"
echo "${image_version}"
fi
fi
done
......@@ -471,23 +443,23 @@ case $1 in
;;
"-v"|"--version")
#####################################
# use: ./etc42.sh -v OR --version #
#####################################
#######################################
# use: ./etc42_osx.sh -v OR --version #
#######################################
echo '- etc42 version: ' ${ETC42_VERSION}
echo '- etc42_osx.sh version: ' ${SCRIPT_VERSION}
#---------------------------------#
;;
"-rm"|"--remove=")
###################################
# use: ./etc42.sh -rm OR --remove #
###################################
#######################################
# use: ./etc42_osx.sh -rm OR --remove #
#######################################
version=$2
list_image_version=$(sudo docker images | awk '/^image_etc42-/{print $1}')
list_image_version=$(docker images | awk '/^image_etc42-/{print $1}')
present=$(echo $list_image_version| grep $version)
if [ $? -eq 1 ]; then
......@@ -500,7 +472,7 @@ case $1 in
echo ''
echo 'To see the available version(s):'
echo ''
echo "Please make ./etc42.sh -i OR --infos"
echo "Please make ./etc42_osx.sh -i OR --infos"
echo ''
echo '------------------------------------'
echo ''
......@@ -515,29 +487,28 @@ case $1 in
;;
"-h"|"--help")
#################################
# use: ./etc42.sh -h OR --help #
#################################
####################################
# use: ./etc42_osx.sh -h OR --help #
####################################
echo ""
echo "========"
echo "= HELP ="
echo "========"
echo ""
echo "use : ./etc42.sh [options]"
echo "use : ./etc42_osx.sh [options]"
echo ""
echo ""
echo "OPTIONS:"
echo ""
echo "-i, --infos give informations about versions available on cesam server"
echo " and give informations about etc42 image present on localhost"
echo "-b version, --build version create etc42 image with selected version"
echo "-rb version, --rebuild version rebuild etc42 image with selected version"
echo "-b version, --build version build etc42 image with selected version"
echo "--select version run etc42 with selected version number"
echo "-u, --update update etc42 image version"
echo "-rm version, --remove version remove etc42 image with selected version"
echo "-h, --help show this help message and exit"
echo "-v, --version give etc42 current version number"
echo "-v, --version give etc42_osx.sh current version number"
echo ""
echo "====================="
echo ""
......@@ -545,29 +516,28 @@ case $1 in
;;
*)
##################################
# use: ./etc42.sh OTHER COMMAND #
##################################
#####################################
# use: ./etc42_osx.sh OTHER COMMAND #
#####################################
echo ""
echo "==============================="
echo " error: unrecognized arguments "
echo "==============================="
echo ""
echo "use : ./etc42.sh [options]"
echo "use : ./etc42_osx.sh [options]"
echo ""
echo ""
echo "OPTIONS:"
echo ""
echo "-i, --infos give informations about versions available on cesam server"
echo " and give informations about etc42 image present on localhost"
echo "-b version, --build version create etc42 image with selected version"
echo "-rb version, --rebuild version rebuild etc42 image with selected version"
echo "-b version, --build version build etc42 image with selected version"
echo "--select version run etc42 with selected version number"
echo "-u, --update update etc42 image version"
echo "-rm version, --remove version remove etc42 image with selected version"
echo "-h, --help show this help message and exit"
echo "-v, --version give etc42 current version number"
echo "-v, --version give etc42_osx.sh current version number"
echo ""
echo "====================="
echo ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment