2023-07-18 04:26:07 +08:00
|
|
|
#!/bin/bash -ex
|
|
|
|
|
|
|
|
TARGET=`basename $(pwd)`
|
|
|
|
|
|
|
|
|
|
|
|
PACKAGE=$(echo $TARGET | cut -d'_' -f1)
|
|
|
|
VERSION=$(echo $TARGET | cut -d'_' -f2)
|
|
|
|
DISTRO=$(echo $TARGET | cut -d'_' -f3)
|
|
|
|
TAG=$(echo $TARGET | cut -d'_' -f4)
|
|
|
|
BUILD=$1
|
|
|
|
|
|
|
|
# Clean up directories
|
|
|
|
rm -rf staging
|
|
|
|
rm -rf ./build
|
|
|
|
|
|
|
|
# Create directories for fpm to process
|
2024-08-30 05:40:52 +08:00
|
|
|
DIRS="/usr/local/bin /lib/systemd/system /usr/share/bigbluebutton/nginx /usr/share/bbb-graphql-middleware/"
|
2023-07-18 04:26:07 +08:00
|
|
|
for dir in $DIRS; do
|
|
|
|
mkdir -p staging$dir
|
|
|
|
done
|
|
|
|
|
2023-07-18 17:30:02 +08:00
|
|
|
# go mod tidy
|
|
|
|
go version
|
|
|
|
|
|
|
|
|
|
|
|
CGO_ENABLED=0 go build -o bbb-graphql-middleware cmd/bbb-graphql-middleware/main.go
|
2023-07-18 04:26:07 +08:00
|
|
|
echo "Build of bbb-graphql-middleware finished"
|
|
|
|
|
2023-07-19 00:31:08 +08:00
|
|
|
cp bbb-graphql-middleware staging/usr/local/bin/bbb-graphql-middleware
|
2023-07-18 04:26:07 +08:00
|
|
|
|
2024-05-04 02:56:37 +08:00
|
|
|
mkdir -p staging/etc/nginx/conf.d
|
|
|
|
cp bbb-graphql-client-settings-cache.conf staging/etc/nginx/conf.d
|
|
|
|
|
2024-08-30 05:40:52 +08:00
|
|
|
# Create config file
|
|
|
|
cp config/config.yml staging/usr/share/bbb-graphql-middleware/config.yml
|
|
|
|
|
2024-05-04 02:56:37 +08:00
|
|
|
cp bbb-graphql-middleware.service staging/lib/systemd/system/bbb-graphql-middleware.service
|
2023-07-18 04:26:07 +08:00
|
|
|
|
|
|
|
# Set nginx location
|
2024-05-04 02:56:37 +08:00
|
|
|
cp graphql.nginx staging/usr/share/bigbluebutton/nginx
|
2023-07-18 04:26:07 +08:00
|
|
|
|
|
|
|
. ./opts-$DISTRO.sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build package
|
|
|
|
fpm -s dir -C ./staging -n $PACKAGE \
|
|
|
|
--version $VERSION --epoch $EPOCH \
|
|
|
|
--after-install after-install.sh \
|
|
|
|
--after-remove after-remove.sh \
|
2024-08-30 05:40:52 +08:00
|
|
|
--before-install before-install.sh \
|
2023-07-18 04:26:07 +08:00
|
|
|
--before-remove before-remove.sh \
|
|
|
|
--description "GraphQL middleware component for BigBlueButton" \
|
|
|
|
$DIRECTORIES \
|
|
|
|
$OPTS
|