Update scripts in scripts/shell/job/gp

This commit is contained in:
Matheus Albino Brunhara
2024-04-04 13:31:56 -03:00
parent fdbc3d2151
commit 112b94feeb
3 changed files with 55 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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`