debmaker/ressources/budibase/debmaker
2023-03-30 21:58:28 +02:00

50 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
VERSION=2.3.21
APP=budibase
DEPOT=https://github.com/Budibase/budibase.git
GIT_VERSION=v${VERSION}
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=20
PACKAGE_DEPENDENCY="yarn nodejs"
main(){
base_package_upgrade
envinit
get_git_source
build
makedeb
}
envinit() {
configure_depot_yarn
configure_depot_nodejs 18
install_package_dependency
}
build() {
cd /tmp/${APP}
npm install -g yarn jest lerna --force
yarn
yarn bootstrap
yarn build
rm -fr /tmp/${APP}/packages/*/build
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
grep ":" /tmp/${APP}/packages/server/src/environment.js | cut -d ":" -f 1 | tr -d ' ' | grep ^[A-Z] | awk '{print "#"$1"="}' | sort > ${PATH_DEB}/etc/default/budibase-server
grep ":" /tmp/${APP}/packages/worker/src/environment.ts | cut -d ":" -f 1 | tr -d ' ' | grep ^[A-Z] | awk '{print "#"$1"="}' | sort> ${PATH_DEB}/etc/default/budibase-worker
mkdir -p ${PATH_DEB}/opt/budibase/
cp -fr /tmp/${APP}/packages/* ${PATH_DEB}/opt/budibase/
mkdir -p ${PATH_DEB}/opt/budibase/server/client
cp ${PATH_DEB}/opt/budibase/client/manifest.json ${PATH_DEB}/opt/budibase/server/client
cp ${PATH_DEB}/opt/budibase/client/dist/budibase-client.js ${PATH_DEB}/opt/budibase/server/client
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}