debmaker/ressources/flame/debmaker

56 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
VERSION=2.3.0
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=flame
DEPOT=https://github.com/pawelmalak/flame.git
GIT_VERSION=v${VERSION}
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=3
STEP="envinit prebuild build makedeb"
envinit() {
apt-get update
if [ $(dpkg -l | grep -e 'ii nodejs ' | wc -l) -eq 1 ];
then
apt-get dist-upgrade -y
else
apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot build-essential nodejs npm
fi
}
prebuild(){
[ -e /tmp/git ] && rm -fr /tmp/git
[ -e /tmp/${APP} ] || mkdir /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/git
cp -r /tmp/git/. /tmp/${APP}
}
build() {
cd /tmp/${APP}/
npm install mkdirp
npm run dev-init
cd client
npm run build
rm -fr ../public/*
mv build/* ../public/
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
cp -fr /tmp/${APP}/* ${PATH_DEB}/usr/share/flame/
cp -fr /tmp/${APP}/.env ${PATH_DEB}/usr/share/flame/
mv ${PATH_DEB}/usr/share/flame/data ${PATH_DEB}/var/lib/${APP}/data
mv ${PATH_DEB}/usr/share/flame/public ${PATH_DEB}/var/lib/${APP}/public
ln -fs /var/lib/${APP}/data ${PATH_DEB}/usr/share/${APP}/data
ln -fs /var/lib/${APP}/public ${PATH_DEB}/usr/share/${APP}/public
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}