-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·46 lines (37 loc) · 1.54 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
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
# Packages the Tebex Checkout payment gateway into a distributable zip.
#
# Structure for archive
# - tebexcheckout/ - Library code, logo, etc.
# - callback/tebexcheckout.php - Module callback placed in `modules/gateways/callback`
# - tebexcheckout.php - Module definition placed in `modules/gateways`
#
# This structure allows a user to unzip the archive directly into their `gateways` folder in order to install Tebex.
VERSION="2.0.0"
# Make temporary build dir, clearing it out if it existed
rm -r .build;mkdir .build
mkdir .build/tebexcheckout
# Copy main module files
cp -r lib .build/tebexcheckout/
cp -r vendor .build/tebexcheckout/
cp ./logo.png .build/tebexcheckout/logo.png
echo "To install Tebex Checkout, place the files you see here in your /modules/gateways folder." >> .build/README.txt
cp ./whmcs.json .build/tebexcheckout/whmcs.json
# Copy callback module
mkdir .build/callback
cp callback/tebexcheckout.php .build/callback/tebexcheckout.php
# Copy gateway module
cp gateway/tebexcheckout.php .build/tebexcheckout.php
# Set version in display name
sed -i "s/\%VERSION%/$VERSION/g" .build/tebexcheckout.php
# Create the zip
cd .build
zip -r TebexCheckout-WHMCS-$VERSION.zip *
rm -f README.txt
cd ..
# if in dev, copy the repo files to their install locations
if [[ "$(pwd)" == "/var/www/html/modules/gateways/tebexcheckout" ]]; then
echo "Installing gateway scripts to active WHMCS instance..."
cp -r ./gateway/tebexcheckout.php ../
cp -r ./callback/tebexcheckout.php ../callback/
fi