forked from btactic/zsuitecrm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·37 lines (30 loc) · 1 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
VERSION="$(head -n 1 VERSION)"
ABOUT_STANZA="$(head -n 1 ABOUT_STANZA)"
POWERED_LINK="$(head -n 1 POWERED_LINK)"
ZIMLET_NAME="com_irontec_zsugar"
ZIMLET_BUILD_DIR="${ZIMLET_NAME}_tmpbuilddir"
# Create build directory
if [ ! -d "${ZIMLET_BUILD_DIR}" ] ; then
cp -a "${ZIMLET_NAME}" "${ZIMLET_BUILD_DIR}"
else
echo "${ZIMLET_BUILD_DIR} directory should not exist in the first place."
echo "${ZIMLET_BUILD_DIR} Aborting !!!"
exit 1
fi
# Replace version
cd "${ZIMLET_BUILD_DIR}"
FILES_TO_REPLACE="com_irontec_zsugar.xml com_irontec_zsugar.properties com_irontec_zsugar_*.properties"
for nfile in ${FILES_TO_REPLACE} ; do
sed -i 's~@@ABOUT_STANZA@@~'"${ABOUT_STANZA}"'~g' "${nfile}"
sed -i 's~@@POWERED_LINK@@~'"${POWERED_LINK}"'~g' "${nfile}"
sed -i 's~@@VERSION@@~'"${VERSION}"'~g' "${nfile}"
done
cd ..
# Create zip
cd "${ZIMLET_BUILD_DIR}"
zip -q -r ../${ZIMLET_NAME}.zip *
cd ..
echo 'An installable version of zimlet was created on: '"${ZIMLET_NAME}"'.zip'
rm -rf "${ZIMLET_BUILD_DIR}"
exit 0