From 646dca68c259ddfb139542e125efa32c85823187 Mon Sep 17 00:00:00 2001 From: Markus Frei Date: Thu, 29 Oct 2026 10:29:06 +0100 Subject: [PATCH 1/2] feat(swisscom-schweiz-ag-cdr-client): package the curaLINE Client Repack the linux-amd64 tarball from Swisscom's download page (a Hydraulic Conveyor build with a bundled Java runtime) for EL 8 to 10, Fedora 44, SLES 15/16, Debian 12/13 and Ubuntu 22.04 to 26.04, x86_64 only. Name and paths follow Swisscom's .deb, so the package updates hosts that installed it; the preinst turns its /etc symlink into a directory and keeps the configuration. Differences to Swisscom's .deb: a static account instead of DynamicUser, the configuration created below /etc by the postinst instead of a symlink into /usr/lib, a root-owned installation, local-folder in the state directory instead of the private /tmp, and the UI with its X11/GL/ALSA dependencies split off into -gui (not on EL 8 and SLES 15, it needs glibc 2.34). The unit starts the client through /usr/bin/env, so systemd transitions to unconfined_service_t on SELinux; lib_t below /usr/lib has no transition. check-upstream.sh gains PKG_UPSTREAM_TYPE='url', since the GitHub tags of swisscom/cdr-client run ahead of the download page; the package reads Swisscom's apt Packages file. Verified: smoke test on all 11 targets; on Rocky 10 with SELinux enforcing against the upstream mock API (login, download, upload, sandbox, reinstall); upgrade from Swisscom's .deb on Debian 13. --- CHANGELOG.md | 1 + CONTRIBUTING.md | 16 +- build/check-upstream.sh | 32 ++- .../deb/debian/control | 52 +++++ .../deb/debian/copyright | 31 +++ .../deb/debian/rules | 47 ++++ .../deb/debian/source/format | 1 + .../swisscom-schweiz-ag-cdr-client.postinst | 29 +++ .../swisscom-schweiz-ag-cdr-client.postrm | 12 ++ .../swisscom-schweiz-ag-cdr-client.preinst | 23 ++ .../swisscom-schweiz-ag-cdr-client.service | 51 +++++ .../swisscom-schweiz-ag-cdr-client.sysusers | 3 + .../package.conf | 44 ++++ .../rpm/swisscom-schweiz-ag-cdr-client.spec | 200 ++++++++++++++++++ 14 files changed, 537 insertions(+), 5 deletions(-) create mode 100644 packages/swisscom-schweiz-ag-cdr-client/deb/debian/control create mode 100644 packages/swisscom-schweiz-ag-cdr-client/deb/debian/copyright create mode 100755 packages/swisscom-schweiz-ag-cdr-client/deb/debian/rules create mode 100644 packages/swisscom-schweiz-ag-cdr-client/deb/debian/source/format create mode 100644 packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.postinst create mode 100644 packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.postrm create mode 100644 packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.preinst create mode 100644 packages/swisscom-schweiz-ag-cdr-client/files/swisscom-schweiz-ag-cdr-client.service create mode 100644 packages/swisscom-schweiz-ag-cdr-client/files/swisscom-schweiz-ag-cdr-client.sysusers create mode 100644 packages/swisscom-schweiz-ag-cdr-client/package.conf create mode 100644 packages/swisscom-schweiz-ag-cdr-client/rpm/swisscom-schweiz-ag-cdr-client.spec diff --git a/CHANGELOG.md b/CHANGELOG.md index dcdffc7..99cf19e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * acme.sh packages for RHEL 8 to 10, Fedora, SLES and openSUSE Leap 15 and 16, Debian 12 and 13 and Ubuntu 22.04 to 26.04, with all DNS API, deploy and notify hooks; acme.sh no longer upgrades itself, updates come through the package manager. +* curaLINE Client packages (`swisscom-schweiz-ag-cdr-client`) for RHEL 8 to 10, Fedora, SLES and openSUSE Leap 15 and 16, Debian 12 and 13 and Ubuntu 22.04 to 26.04 (x86_64), repacked from Swisscom's release, with a static service account and the UI split off into `swisscom-schweiz-ag-cdr-client-gui` (not on RHEL 8 and SLES 15); they update hosts that installed Swisscom's .deb and keep its configuration. * Build pipeline that turns Linuxfabrik's own and third-party software into RPM and DEB packages for EL, Fedora, SLES, Debian and Ubuntu. * DEB packages carry the target distro in their version (e.g. `4.5.8-1+debian13`), so each suite gets its own build. * exoscale-cli (`exo`) packages for RHEL 8 to 10, Fedora, SLES and openSUSE Leap 15 and 16, Debian 12 and 13 and Ubuntu 22.04 to 26.04, built from source; they replace the upstream RPM mirrored under repo.linuxfabrik.ch/exoscale/cli and update hosts that installed it. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 763d8f3..e329f41 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -234,7 +234,7 @@ through FPM flags. ```bash PKG_VERSION='4.5.8' # upstream version we package (tag without prefix) -PKG_UPSTREAM_TYPE='github' # github | gitlab | none +PKG_UPSTREAM_TYPE='github' # github | gitlab | url | none PKG_UPSTREAM_PROJECT='nicolargo/glances' PKG_SOURCE_TARBALL="glances-${PKG_VERSION}.tar.gz" PKG_SOURCE_URL="https://github.com/${PKG_UPSTREAM_PROJECT}/archive/v${PKG_VERSION}/${PKG_SOURCE_TARBALL}" @@ -257,6 +257,17 @@ PKG_SMOKE_TEST='glances --version' # run as nobody after installing into a fres duplicity, for example, tags `rel.3.2.2`. - `PKG_UPSTREAM_URL`: the GitLab instance, default `https://gitlab.com`. +`PKG_UPSTREAM_TYPE='url'` is for upstreams that publish binaries on a download page that +lags behind their tags, such as the curaLINE Client. `PKG_UPSTREAM_URL` is then the page +to read, and `PKG_UPSTREAM_REGEX` a Perl regex (`grep --perl-regexp --only-matching`) +that matches the versions on it; `\K` cuts off a prefix. The highest match counts: + +```bash +PKG_UPSTREAM_TYPE='url' +PKG_UPSTREAM_URL='https://cdr.health.swisscom.ch/share/downloads/debian/Packages' +PKG_UPSTREAM_REGEX='^Version: \K[0-9.]+$' +``` + `PKG_UPSTREAM_TYPE='none'` is for packages without an upstream, such as `linuxfabrik-release`; they are rebuilt by changing their package directory. Such a package keeps its source in the repository and sets `PKG_SOURCE_DIR` (e.g. `src`) @@ -379,7 +390,8 @@ pre-commit, CodeQL, Scorecard, dependency review) keep their common names. 1. **Version detection**: `lf-check-upstream.yml` runs hourly and compares each `PKG_VERSION` with the latest upstream version. When the upstream is ahead, it opens a bump pull request. Upstreams on GitHub and GitLab are supported, by - release or by tag (see `PKG_UPSTREAM_SOURCE`). An upstream that cannot be + release or by tag (see `PKG_UPSTREAM_SOURCE`), and download pages (see + `PKG_UPSTREAM_TYPE='url'`). An upstream that cannot be queried fails the run. Linuxfabrik's own projects do not have to wait for the next run: their release workflow sends a `repository_dispatch` of type `upstream-release` to this repository. diff --git a/build/check-upstream.sh b/build/check-upstream.sh index ab13c5d..81623ce 100755 --- a/build/check-upstream.sh +++ b/build/check-upstream.sh @@ -20,17 +20,24 @@ # With --write it also rewrites PKG_VERSION in package.conf to the latest version. # # Upstream coordinates in package.conf: -# PKG_UPSTREAM_TYPE github | gitlab | none +# PKG_UPSTREAM_TYPE github | gitlab | url | none # PKG_UPSTREAM_PROJECT e.g. nicolargo/glances, or group/subgroup/project +# PKG_UPSTREAM_REGEX type url: Perl regex that matches the versions # PKG_UPSTREAM_SOURCE releases (default) | tags # PKG_UPSTREAM_TAG_PREFIX stripped from the tag to get the version, default v -# PKG_UPSTREAM_URL GitLab instance, default https://gitlab.com +# PKG_UPSTREAM_URL GitLab instance, default https://gitlab.com; for +# type url the page to read the versions from # # `releases` takes the release the upstream marks as latest; drafts and # prereleases never count. `tags` takes the highest version among all tags that # start with the prefix, skipping alpha, beta, dev, pre and rc tags. Use it for # projects that tag without publishing releases. # +# `url` is for upstreams that publish binaries on a download page that lags +# behind their tags, such as the curaLINE Client. It takes the highest version +# that PKG_UPSTREAM_REGEX matches on the page PKG_UPSTREAM_URL, read line by +# line with `grep --perl-regexp --only-matching`; use \K to cut off a prefix. +# # Honors GITHUB_TOKEN and GITLAB_TOKEN to avoid API rate limits and to read # private GitLab projects (releases only; tags are read with `git ls-remote`). @@ -108,13 +115,29 @@ latest_tag_version() { | tail -1 } +# Print the highest version PKG_UPSTREAM_REGEX matches on PKG_UPSTREAM_URL. +latest_url_version() { + local page + page="$(curl --fail --silent --show-error --location "$PKG_UPSTREAM_URL")" \ + || die "could not fetch $PKG_UPSTREAM_URL" + { grep --perl-regexp --only-matching "$PKG_UPSTREAM_REGEX" <<< "$page" || true; } \ + | sort --version-sort \ + | tail -1 +} + case "${PKG_UPSTREAM_TYPE:-}" in github | gitlab) ;; +url) + if [ -z "${PKG_UPSTREAM_REGEX:-}" ]; then + die "PKG_UPSTREAM_TYPE='url' needs PKG_UPSTREAM_REGEX" + fi + PKG_UPSTREAM_SOURCE='url' + ;; none) echo "$dir: no upstream to watch (PKG_UPSTREAM_TYPE='none')" >&2 exit 1 ;; -*) die "PKG_UPSTREAM_TYPE must be github, gitlab or none, not '${PKG_UPSTREAM_TYPE:-}'" ;; +*) die "PKG_UPSTREAM_TYPE must be github, gitlab, url or none, not '${PKG_UPSTREAM_TYPE:-}'" ;; esac case "$PKG_UPSTREAM_SOURCE" in @@ -128,6 +151,9 @@ releases) tags) latest="$(latest_tag_version)" ;; +url) + latest="$(latest_url_version)" + ;; *) die "PKG_UPSTREAM_SOURCE must be releases or tags, not '$PKG_UPSTREAM_SOURCE'" ;; esac diff --git a/packages/swisscom-schweiz-ag-cdr-client/deb/debian/control b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/control new file mode 100644 index 0000000..6da4416 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/control @@ -0,0 +1,52 @@ +Source: swisscom-schweiz-ag-cdr-client +Maintainer: Linuxfabrik GmbH +Section: misc +Priority: optional +Standards-Version: 4.6.2 +Homepage: https://github.com/swisscom/cdr-client +Rules-Requires-Root: no +Build-Depends: debhelper-compat (= 13) + +# The dependencies are listed by hand, as in Swisscom's .deb: dpkg-shlibdeps +# knows nothing about the libraries of the bundled Java runtime, and the +# libraries only the UI loads belong to the -gui package. +Package: swisscom-schweiz-ag-cdr-client +Architecture: amd64 +Depends: ${misc:Depends}, + libc6, + systemd | systemd-standalone-sysusers | systemd-sysusers +Description: client for the curaLINE Document Routing (CDR) service + The curaLINE Client exchanges documents with the curaLINE Document Routing + (CDR) service of Swisscom for participants in the Swiss healthcare system. It + uploads the files of a source folder and puts the documents it downloads into + a target folder. + . + This package contains the service. The UI is in + swisscom-schweiz-ag-cdr-client-gui. + +Package: swisscom-schweiz-ag-cdr-client-gui +Architecture: amd64 +Depends: ${misc:Depends}, + hicolor-icon-theme, + libasound2t64 | libasound2, + libdbus-1-3, + libfontconfig1, + libgl1, + libstdc++6, + libsystemd0, + libx11-6, + libxext6, + libxi6, + libxrender1, + libxtst6, + swisscom-schweiz-ag-cdr-client (= ${binary:Version}) +# Swisscom's .deb ships the UI in the base package. Unversioned, since its +# versions carry no Debian revision to compare against; the base package of +# this source ships none of the UI files. +Replaces: swisscom-schweiz-ag-cdr-client +Description: UI of the curaLINE Client + The curaLINE Client exchanges documents with the curaLINE Document Routing + (CDR) service of Swisscom for participants in the Swiss healthcare system. + . + This package contains the desktop UI, cdr-client-ui, to configure and watch + the client. diff --git a/packages/swisscom-schweiz-ag-cdr-client/deb/debian/copyright b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/copyright new file mode 100644 index 0000000..10bc0e7 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/copyright @@ -0,0 +1,31 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: cdr-client +Upstream-Contact: Swisscom (Schweiz) AG +Source: https://cdr.health.swisscom.ch/share/downloads/download.html + +Files: * +Copyright: Swisscom (Schweiz) AG +License: Apache-2.0 + On Debian systems, the complete text of the Apache License version 2.0 can be + found in "/usr/share/common-licenses/Apache-2.0". + +Files: lib/runtime/* +Copyright: Oracle and/or its affiliates, and the other authors of OpenJDK +License: GPL-2.0 with Classpath exception + The bundled Java runtime is built from OpenJDK. The license texts of the + runtime and of the libraries it contains are in lib/runtime/legal/ below + /usr/lib/swisscom-schweiz-ag/cdr-client. + . + On Debian systems, the complete text of the GNU General Public License + version 2 can be found in "/usr/share/common-licenses/GPL-2". + +Files: debian/* +Copyright: 2026 Linuxfabrik GmbH +License: Unlicense + This is free and unencumbered software released into the public domain. + . + Anyone is free to copy, modify, publish, use, compile, sell, or distribute + this software, either in source code form or as a compiled binary, for any + purpose, commercial or non-commercial, and by any means. + . + For more information, please refer to . diff --git a/packages/swisscom-schweiz-ag-cdr-client/deb/debian/rules b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/rules new file mode 100755 index 0000000..beddc45 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/rules @@ -0,0 +1,47 @@ +#!/usr/bin/make -f + +APPDIR = /usr/lib/swisscom-schweiz-ag/cdr-client +BASE = debian/swisscom-schweiz-ag-cdr-client +GUI = debian/swisscom-schweiz-ag-cdr-client-gui + +%: + dh $@ + +override_dh_auto_configure: + # The default configuration downloads into java.io.tmpdir, which is + # private to the service (PrivateTmp=yes) and emptied on every restart, + # so the documents being downloaded would be lost. Use the state + # directory instead. + sed --in-place 's|^\( local-folder:\).*|\1 /var/lib/swisscom-schweiz-ag/cdr-client|' lib/app/conf/application-customer.yaml + +override_dh_auto_build: + # prebuilt + +override_dh_auto_install: + install -d $(BASE)$(APPDIR) $(BASE)/etc/swisscom-schweiz-ag/cdr-client $(BASE)/usr/bin + cp --archive bin lib $(BASE)$(APPDIR)/ + # Conveyor's own unit; ours replaces it + rm --recursive $(BASE)$(APPDIR)/lib/systemd + ln --symbolic $(APPDIR)/bin/cdr-client-service $(BASE)/usr/bin/cdr-client-service + # dh_installsysusers is not part of the debhelper 13 sequence; the + # postinst runs systemd-sysusers itself + install -D -m 0644 debian/swisscom-schweiz-ag-cdr-client.sysusers $(BASE)/usr/lib/sysusers.d/swisscom-schweiz-ag-cdr-client.conf + # the UI + install -d $(GUI)$(APPDIR)/bin $(GUI)$(APPDIR)/lib/app/conf $(GUI)/usr/bin $(GUI)/usr/share + mv $(BASE)$(APPDIR)/bin/cdr-client-ui $(GUI)$(APPDIR)/bin/ + mv $(BASE)$(APPDIR)/lib/app/conf/logback-ui.xml $(GUI)$(APPDIR)/lib/app/conf/ + # the native libraries of the UI toolkit (Compose, tray icon, desktop theme) + install -d $(GUI)$(APPDIR)/lib/runtime/lib + mv $(addprefix $(BASE)$(APPDIR)/lib/runtime/lib/,libLinuxTray.so libnucleus_linux_theme.so libskiko-linux-x64.so) $(GUI)$(APPDIR)/lib/runtime/lib/ + ln --symbolic $(APPDIR)/bin/cdr-client-ui $(GUI)/usr/bin/cdr-client-ui + cp --archive share/applications share/icons share/metainfo $(GUI)/usr/share/ + +# Leave the binaries of the bundled Java runtime as Swisscom built them, and +# keep its private libraries out of the shlibs and ldconfig handling. +override_dh_dwz: + +override_dh_makeshlibs: + +override_dh_shlibdeps: + +override_dh_strip: diff --git a/packages/swisscom-schweiz-ag-cdr-client/deb/debian/source/format b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.postinst b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.postinst new file mode 100644 index 0000000..70aab31 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.postinst @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +if [ "$1" = configure ]; then + # The account has to exist before the configuration is handed to it and + # before the service is started by the debhelper snippet below. + systemd-sysusers swisscom-schweiz-ag-cdr-client.conf + + # The configuration is not part of the package. It holds the client + # secret, the client rewrites it when it renews its credential, and it may + # belong to another account such as `hnet` (see the unit). Create it from + # the defaults if it is missing, and hand it to the service account if it + # belongs to root, since the client refuses to start with a file it does + # not own. + confdir=/etc/swisscom-schweiz-ag/cdr-client + for file in application-customer.yaml logback-service.xml; do + if [ ! -e "$confdir/$file" ]; then + install -m 0640 "/usr/lib/swisscom-schweiz-ag/cdr-client/lib/app/conf/$file" "$confdir/$file" + fi + if [ "$(stat --format='%u' "$confdir/$file")" = 0 ]; then + chown swisscom-schweiz-ag-cdr-client:swisscom-schweiz-ag-cdr-client "$confdir/$file" + chmod 0640 "$confdir/$file" + fi + done +fi + +#DEBHELPER# + +exit 0 diff --git a/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.postrm b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.postrm new file mode 100644 index 0000000..85f2802 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.postrm @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# the configuration created by the postinst, with the client secret +if [ "$1" = purge ]; then + rm --force /etc/swisscom-schweiz-ag/cdr-client/application-customer.yaml \ + /etc/swisscom-schweiz-ag/cdr-client/logback-service.xml +fi + +#DEBHELPER# + +exit 0 diff --git a/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.preinst b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.preinst new file mode 100644 index 0000000..f661af8 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/deb/debian/swisscom-schweiz-ag-cdr-client.preinst @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +# Swisscom's .deb links /etc/swisscom-schweiz-ag/cdr-client to the +# configuration below /usr/lib, which this package replaces with a directory. +# Keep the configuration: copy it into a real directory before dpkg unpacks +# this package over it. The postinst hands it to the service account. +confdir=/etc/swisscom-schweiz-ag/cdr-client +if [ "$1" = upgrade ] && [ -L "$confdir" ]; then + olddir="$(readlink --canonicalize "$confdir")" + rm "$confdir" + mkdir "$confdir" + for file in application-customer.yaml logback-service.xml; do + if [ -f "$olddir/$file" ]; then + cp "$olddir/$file" "$confdir/$file" + chmod 0640 "$confdir/$file" + fi + done +fi + +#DEBHELPER# + +exit 0 diff --git a/packages/swisscom-schweiz-ag-cdr-client/files/swisscom-schweiz-ag-cdr-client.service b/packages/swisscom-schweiz-ag-cdr-client/files/swisscom-schweiz-ag-cdr-client.service new file mode 100644 index 0000000..a523ace --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/files/swisscom-schweiz-ag-cdr-client.service @@ -0,0 +1,51 @@ +# Based on the unit of Swisscom's .deb, but with a static account instead of +# `DynamicUser=yes`, so that the client can be run under an existing account +# such as `hnet` by a drop-in. The sandboxing that `DynamicUser=yes` implies is +# set explicitly. The client may only write to the directories below, so the +# folders of the connectors have to be added by a drop-in as well: +# +# [Service] +# ReadWritePaths=/data/xml +# # optional +# Group=hnet +# User=hnet + +[Unit] +After=network-online.target +Description=curaLINE Client +Wants=network-online.target + +[Service] +CacheDirectory=swisscom-schweiz-ag/cdr-client +# writable for the client, which rewrites application-customer.yaml when it +# renews its credential +ConfigurationDirectory=swisscom-schweiz-ag/cdr-client +# independent of the home of the account, so the client never writes into an +# existing home such as /home/hnet +Environment=HOME=/var/lib/swisscom-schweiz-ag/cdr-client +# Started through /usr/bin/env because of SELinux on the Red Hat family: the +# client below /usr/lib is lib_t, for which systemd has no domain transition, +# while bin_t makes it transition to unconfined_service_t, which may execute +# the client. +ExecStart=/usr/bin/env /usr/lib/swisscom-schweiz-ag/cdr-client/bin/cdr-client-service +Group=swisscom-schweiz-ag-cdr-client +LogsDirectory=swisscom-schweiz-ag/cdr-client +LogsDirectoryMode=0750 +NoNewPrivileges=yes +PrivateTmp=yes +ProtectHome=read-only +ProtectSystem=strict +# the client exits with 29 after renewing its credential, to be restarted +Restart=always +RestartSec=10s +RestrictSUIDSGID=yes +StateDirectory=swisscom-schweiz-ag/cdr-client +# the JVM exits with 143 on SIGTERM +SuccessExitStatus=143 +SyslogIdentifier=cdr-client +Type=exec +User=swisscom-schweiz-ag-cdr-client +WorkingDirectory=/usr/lib/swisscom-schweiz-ag/cdr-client + +[Install] +WantedBy=multi-user.target diff --git a/packages/swisscom-schweiz-ag-cdr-client/files/swisscom-schweiz-ag-cdr-client.sysusers b/packages/swisscom-schweiz-ag-cdr-client/files/swisscom-schweiz-ag-cdr-client.sysusers new file mode 100644 index 0000000..09fc4d5 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/files/swisscom-schweiz-ag-cdr-client.sysusers @@ -0,0 +1,3 @@ +# the account of swisscom-schweiz-ag-cdr-client.service, with the group of the +# same name +u swisscom-schweiz-ag-cdr-client - "curaLINE Client" /var/lib/swisscom-schweiz-ag/cdr-client /usr/sbin/nologin diff --git a/packages/swisscom-schweiz-ag-cdr-client/package.conf b/packages/swisscom-schweiz-ag-cdr-client/package.conf new file mode 100644 index 0000000..4bbcdc9 --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/package.conf @@ -0,0 +1,44 @@ +# Build manifest for swisscom-schweiz-ag-cdr-client. Sourced by +# build/create-package.sh. +# +# The curaLINE Client of Swisscom, which exchanges documents with the curaLINE +# Document Routing (CDR) service of the Swiss healthcare system. It is built +# with Hydraulic Conveyor, which needs a commercial license and bundles a Java +# runtime, so the package repacks the linux-amd64 tarball from the Swisscom +# download page instead of building from source. The tarball holds the same +# files as Swisscom's own .deb (checked 2026-10-29). The package keeps the +# name and the paths of that .deb, so it updates hosts that installed it. It +# differs in a static service account instead of `DynamicUser=yes`, real +# configuration files below /etc instead of a symlink into /usr/lib, a root +# owned installation, and the UI split off into the -gui package. + +PKG_VERSION='6.2.1' + +# Where build/check-upstream.sh looks for new versions: the apt repository on +# the download page. The GitHub tags of swisscom/cdr-client run ahead of the +# download page, which only offers the latest version and removes the older +# ones. +PKG_UPSTREAM_TYPE='url' +PKG_UPSTREAM_URL='https://cdr.health.swisscom.ch/share/downloads/debian/Packages' +PKG_UPSTREAM_REGEX='^Version: \K[0-9.]+$' + +# Upstream binary tarball. It unpacks to cdr-client-/. +PKG_SOURCE_TARBALL="cdr-client-${PKG_VERSION}-linux-amd64.tar.gz" +PKG_SOURCE_URL="https://cdr.health.swisscom.ch/share/downloads/${PKG_SOURCE_TARBALL}" + +# RPM recipe and the EL/Fedora/SLES targets it is built for. The UI needs +# glibc 2.34, so EL 8 and SLES 15 get the service only. +PKG_RPM_SPEC='rpm/swisscom-schweiz-ag-cdr-client.spec' +PKG_RPM_DISTROS='fedora-v44 rocky-v8 rocky-v9 rocky-v10 sles-v15 sles-v16' + +# DEB recipe and the Debian/Ubuntu targets it is built for. +PKG_DEB_DEBIAN_DIR='deb/debian' +PKG_DEB_DISTROS='debian-v12 debian-v13 ubuntu-v2204 ubuntu-v2404 ubuntu-v2604' + +# Swisscom only publishes the client for linux-amd64. +PKG_ARCHES='x86_64' + +# Run after installing the package into a fresh container, as user nobody: the +# packaged version is installed, and the client starts, finds its configuration +# and stops because nobody may not read it. +PKG_SMOKE_TEST="test -f /usr/lib/swisscom-schweiz-ag/cdr-client/lib/app/cdr-client-service-${PKG_VERSION}-plain.jar && timeout 120 cdr-client-service 2>&1 | grep --fixed-strings 'exists but does not point to a readable, regular file'" diff --git a/packages/swisscom-schweiz-ag-cdr-client/rpm/swisscom-schweiz-ag-cdr-client.spec b/packages/swisscom-schweiz-ag-cdr-client/rpm/swisscom-schweiz-ag-cdr-client.spec new file mode 100644 index 0000000..e2ce4dd --- /dev/null +++ b/packages/swisscom-schweiz-ag-cdr-client/rpm/swisscom-schweiz-ag-cdr-client.spec @@ -0,0 +1,200 @@ +# Version and release are injected by build/create-rpm.sh via --define. Provide +# defaults so the spec still parses (e.g. for `dnf builddep`) without them. +%{!?pkg_version: %global pkg_version 0} +%{!?pkg_release: %global pkg_release 0} + +%global appdir %{_prefix}/lib/swisscom-schweiz-ag/cdr-client +%global confdir %{_sysconfdir}/swisscom-schweiz-ag/cdr-client +%global statedir %{_sharedstatedir}/swisscom-schweiz-ag/cdr-client + +# The tarball is a prebuilt application with its own Java runtime. Leave the +# binaries as Swisscom built them: no debug package, no stripping, and no +# build-id links, which the identical launchers of both packages would clash on. +%global debug_package %{nil} +%global _build_id_links none +%global __brp_strip %{nil} +%global __brp_strip_comment_note %{nil} +%global __brp_strip_static_archive %{nil} +%global __strip /bin/true +# The launchers find the bundled runtime through the runpath +# ${ORIGIN}/../lib/runtime/lib, which check-rpaths rejects for the braces. +%global __brp_check_rpaths %{nil} + +# The libraries of the bundled runtime are private: provide none of them, and +# require none of them or the libraries only the UI loads. The -gui package +# requires the latter explicitly. +%global __provides_exclude_from ^%{appdir}/ +%global __requires_exclude ^lib(asound\\.so\\.2|awt|dbus-1\\.so\\.3|fontconfig\\.so\\.1|freetype|GL\\.so\\.1|java|jli|jvm|net|stdc\\+\\+\\.so\\.6|systemd\\.so\\.0|X11\\.so\\.6|Xext\\.so\\.6|Xi\\.so\\.6|Xrender\\.so\\.1|Xtst\\.so\\.6) + +# the native libraries of the UI toolkit (Compose, tray icon, desktop theme), +# which go into the -gui package +%global guilibs libLinuxTray.so libnucleus_linux_theme.so libskiko-linux-x64.so + +# The UI needs glibc 2.34, which EL 8 and SLES 15 do not have. +%if 0%{?rhel} >= 9 || 0%{?fedora} || 0%{?suse_version} >= 1600 +%bcond_without gui +%else +%bcond_with gui +%endif + +Name: swisscom-schweiz-ag-cdr-client +Version: %{pkg_version} +Release: %{pkg_release}%{?dist} +Summary: Client for the curaLINE Document Routing (CDR) service + +# the client is Apache-2.0, the bundled Java runtime GPL-2.0 with the Classpath +# exception, the bundled Java libraries come under their own licenses +License: Apache-2.0 AND GPL-2.0-only WITH Classpath-exception-2.0 +URL: https://github.com/swisscom/cdr-client +Source0: https://cdr.health.swisscom.ch/share/downloads/cdr-client-%{version}-linux-amd64.tar.gz +Source1: %{name}.service +Source2: %{name}.sysusers + +ExclusiveArch: x86_64 + +BuildRequires: systemd-rpm-macros +%if 0%{?suse_version} +Requires(pre): shadow +%else +Requires(pre): shadow-utils +%endif +# /usr/bin/env in the unit +Requires: coreutils + +%description +The curaLINE Client exchanges documents with the curaLINE Document Routing +(CDR) service of Swisscom for participants in the Swiss healthcare system. It +uploads the files of a source folder and puts the documents it downloads into +a target folder. + +This package contains the service. The UI is in %{name}-gui. + +%if %{with gui} +%package gui +Summary: UI of the curaLINE Client +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: hicolor-icon-theme +Requires: libasound.so.2()(64bit) +Requires: libdbus-1.so.3()(64bit) +Requires: libfontconfig.so.1()(64bit) +Requires: libGL.so.1()(64bit) +Requires: libstdc++.so.6()(64bit) +Requires: libsystemd.so.0()(64bit) +Requires: libX11.so.6()(64bit) +Requires: libXext.so.6()(64bit) +Requires: libXi.so.6()(64bit) +Requires: libXrender.so.1()(64bit) +Requires: libXtst.so.6()(64bit) + +%description gui +The curaLINE Client exchanges documents with the curaLINE Document Routing +(CDR) service of Swisscom for participants in the Swiss healthcare system. + +This package contains the desktop UI, cdr-client-ui, to configure and watch +the client. +%endif + +%prep +%autosetup -n cdr-client-%{version} + +# The default configuration downloads into java.io.tmpdir, which is private to +# the service (PrivateTmp=yes) and emptied on every restart, so the documents +# being downloaded would be lost. Use the state directory instead. +sed --in-place 's|^\( local-folder:\).*|\1 %{statedir}|' lib/app/conf/application-customer.yaml + +%build +# prebuilt + +%install +install -d %{buildroot}%{appdir} +cp --archive bin lib %{buildroot}%{appdir}/ +install -d %{buildroot}%{_bindir} +ln --symbolic %{appdir}/bin/cdr-client-service %{buildroot}%{_bindir}/cdr-client-service +install -d %{buildroot}%{confdir} +install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service +install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf +# Conveyor's own unit; ours replaces it +rm --recursive %{buildroot}%{appdir}/lib/systemd + +%if %{with gui} +ln --symbolic %{appdir}/bin/cdr-client-ui %{buildroot}%{_bindir}/cdr-client-ui +install -d %{buildroot}%{_datadir} +cp --archive share/applications share/icons share/metainfo %{buildroot}%{_datadir}/ +%else +rm %{buildroot}%{appdir}/bin/cdr-client-ui %{buildroot}%{appdir}/lib/app/conf/logback-ui.xml +for lib in %{guilibs}; do + rm %{buildroot}%{appdir}/lib/runtime/lib/$lib +done +%endif + +%pre +# the account of sysusers.d/%{name}.conf, for the rpm versions that do not +# create it from there +getent group %{name} >/dev/null || groupadd --system %{name} +getent passwd %{name} >/dev/null || \ + useradd --system --gid %{name} --home-dir %{statedir} --no-create-home \ + --shell /usr/sbin/nologin --comment 'curaLINE Client' %{name} +exit 0 + +%post +# The configuration is not part of the package. It holds the client secret, +# the client rewrites it when it renews its credential, and it may belong to +# another account such as `hnet` (see the unit). Create it from the defaults +# if it is missing, and hand it to the service account if it belongs to root, +# since the client refuses to start with a file it does not own. +for file in application-customer.yaml logback-service.xml; do + if [ ! -e %{confdir}/$file ]; then + install -m 0640 %{appdir}/lib/app/conf/$file %{confdir}/$file + fi + if [ "$(stat --format='%%u' %{confdir}/$file)" = 0 ]; then + chown %{name}:%{name} %{confdir}/$file + chmod 0640 %{confdir}/$file + fi +done +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%license lib/runtime/legal +%dir %{_prefix}/lib/swisscom-schweiz-ag +%dir %{appdir} +%dir %{appdir}/bin +%{appdir}/bin/cdr-client-service +%dir %{appdir}/lib +%dir %{appdir}/lib/app +%{appdir}/lib/app/*.jar +%{appdir}/lib/app/icon* +%dir %{appdir}/lib/app/conf +%{appdir}/lib/app/conf/application-customer.yaml +%{appdir}/lib/app/conf/logback-service.xml +%{appdir}/lib/runtime +%if %{with gui} +%exclude %{appdir}/lib/runtime/lib/libLinuxTray.so +%exclude %{appdir}/lib/runtime/lib/libnucleus_linux_theme.so +%exclude %{appdir}/lib/runtime/lib/libskiko-linux-x64.so +%endif +%{_bindir}/cdr-client-service +%dir %{_sysconfdir}/swisscom-schweiz-ag +%dir %{confdir} +%{_sysusersdir}/%{name}.conf +%{_unitdir}/%{name}.service + +%if %{with gui} +%files gui +%{appdir}/bin/cdr-client-ui +%{appdir}/lib/app/conf/logback-ui.xml +%{appdir}/lib/runtime/lib/libLinuxTray.so +%{appdir}/lib/runtime/lib/libnucleus_linux_theme.so +%{appdir}/lib/runtime/lib/libskiko-linux-x64.so +%{_bindir}/cdr-client-ui +%{_datadir}/applications/com.swisscom.health.des.cdr.cdr-client.desktop +%{_datadir}/icons/hicolor/*/apps/%{name}.png +%{_datadir}/metainfo/com.swisscom.health.des.cdr.cdr-client.metainfo.xml +%endif + +%changelog From 9bbe49d2ce74ebab41bc37974b685ef5a5f03e46 Mon Sep 17 00:00:00 2001 From: Markus Frei Date: Thu, 29 Oct 2026 11:23:31 +0100 Subject: [PATCH 2/2] fix(swisscom-schweiz-ag-cdr-client): build from a mirror of Swisscom's tarball Swisscom's download page answers GitHub's runners with 403. The tarball is mirrored as an asset of the release sources-swisscom-schweiz-ag-cdr-client, and the package is no longer watched; the url upstream type goes again, nothing else needs it. --- CONTRIBUTING.md | 16 ++-------- build/check-upstream.sh | 32 ++----------------- .../package.conf | 21 ++++++------ 3 files changed, 17 insertions(+), 52 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e329f41..763d8f3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -234,7 +234,7 @@ through FPM flags. ```bash PKG_VERSION='4.5.8' # upstream version we package (tag without prefix) -PKG_UPSTREAM_TYPE='github' # github | gitlab | url | none +PKG_UPSTREAM_TYPE='github' # github | gitlab | none PKG_UPSTREAM_PROJECT='nicolargo/glances' PKG_SOURCE_TARBALL="glances-${PKG_VERSION}.tar.gz" PKG_SOURCE_URL="https://github.com/${PKG_UPSTREAM_PROJECT}/archive/v${PKG_VERSION}/${PKG_SOURCE_TARBALL}" @@ -257,17 +257,6 @@ PKG_SMOKE_TEST='glances --version' # run as nobody after installing into a fres duplicity, for example, tags `rel.3.2.2`. - `PKG_UPSTREAM_URL`: the GitLab instance, default `https://gitlab.com`. -`PKG_UPSTREAM_TYPE='url'` is for upstreams that publish binaries on a download page that -lags behind their tags, such as the curaLINE Client. `PKG_UPSTREAM_URL` is then the page -to read, and `PKG_UPSTREAM_REGEX` a Perl regex (`grep --perl-regexp --only-matching`) -that matches the versions on it; `\K` cuts off a prefix. The highest match counts: - -```bash -PKG_UPSTREAM_TYPE='url' -PKG_UPSTREAM_URL='https://cdr.health.swisscom.ch/share/downloads/debian/Packages' -PKG_UPSTREAM_REGEX='^Version: \K[0-9.]+$' -``` - `PKG_UPSTREAM_TYPE='none'` is for packages without an upstream, such as `linuxfabrik-release`; they are rebuilt by changing their package directory. Such a package keeps its source in the repository and sets `PKG_SOURCE_DIR` (e.g. `src`) @@ -390,8 +379,7 @@ pre-commit, CodeQL, Scorecard, dependency review) keep their common names. 1. **Version detection**: `lf-check-upstream.yml` runs hourly and compares each `PKG_VERSION` with the latest upstream version. When the upstream is ahead, it opens a bump pull request. Upstreams on GitHub and GitLab are supported, by - release or by tag (see `PKG_UPSTREAM_SOURCE`), and download pages (see - `PKG_UPSTREAM_TYPE='url'`). An upstream that cannot be + release or by tag (see `PKG_UPSTREAM_SOURCE`). An upstream that cannot be queried fails the run. Linuxfabrik's own projects do not have to wait for the next run: their release workflow sends a `repository_dispatch` of type `upstream-release` to this repository. diff --git a/build/check-upstream.sh b/build/check-upstream.sh index 81623ce..ab13c5d 100755 --- a/build/check-upstream.sh +++ b/build/check-upstream.sh @@ -20,24 +20,17 @@ # With --write it also rewrites PKG_VERSION in package.conf to the latest version. # # Upstream coordinates in package.conf: -# PKG_UPSTREAM_TYPE github | gitlab | url | none +# PKG_UPSTREAM_TYPE github | gitlab | none # PKG_UPSTREAM_PROJECT e.g. nicolargo/glances, or group/subgroup/project -# PKG_UPSTREAM_REGEX type url: Perl regex that matches the versions # PKG_UPSTREAM_SOURCE releases (default) | tags # PKG_UPSTREAM_TAG_PREFIX stripped from the tag to get the version, default v -# PKG_UPSTREAM_URL GitLab instance, default https://gitlab.com; for -# type url the page to read the versions from +# PKG_UPSTREAM_URL GitLab instance, default https://gitlab.com # # `releases` takes the release the upstream marks as latest; drafts and # prereleases never count. `tags` takes the highest version among all tags that # start with the prefix, skipping alpha, beta, dev, pre and rc tags. Use it for # projects that tag without publishing releases. # -# `url` is for upstreams that publish binaries on a download page that lags -# behind their tags, such as the curaLINE Client. It takes the highest version -# that PKG_UPSTREAM_REGEX matches on the page PKG_UPSTREAM_URL, read line by -# line with `grep --perl-regexp --only-matching`; use \K to cut off a prefix. -# # Honors GITHUB_TOKEN and GITLAB_TOKEN to avoid API rate limits and to read # private GitLab projects (releases only; tags are read with `git ls-remote`). @@ -115,29 +108,13 @@ latest_tag_version() { | tail -1 } -# Print the highest version PKG_UPSTREAM_REGEX matches on PKG_UPSTREAM_URL. -latest_url_version() { - local page - page="$(curl --fail --silent --show-error --location "$PKG_UPSTREAM_URL")" \ - || die "could not fetch $PKG_UPSTREAM_URL" - { grep --perl-regexp --only-matching "$PKG_UPSTREAM_REGEX" <<< "$page" || true; } \ - | sort --version-sort \ - | tail -1 -} - case "${PKG_UPSTREAM_TYPE:-}" in github | gitlab) ;; -url) - if [ -z "${PKG_UPSTREAM_REGEX:-}" ]; then - die "PKG_UPSTREAM_TYPE='url' needs PKG_UPSTREAM_REGEX" - fi - PKG_UPSTREAM_SOURCE='url' - ;; none) echo "$dir: no upstream to watch (PKG_UPSTREAM_TYPE='none')" >&2 exit 1 ;; -*) die "PKG_UPSTREAM_TYPE must be github, gitlab, url or none, not '${PKG_UPSTREAM_TYPE:-}'" ;; +*) die "PKG_UPSTREAM_TYPE must be github, gitlab or none, not '${PKG_UPSTREAM_TYPE:-}'" ;; esac case "$PKG_UPSTREAM_SOURCE" in @@ -151,9 +128,6 @@ releases) tags) latest="$(latest_tag_version)" ;; -url) - latest="$(latest_url_version)" - ;; *) die "PKG_UPSTREAM_SOURCE must be releases or tags, not '$PKG_UPSTREAM_SOURCE'" ;; esac diff --git a/packages/swisscom-schweiz-ag-cdr-client/package.conf b/packages/swisscom-schweiz-ag-cdr-client/package.conf index 4bbcdc9..f1d97ff 100644 --- a/packages/swisscom-schweiz-ag-cdr-client/package.conf +++ b/packages/swisscom-schweiz-ag-cdr-client/package.conf @@ -14,17 +14,20 @@ PKG_VERSION='6.2.1' -# Where build/check-upstream.sh looks for new versions: the apt repository on -# the download page. The GitHub tags of swisscom/cdr-client run ahead of the -# download page, which only offers the latest version and removes the older -# ones. -PKG_UPSTREAM_TYPE='url' -PKG_UPSTREAM_URL='https://cdr.health.swisscom.ch/share/downloads/debian/Packages' -PKG_UPSTREAM_REGEX='^Version: \K[0-9.]+$' +# Swisscom's download page refuses GitHub's runners (HTTP 403, checked +# 2026-10-29), and its GitHub tags run ahead of it, so nothing is watched here. +# A new version is announced by newreleases.io (see the Wartungsarbeiten in the +# wiki). To bump: download the tarball from +# https://cdr.health.swisscom.ch/share/downloads/download.html, upload it with +# `gh release upload sources-swisscom-schweiz-ag-cdr-client ` and set +# PKG_VERSION. +PKG_UPSTREAM_TYPE='none' -# Upstream binary tarball. It unpacks to cdr-client-/. +# Swisscom's linux-amd64 tarball, mirrored as an asset of the release +# sources-swisscom-schweiz-ag-cdr-client of this repository. It unpacks to +# cdr-client-/. PKG_SOURCE_TARBALL="cdr-client-${PKG_VERSION}-linux-amd64.tar.gz" -PKG_SOURCE_URL="https://cdr.health.swisscom.ch/share/downloads/${PKG_SOURCE_TARBALL}" +PKG_SOURCE_URL="https://github.com/Linuxfabrik/packaging/releases/download/sources-swisscom-schweiz-ag-cdr-client/${PKG_SOURCE_TARBALL}" # RPM recipe and the EL/Fedora/SLES targets it is built for. The UI needs # glibc 2.34, so EL 8 and SLES 15 get the service only.