]> git.mxchange.org Git - pizzaservice-core.git/blob - dist.sh
updated path for local cp of libraries
[pizzaservice-core.git] / dist.sh
1 #!/bin/bash
2
3 # Name of this project, detected by it's base path
4 NAME="${PWD##*/}"
5
6 # Generated JAR file
7 DIST="dist/${NAME}.jar"
8
9 # WildFly module base path
10 WILDFLY_MODULE_BASE_PATH="${HOME}/wildfly_domain/modules/org/mxchange"
11
12 # And for this "module" (as WildFly calls it)
13 WILDFLY_MODULE_PATH="${WILDFLY_MODULE_BASE_PATH}/${NAME}/main"
14
15 # module.xml
16 WILDFLY_MODULE_XML_FILE="wildfly/module.xml"
17
18 # Glassfish base path (domain)
19 GLASSFISH_BASE_PATH="${HOME}/gf_domain/lib"
20
21 # Remote Glassfish path
22 GLASSFISH_SSH_PATH="/var/payara/domains/domain1/lib"
23
24 # Remote SSH server (password-less access)
25 GLASSFISH_SSH_SERVER="www.mxchange.org"
26
27 # Windows personal domain
28 PERSONAL_DOMAIN_PATH="${HOME}/personal_domain/lib"
29
30 # Generate list
31 LIST=$(find ../*/lib/${NAME}.jar)
32 LIST="${LIST} ${WILDFLY_MODULE_PATH}"
33
34 if [ -d "${GLASSFISH_BASE_PATH}" ]
35 then
36         echo "$0: Glassfish personal domain found, adding to LIST ..."
37         LIST="${LIST} ${GLASSFISH_BASE_PATH}"
38 fi
39
40 if [ -d "${PERSONAL_DOMAIN_PATH}" ]
41 then
42         echo "$0: Personal domain found, adding to LIST ..."
43         LIST="${LIST} ${PERSONAL_DOMAIN_PATH}"
44 fi
45
46 if [ ! -f "${DIST}" ]
47 then
48         echo "$0: '${DIST}' not found."
49         exit 1
50 elif [ ! -d "${WILDFLY_MODULE_BASE_PATH}" ]
51 then
52         echo "$0: WildFly base path '${WILDFLY_MODULE_BASE_PATH}' not created."
53 elif [ ! -d "${WILDFLY_MODULE_PATH}" ]
54 then
55         mkdir -vp "${WILDFLY_MODULE_PATH}"
56 fi
57
58 for project in ${LIST};
59 do
60         if [ -d "${project}" ]
61         then
62                 cp -v "${DIST}" "${project}"
63         elif [ -f "${project}" ]
64         then
65                 cp -v "${DIST}" "${project}"
66         else
67                 echo "$0: Project '${project}' not found."
68         fi
69
70 done
71
72 if [ "$1" != "r" -a -n "${GLASSFISH_SSH_PATH}" -a -n "${GLASSFISH_SSH_SERVER}" -a "${NAME}" != "jcore" -a "${NAME}" != "jcore-swing" ]
73 then
74         echo "$0: Copying to remote '${GLASSFISH_SSH_SERVER}' ..."
75         scp "${DIST}" "${GLASSFISH_SSH_SERVER}:${GLASSFISH_SSH_PATH}"
76 fi
77
78 # Copy module.xml ...
79 if [ -f "${WILDFLY_MODULE_XML_FILE}" ]
80 then
81         echo "$0: Generating module.xml ..."
82         XML_CONTENT=$(cat "${WILDFLY_MODULE_XML_FILE}")
83         XML_CONTENT="${XML_CONTENT//NAME/$NAME}"
84         echo "${XML_CONTENT}" > "${WILDFLY_MODULE_PATH}/module.xml"
85 fi
86
87 echo "$0: All done."
88 exit 0