debmaker/ressources/budibase/debmaker

52 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
VERSION=2.8.28
APP=budibase
DEPOT=https://github.com/Budibase/budibase.git
GIT_VERSION=${VERSION}
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=20
PACKAGE_DEPENDENCY="yarn nodejs build-essential"
main(){
base_package_upgrade
envinit
get_git_source
build
makedeb
}
envinit(){
configure_depot_yarn
configure_depot_nodejs 16
install_package_dependency
}
build() {
cd /tmp/${APP}
npm install -g yarn jest lerna husky --force
yarn
#yarn bootstrap
yarn build
rm -fr /tmp/${APP}/packages/*/build
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
grep "process.env" 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" 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/budibase/
cp -fr /tmp/${APP}/packages/* ${PATH_DEB}/opt/budibase/
cp -fr /tmp/${APP}/node_modules ${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
}