Commit 8136f479 authored by Watchtek's avatar Watchtek
Browse files

Optimization & change broken link

parent 08f094a2
Loading
Loading
Loading
Loading
+20 −64
Original line number Diff line number Diff line
#!/bin/bash

PATH_BASE=/watchtek/Install_Files/PACKAGE
PATH_BASE=$PWD

BASE_URL='http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)'
BIGDATA="${BASE_URL}/ws/Docs/BigData/*zip*/BigData.zip"
ML="${BASE_URL}/ws/Dist/agent/*zip*/agent.zip"
DDL="${BASE_URL}/ws/Docs/DDL/MySQL/*zip*/MySQL.zip"
DML="${BASE_URL}/ws/Docs/DML/1.%20INSERT/1.%20KOR/*zip*/1.%20KOR.zip"
AM="${BASE_URL}/ws/Dist/WatchAll_AgentManager/*zip*/WatchAll_AgentManager.zip"
CM="${BASE_URL}/ws/Dist/WatchAll_Applemango/*zip*/WatchAll_Applemango.zip"
DM="${BASE_URL}/ws/Dist/WatchAll_DataManager/*zip*/WatchAll_DataManager.zip"
OZ="${BASE_URL}/ws/oz90/repository_files/*zip*/repository_files.zip"

echo 'PMA Build Module Download'
date +"NOW - %Y-%m-%d %H:%M:%S"
@@ -10,92 +20,38 @@ cd $PATH_BASE || exit
## BigData & ML
mkdir -p BigData && cd BigData || exit
echo 'Download BigData'
curl -fsS --retry 5 -O 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/Docs/BigData/*zip*/BigData.zip'
curl -fsS --retry 5 -O "$BIGDATA"

echo 'Download ML'
curl -fsS --retry 5 -O 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/Dist/agent/*zip*/agent.zip'
curl -fsS --retry 5 -O "$ML"
unzip -q agent.zip && mv agent/* . && rm -rf agent/ agent.zip

## DDL & DML
cd $PATH_BASE || exit
mkdir DB && cd DB || exit


echo 'Download DDL'
curl -fsS --retry 5 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/Docs/DDL/MySQL/*zip*/MySQL.zip' -o Applemango_DDL.zip
curl -fsS --retry 5 "$DDL" -o Applemango_DDL.zip
# unzip -q MySQL.zip && mv MySQL/* . && rm -rf MySQL/ MySQL.zip

echo 'Download DML'
curl -fsS --retry 5 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/Docs/DML/1.%20INSERT/1.%20KOR/*zip*/1.%20KOR.zip' -o Applemango_DML.zip
curl -fsS --retry 5 "$DML" -o Applemango_DML.zip
# unzip -q 1.\ KOR.zip && mv 1.\ KOR/* . && rm -rf 1.\ KOR/ 1.\ KOR.zip

echo 'Download PMA'
curl -fsS --retry 5 -O 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/Docs/PMA/*zip*/PMA.zip'
unzip -q -O cp949 PMA.zip
cd PMA || exit
rm -rf .svn/
mkdir DDL DML
mv ERD/*.sql DDL/
rm -r ERD/

cd DDL/ || exit
cat >> merge_DDL.sh <<'EOF'
#!/bin/bash

#Remove previous DDL merge file
rm -rf PMA.sql

#remove all whitespace characters in every file name
for f in *\ *; do mv "$f" "${f// /_}" > /dev/null 2>&1; done

for file in `ls -al | grep sql | grep -v grep | grep -v oracle | awk '{print $9}'` ; do
  cat "$file" >> PMA.sql
  echo " " >> PMA.sql
done
EOF


cd ..
mv 기준정보/script/* DML/
rm -r 기준정보/

cd DML || exit
cat >> merge_DML.sh <<'EOF'
#!/bin/bash

#Remove previous DML merge file
rm -rf INSERT_DML_PMA.sql

#remove all whitespace characters in every file name
for f in *\ *; do mv "$f" "${f// /_}" > /dev/null 2>&1; done

for file in `ls -al | grep sql | grep -v grep | grep -v oracle | awk '{print $9}'` ; do
  cat "$file" >> INSERT_DML_PMA.sql
  echo " " >> INSERT_DML_PMA.sql
done
EOF

# cd ../ && tree
cd ../
zip -qr PMA.zip DDL/ DML/
cd ../
mv PMA/PMA.zip .
rm -r PMA

## AM, CM, DM
cd $PATH_BASE || exit
mkdir Module && cd Module || exit

echo 'Download AM'
curl -fsS --retry 5 -O 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/Dist/WatchAll_AgentManager/*zip*/WatchAll_AgentManager.zip'
curl -fsS --retry 5 -O "$AM"
unzip -q WatchAll_AgentManager.zip && mv WatchAll_AgentManager/* . && rm -rf WatchAll_AgentManager/ WatchAll_AgentManager.zip

echo 'Download CM'
curl -fsS --retry 5 -O 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/Dist/WatchAll_Applemango/*zip*/WatchAll_Applemango.zip'
curl -fsS --retry 5 -O "$CM"
unzip -q WatchAll_Applemango.zip && mv WatchAll_Applemango/* . && rm -rf WatchAll_Applemango/ WatchAll_Applemango.zip

echo 'Download DM'
curl -fsS --retry 5 -O 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/Dist/WatchAll_DataManager/*zip*/WatchAll_DataManager.zip'
curl -fsS --retry 5 -O "$DM"
unzip -q WatchAll_DataManager.zip && mv WatchAll_DataManager/* . && rm -rf WatchAll_DataManager/ WatchAll_DataManager.zip


@@ -103,14 +59,14 @@ unzip -q WatchAll_DataManager.zip && mv WatchAll_DataManager/* . && rm -rf Watch
cd $PATH_BASE || exit
mkdir OZ && cd OZ || exit
echo 'Download OZ'
curl -fsS --retry 5 -O 'http://192.168.1.3:8080/view/applemango/job/Applemango%20(Opensearch%20-%20PMA%20v2)/ws/oz90/repository_files/*zip*/repository_files.zip'
curl -fsS --retry 5 -O "$OZ"

echo '========================================'
echo 'compress ALL file, plz take some time'
echo  

cd $PATH_BASE || exit
tar --exclude='download_pma_build.sh' \
tar --exclude='*.sh' \
    -zcvf "PMA_$(date '+%y%m%d_%H%M%S').tgz" ./BigData ./DB ./Module ./OZ

echo