65 lines
2.1 KiB
Bash
Executable file
65 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
VERSION=2.8.6
|
|
APP=paperless-ngx
|
|
DEPOT=https://github.com/paperless-ngx/paperless-ngx.git
|
|
GIT_VERSION=v${VERSION}
|
|
DEB_VERSION=$VERSION-$(date +%Y%m%d%H%M)
|
|
DEBIAN_VERSION_CODENAME=bookworm
|
|
IMAGE_SIZE=8
|
|
PACKAGE_DEPENDENCY="nodejs python3 python3-pip python3-dev imagemagick fonts-liberation gnupg libpq-dev default-libmysqlclient-dev pkg-config libmagic-dev mime-support libzbar0 poppler-utils unpaper ghostscript icc-profiles-free qpdf liblept5 libxml2 pngquant zlib1g tesseract-ocr"
|
|
|
|
main(){
|
|
base_package_upgrade
|
|
configure_depot_nodejs 20
|
|
install_package_dependency
|
|
default_prebuild
|
|
build
|
|
makedeb
|
|
}
|
|
|
|
build(){
|
|
cd /tmp/${APP}
|
|
/tmp/venv/bin/pip install --upgrade pipenv==2023.12.1 setuptools wheel
|
|
/tmp/venv/bin/pipenv sync --dev
|
|
|
|
|
|
cd /tmp/${APP}/src-ui
|
|
export NODE_OPTIONS=--max-old-space-size=8192
|
|
npm ci
|
|
npx playwright install --with-deps
|
|
./node_modules/.bin/ng build --configuration production
|
|
|
|
cd /tmp/${APP}
|
|
/tmp/venv/bin/pipenv requirements > requirements.txt
|
|
|
|
cd /tmp/${APP}/src
|
|
/tmp/venv/bin/pipenv run python3 manage.py compilemessages
|
|
/tmp/venv/bin/pipenv run python3 manage.py collectstatic --no-input
|
|
}
|
|
|
|
makedeb(){
|
|
PATH_DEB=/tmp/src/rootfs
|
|
mkdir -p ${PATH_DEB}/usr/lib/systemd/system/
|
|
mkdir -p ${PATH_DEB}/usr/share/paperless-ngx
|
|
mkdir -p ${PATH_DEB}/usr/share/doc/paperless-ngx
|
|
mkdir -p ${PATH_DEB}/etc/default
|
|
mkdir -p ${PATH_DEB}/var/cache/paperless-ngx
|
|
|
|
cp -fr /tmp/${APP}/src/ ${PATH_DEB}/usr/share/paperless-ngx
|
|
cp -fr /tmp/${APP}/requirements.txt ${PATH_DEB}/usr/share/paperless-ngx
|
|
cp -fr /tmp/${APP}/static ${PATH_DEB}/usr/share/paperless-ngx
|
|
cp -fr /tmp/${APP}/gunicorn.conf.py ${PATH_DEB}/usr/share/paperless-ngx
|
|
cp -fr /tmp/${APP}/paperless.conf.example ${PATH_DEB}/etc/default/paperless-ngx
|
|
|
|
cp -fr /tmp/${APP}/README.md ${PATH_DEB}/usr/share/doc/paperless-ngx
|
|
cp -fr /tmp/${APP}/LICENSE ${PATH_DEB}/usr/share/doc/paperless-ngx
|
|
|
|
mv /tmp/src/prestart.sh ${PATH_DEB}/usr/share/paperless-ngx
|
|
|
|
mv /tmp/src/*.service ${PATH_DEB}/usr/lib/systemd/system/
|
|
|
|
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
|
|
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
|
|
|
|
}
|