From 112b94feebe6b2de1c120d272d44d66fb14aeed4 Mon Sep 17 00:00:00 2001 From: Matheus Albino Brunhara Date: Thu, 4 Apr 2024 13:31:56 -0300 Subject: [PATCH] Update scripts in scripts/shell/job/gp --- ...e-dbversion-check-on-software-info-file.sh | 48 +++++++++++++++++-- scripts/shell/job/gp/explode-java-files.sh | 16 +++---- scripts/shell/job/gp/team-pipeline-local.sh | 4 +- 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/scripts/shell/job/gp/disable-dbversion-check-on-software-info-file.sh b/scripts/shell/job/gp/disable-dbversion-check-on-software-info-file.sh index fd2e689..891542c 100755 --- a/scripts/shell/job/gp/disable-dbversion-check-on-software-info-file.sh +++ b/scripts/shell/job/gp/disable-dbversion-check-on-software-info-file.sh @@ -1,10 +1,52 @@ #!/bin/bash -filename='software-info.xml' +show_help() { + echo "Usage: $0 [--files|-f files]" + echo "Options:" + echo " --help | -h (Optional) Display help information on how to use this script" + echo " --deployments-dir | -d (Required) Specify the Wildfly's deployment directory" +} -if [ ! -f "$filename" ]; then - echo "Could not find the file \"$filename\" in the current directory." +deployments_dir='' + +while [ "$#" -gt 0 ]; do + case "$1" in + --help|-h) show_help; exit ;; + --deployments-dir|-d) deployments_dir="$2"; shift 2;; + *) shift ;; + esac +done + +if [ -z "$deployments_dir" ]; then + echo "You must specify Wildfly's deployment directory!" + echo "Example: `basename "$0"` --deployments-dir ~/gp/gps/10.30.300.0.0-ETICS-238389-SNAPSHOT/wildfly-8.2.1/ports-01/deployments" exit 1 fi +filename='software-info.xml' + +jar_filename='cpqd-configuration.jar' + +cd $deployments_dir + +scripts_folder=$HOME/repos/personal/personal-devboot/scripts/shell/job/gp +explode_java_files_script_path="$scripts_folder/explode-java-files.sh" + +if [ -f "$jar_filename" ]; then + explode_java_files_script_path --files $jar_filename +fi + +cd $jar_filename + +if [ ! -f "$filename" ]; then + echo "Could not find the file \"$filename\" in the \"$jar_filename\" directory." + exit 1 +fi + +if [ -f "$filename.old" ]; then + rm $filename.old +fi + +cp $filename $filename.old + xmlstarlet ed --inplace --update '//attribute[@name="version"]' --value "." $filename diff --git a/scripts/shell/job/gp/explode-java-files.sh b/scripts/shell/job/gp/explode-java-files.sh index a33331a..41d18c5 100755 --- a/scripts/shell/job/gp/explode-java-files.sh +++ b/scripts/shell/job/gp/explode-java-files.sh @@ -53,19 +53,19 @@ for f in ${files[@]}; do # "f" will have ".old" suffix rm --recursive --force $file_without_old_suffix mv $f $file_without_old_suffix - rm "$file_without_old_suffix.dodeploy" + rm --force "$file_without_old_suffix.dodeploy" - rm --force "$file_without_old_suffix.isdeploying" - rm --force "$file_without_old_suffix.deployed" - rm --force "$file_without_old_suffix.failed" rm --force cpqd-ds.xml.failed + + # for removal of files after else + f=$file_without_old_suffix else mv $f $f.old unzip -d $f $f.old touch $f.dodeploy - - rm --force "$f.isdeploying" - rm --force "$f.deployed" - rm --force "$f.failed" fi + + rm --force "$f.isdeploying" + rm --force "$f.deployed" + rm --force "$f.failed" done diff --git a/scripts/shell/job/gp/team-pipeline-local.sh b/scripts/shell/job/gp/team-pipeline-local.sh index 78272d1..17f58e6 100755 --- a/scripts/shell/job/gp/team-pipeline-local.sh +++ b/scripts/shell/job/gp/team-pipeline-local.sh @@ -256,8 +256,8 @@ for f in ${dot_java_files[@]}; do for p in ${class_file_paths[@]}; do printf "\n" echo "[INFO] Copiando arquivo:" - echo " De: $p" - echo " Para: $class_path_in_target" + echo " De: $class_path_in_target" + echo " Para: $p" cp --force $class_path_in_target `dirname $p`