debmaker/ressources/budibase/debmaker

52 lines
1.5 KiB
Bash
Executable File

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