#!/bin/bash VERSION=2.14.0 APP=kimai2 DEPOT=https://github.com/kevinpapst/kimai2.git GIT_VERSION=${VERSION} DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M) DEBIAN_VERSION_CODENAME=bookworm IMAGE_SIZE=2 PACKAGE_DEPENDENCY="composer php-zip php-gd php-intl php-xsl" main() { base_package_upgrade install_package_dependency default_prebuild build makedeb } build() { cd /tmp/${APP} composer install --no-dev --optimize-autoloader -n rm -fr var/cache/* rm -fr .env.dist .editorconfig .git* .php-cs-fixer.dist.php phpunit.xml.dist } makedeb(){ PATH_DEB=/tmp/src/rootfs mkdir -p ${PATH_DEB}/usr/share/${APP}/ cp -fr /tmp/${APP}/. ${PATH_DEB}/usr/share/${APP}/ mkdir -p ${PATH_DEB}/etc/ mv ${PATH_DEB}/usr/share/${APP}/.env ${PATH_DEB}/etc/${APP}.conf ln -s /etc/${APP}.conf ${PATH_DEB}/usr/share/${APP}/.env mkdir -p ${PATH_DEB}/usr/share/doc/${APP}/ mv ${PATH_DEB}/usr/share/${APP}/{CHANGELOG.md,CONTRIBUTING.md,LICENSE,README.md,SECURITY.md,UPGRADING.md} ${PATH_DEB}/usr/share/doc/${APP}/ mkdir -p ${PATH_DEB}/var/lib/ mv ${PATH_DEB}/usr/share/${APP}/var ${PATH_DEB}/var/lib/${APP} ln -s /var/lib/${APP} ${PATH_DEB}/usr/share/${APP}/var sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist }