Add the ability to build deb packages in a parameterized way

This commit is contained in:
Evgeniy Antonyuk 2024-04-12 19:20:55 +07:00
parent 5a10cf2216
commit da065a01b5
5 changed files with 21 additions and 20 deletions

View File

@ -82,7 +82,7 @@ Depends: {{product}}-common (= {{package_header_tag_version}}), dotnet-sdk-8.0,
Recommends: ffmpeg, opensearch (= 2.11.1)
Description: {{product}}-notify
The service which launches additional services
related to notifications about DocSpace events:
related to notifications about {{product}} events:
NotifySenderService which sends messages from the base,
and NotifyCleanerService which removes messages
@ -149,7 +149,7 @@ Depends: {{product}}-common (= {{package_header_tag_version}}), nodejs (>= 16),
Description: {{product}}-ssoauth
The service responsible for enabling and configuring
SAML-based single sign-on (SSO) authentication to provide a more quick,
easy and secure way to access DocSpace for users
easy and secure way to access {{product}} for users
Package: {{product}}-backup-background
Architecture: all

View File

@ -4,8 +4,8 @@
set -e
if ! cat /etc/passwd | grep -q "onlyoffice:"; then
adduser --quiet --home /var/www/{{product}} --system --group onlyoffice
if ! cat /etc/passwd | grep -q "{{product_sysname}}:"; then
adduser --quiet --home /var/www/{{product}} --system --group {{product_sysname}}
fi
if ! cat /etc/group | grep -q "nginx:"; then
@ -17,6 +17,6 @@ if ! cat /etc/passwd | grep -q "nginx:"; then
usermod -aG nginx nginx
fi
usermod -aG onlyoffice,nginx onlyoffice
usermod -aG {{product_sysname}},nginx {{product_sysname}}
#DEBHELPER#

View File

@ -1,10 +1,10 @@
## COPY PUBLIC ##
debian/build/buildtools/install/common/{{product}}-ssl-setup usr/bin
debian/build/buildtools/install/docker/config/nginx/templates/*.template etc/onlyoffice/{{product}}/openresty
debian/build/buildtools/install/docker/config/nginx/templates/*.template etc/{{product_sysname}}/{{product}}/openresty
debian/build/buildtools/config/nginx/html/*.html etc/openresty/html
debian/build/buildtools/install/docker/config/nginx/onlyoffice* etc/openresty/conf.d
debian/build/buildtools/config/nginx/onlyoffice*.conf etc/openresty/conf.d
debian/build/buildtools/install/docker/config/nginx/{{product_sysname}}* etc/openresty/conf.d
debian/build/buildtools/config/nginx/{{product_sysname}}*.conf etc/openresty/conf.d
debian/build/buildtools/install/docker/config/nginx/letsencrypt* etc/openresty/includes
debian/build/buildtools/config/nginx/includes/onlyoffice*.conf etc/openresty/includes
debian/build/buildtools/config/nginx/includes/{{product_sysname}}*.conf etc/openresty/includes
debian/build/publish/web/public/* var/www/{{product}}/public
debian/build/publish/web/client/* var/www/{{product}}/client

View File

@ -2,8 +2,8 @@
set -e
# (DS v1.1.3) Removing old nginx configs to prevent conflicts before upgrading on OpenResty.
if [ -f /etc/nginx/conf.d/onlyoffice.conf ]; then
rm -rf /etc/nginx/conf.d/onlyoffice*
if [ -f /etc/nginx/conf.d/{{product_sysname}}.conf ]; then
rm -rf /etc/nginx/conf.d/{{product_sysname}}*
systemctl reload nginx
fi

View File

@ -9,6 +9,7 @@ export DH_OPTIONS=-v
dh $@ --with=systemd
PRODUCT={{product}}
PRODUCT_SYSNAME={{product_sysname}}
SOURCE_PATH=${CURDIR}/debian/source
BUILD_PATH=${CURDIR}/debian/build
BUILDTOOLS_PATH=${BUILD_PATH}/buildtools
@ -50,7 +51,7 @@ check_archives:
override_dh_auto_build: check_archives
cd ${BUILDTOOLS_PATH}/install/common/systemd; \
bash build.sh -bp "${CURDIR}/debian/"; \
bash build.sh -bp "${CURDIR}/debian/" -p ${PRODUCT} -ps ${PRODUCT_SYSNAME}; \
cd ${BUILDTOOLS_PATH}/install/common; \
bash build-frontend.sh -sp ${BUILD_PATH} -di "false"; \
bash build-backend.sh -sp ${BUILD_PATH}; \
@ -61,11 +62,11 @@ override_dh_auto_build: check_archives
find ${BUILD_PATH}/**/publish/ \
-depth -type f -regex '.*\(eslintrc.*\|npmignore\|gitignore\|gitattributes\|gitmodules\|un~\|DS_Store\)' -exec rm -f {} \;
rm -f ${BUILDTOOLS_PATH}/config/nginx/onlyoffice-login.conf
rm -f ${BUILDTOOLS_PATH}/config/nginx/${PRODUCT_SYSNAME}-login.conf
if ! grep -q 'var/www/${PRODUCT}' ${BUILDTOOLS_PATH}/config/nginx/*.conf; then find ${BUILDTOOLS_PATH}/config/nginx/ -name "*.conf" -exec sed -i "s@\(var/www/\)@\1${PRODUCT}/@" {} +; fi
json -I -f ${BUILDTOOLS_PATH}/config/appsettings.services.json -e "this.logPath=\"/var/log/onlyoffice/${PRODUCT}\"" -e "this.socket={ 'path': '../ASC.Socket.IO/' }" \
json -I -f ${BUILDTOOLS_PATH}/config/appsettings.services.json -e "this.logPath=\"/var/log/${PRODUCT_SYSNAME}/${PRODUCT}\"" -e "this.socket={ 'path': '../ASC.Socket.IO/' }" \
-e "this.ssoauth={ 'path': '../ASC.SsoAuth/' }" -e "this.logLevel=\"warning\"" -e "this.core={ 'products': { 'folder': '/var/www/${PRODUCT}/products', 'subfolder': 'server'} }"
find ${BUILDTOOLS_PATH}/config/ -type f -regex '.*\.\(test\|dev\).*' -delete
@ -74,21 +75,21 @@ override_dh_auto_build: check_archives
sed 's_\(minlevel=\)"[^"]*"_\1"Warn"_g' -i ${BUILDTOOLS_PATH}/config/nlog.config
sed -e 's_etc/nginx_etc/openresty_g' -e 's/listen\s\+\([0-9]\+\);/listen 127.0.0.1:\1;/g' -i ${BUILDTOOLS_PATH}/config/nginx/*.conf
sed -i "s#\$$public_root#/var/www/${PRODUCT}/public/#g" ${BUILDTOOLS_PATH}/config/nginx/onlyoffice.conf
sed 's/teamlab.info/onlyoffice.com/g' -i ${BUILDTOOLS_PATH}/config/autofac.consumers.json
sed -i "s#\$$public_root#/var/www/${PRODUCT}/public/#g" ${BUILDTOOLS_PATH}/config/nginx/${PRODUCT_SYSNAME}.conf
sed 's/teamlab.info/{{url}}/g' -i ${BUILDTOOLS_PATH}/config/autofac.consumers.json
json -I -f ${CLENT_PATH}/public/scripts/config.json -e "this.wrongPortalNameUrl=\"\""
sed -e 's/$$router_host/127.0.0.1/g' -e 's/this_host\|proxy_x_forwarded_host/host/g' -e 's/proxy_x_forwarded_proto/scheme/g' -e 's/proxy_x_forwarded_port/server_port/g' -e 's_includes_/etc/openresty/includes_g' -i ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy*.conf
sed -e 's/$$router_host/127.0.0.1/g' -e 's/this_host\|proxy_x_forwarded_host/host/g' -e 's/proxy_x_forwarded_proto/scheme/g' -e 's/proxy_x_forwarded_port/server_port/g' -e 's_includes_/etc/openresty/includes_g' -i ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy*.conf
sed "s_\(.*root\).*;_\1 \"/var/www/${PRODUCT}\";_g" -i ${BUILDTOOLS_PATH}/install/docker/config/nginx/letsencrypt.conf
sed -e '/.pid/d' -e '/temp_path/d' -e 's_etc/nginx_etc/openresty_g' -e 's/\.log/-openresty.log/g' -i ${BUILDTOOLS_PATH}/install/docker/config/nginx/templates/nginx.conf.template
mv -f ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy-ssl.conf ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy-ssl.conf.template
cp -rf ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy.conf ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy.conf.template
mv -f ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy-ssl.conf ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy-ssl.conf.template
cp -rf ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy.conf ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy.conf.template
for i in ${PRODUCT} $$(ls ${CURDIR}/debian/*.install | grep -oP 'debian/\K.*' | grep -o '^[^.]*'); do \
cp ${CURDIR}/debian/source/lintian-overrides ${CURDIR}/debian/$$i.lintian-overrides; \
done
execute_after_dh_fixperms:
chmod o-rwx ${CURDIR}/debian/${PRODUCT}-common/etc/onlyoffice/${PRODUCT}/*
chmod o-rwx ${CURDIR}/debian/${PRODUCT}-common/etc/${PRODUCT_SYSNAME}/${PRODUCT}/*
override_dh_auto_install:
dh_systemd_enable --no-enable