Commit 3aa0ed36 authored by PENGUEN Julien's avatar PENGUEN Julien
Browse files

ajout option --mount pour monter un volume + ajout verification presence...

ajout option --mount pour monter un volume + ajout verification presence fichier input + presence volume
parent 74210f31
......@@ -13,6 +13,7 @@ function_message()
type_message=$1
message=$2
option=$3
if [ "$type_message" == "TYPE_VAL_ERROR" ]; then
......@@ -23,6 +24,19 @@ function_message()
echo -e "WARNING => ${message}"
echo -e "=========================================================\033[0m"
elif [ "$type_message" == "TYPE_FILE_ERROR" ]; then
echo ""
echo "------------------------------------"
echo ""
echo -e "\033[31m========================================================="
echo -e " ERROR with option '${option}' "
echo -e ""
echo -e "${message}"
echo -e "=========================================================\033[0m"
echo ""
echo "------------------------------------"
elif [ "$type_message" == "TYPE_HELP" ]; then
echo ""
......@@ -148,12 +162,13 @@ function_message()
echo "--area file run photos_montage_aladin with this survey file instead of "
echo "the default file define on .env file. the area file must be on format '.csv'"
echo ""
echo "--angular run photos_montage_aladin with this angular dimension value instead of "
echo "--angular number run photos_montage_aladin with this angular dimension value instead of "
echo "the default angular value define on .env file. the angular value must be on second of arc"
echo "--resolution_col run photos_montage_aladin with this number of pixel by columns for the Image Magick montages"
echo "--resolution_line run photos_montage_aladin with this number of pixel by lines for the Image Magick montages"
echo "--nb_tile_col run photos_montage_aladin with this number of tiles by columns for the Image Magick montages"
echo "--nb_tile_line run photos_montage_aladin with this number of tiles by lines for the Image Magick montages"
echo "--resolution_col number run photos_montage_aladin with this number of pixel by columns for the Image Magick montages"
echo "--resolution_line number run photos_montage_aladin with this number of pixel by lines for the Image Magick montages"
echo "--nb_tile_col number run photos_montage_aladin with this number of tiles by columns for the Image Magick montages"
echo "--nb_tile_line number run photos_montage_aladin with this number of tiles by lines for the Image Magick montages"
echo "--mount path run photos_montage_aladin with a volume mounted on docker container repository /mnt"
echo ""
fi
......@@ -205,6 +220,7 @@ function_build_tab_hach()
ARRAY["--resolution_col"]="NUMBER";
ARRAY["--nb_tile_line"]="NUMBER";
ARRAY["--nb_tile_col"]="NUMBER";
ARRAY["--mount"]="PATH VOLUME";
# ---------------------- #
# ARRAY_WEIGHT[key]=value
......@@ -240,6 +256,7 @@ function_build_tab_hach()
ARGS_WEIGHT["--resolution_col"]=2;
ARGS_WEIGHT["--nb_tile_line"]=2;
ARGS_WEIGHT["--nb_tile_col"]=2;
ARGS_WEIGHT["--mount"]=2;
# -------- #
......@@ -575,7 +592,7 @@ case $taille in
if [ "$tempo_weight_2" == 'TRUE' ]; then
#case '--survey', '--area' ,'--angular'
#'--resolution_line', '--resolution_col',
#'--nb_tile_line','--nb_tile_col'
#'--nb_tile_line','--nb_tile_col', '--mount'
tab2_arg_keys[0]="--no_select"
tab2_arg_values[0]="$ALADIN_VERSION"
......@@ -803,16 +820,48 @@ sort_arg_keys=( ${tab_sort_arg_keys// / } )
sort_arg_values=( ${tab_sort_arg_values// / } )
sort_arg_weight=( ${tab_sort_arg_weight// / } )
#------------------------------#
#check volume_mount input args
VOLUME_MOUNT=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--mount" $VOLUME_MOUNT`
if [[ -d $VOLUME_MOUNT && $VOLUME_MOUNT != "" ]]; then
echo "=> $VOLUME_MOUNT exist"
else
function_message "TYPE_FILE_ERROR" "$VOLUME_MOUNT not found" "--mount"
exit 0
fi
#------------------------------#
#check survey input args
INPUT_FILE_SURVEYS=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--survey" $INPUT_FILE_SURVEYS`
if [ -f $INPUT_FILE_SURVEYS ]; then
echo "=> $INPUT_FILE_SURVEYS exist"
else
function_message "TYPE_FILE_ERROR" "$INPUT_FILE_SURVEYS not found" "--survey"
exit 0
fi
#------------------------------#
#check area input args
INPUT_FILE_AREAS=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--area" $INPUT_FILE_AREAS`
if [ -f $INPUT_FILE_AREAS ]; then
echo "=> $INPUT_FILE_AREAS exist"
else
function_message "TYPE_FILE_ERROR" "$INPUT_FILE_AREAS not found" "--area"
exit 0
fi
#-------------------------------------#
#check angular input arg
......@@ -1154,7 +1203,13 @@ case ${sort_arg_keys[0]} in
script_images[$k]="macro "${area_ajs[$k]}
script_montages[$k]="montage -geometry ${RESOLUTION_BY_LINE}x${RESOLUTION_BY_COL} -tile ${NB_TILE_BY_LINE}x${NB_TILE_BY_COL} ${images_folder[$k]}/*jpg ${montages_folder[$k]}/${list_zone[$k]}.png"
sudo docker run --name photos_montage_aladin --rm -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME:$HOME --network host -e DISPLAY=$DISPLAY -e USER=$USER -e HOME=$HOME image_photos_montage_aladin-${version} /bin/bash -c "java -jar /var/aladin/Aladin-${version}.jar -nogui -trace -script=${script_images[$k]};${script_montages[$k]} " > ${log_aladin_file[$k]} 2>&1
if [[ "${sort_arg_keys[@]}" =~ "--mount" && $VOLUME_MOUNT != "" ]]; then
sudo docker run --name photos_montage_aladin --rm -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME:$HOME -v ${VOLUME_MOUNT}:"/mnt/${VOLUME_MOUNT}" --network host -e DISPLAY=$DISPLAY -e USER=$USER -e HOME=$HOME image_photos_montage_aladin-${version} /bin/bash -c "java -jar /var/aladin/Aladin-${version}.jar -nogui -trace -script=${script_images[$k]};${script_montages[$k]} " > ${log_aladin_file[$k]} 2>&1
else
sudo docker run --name photos_montage_aladin --rm -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME:$HOME --network host -e DISPLAY=$DISPLAY -e USER=$USER -e HOME=$HOME image_photos_montage_aladin-${version} /bin/bash -c "java -jar /var/aladin/Aladin-${version}.jar -nogui -trace -script=${script_images[$k]};${script_montages[$k]} " > ${log_aladin_file[$k]} 2>&1
fi
echo "=> Construction OK"
#----------------------------------------#
......
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