kanidm/platform/debian/kanidm-unixd/rules

106 lines
2.8 KiB
Plaintext
Raw Normal View History

#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
include /usr/share/dpkg/architecture.mk
# be REALLY noisy
export DH_VERBOSE=1
export DH_OPTIONS=-v
export DEB_BUILD_OPTIONS=noautodbgsym
PACKAGE=kanidm-unixd
PKGDIR=debian/${PACKAGE}
BINDIR=${PKGDIR}/usr/sbin/
LIBDIR=${PKGDIR}/lib/${DEB_HOST_MULTIARCH}
SHARED_DIR=${PKGDIR}/usr/share/${PACKAGE}
PAMDIR=${PKGDIR}/usr/share/pam-configs/
DISTRIBUTOR_ID=$(shell lsb_release -is)
DISTRIBUTOR_RELEASE=$(shell lsb_release -rs)
DISTRIBUTOR=$(DISTRIBUTOR_ID)_$(DISTRIBUTOR_RELEASE)
Fix debian versioning (#2472) * Make the ubuntu_docker_builder.sh script a bit easier to use - Entrypoint that installs dependencies on launch - Echo hint on how to build deb packages * Change debian packaging version string format to fix sort order The sort order is important so that newer packages are seen as an update and get installed, instead of apt preferring the older versions! With these changes, a package is generated as `kanidm_Ubuntu_22.04_1:1.1.0~rc.15-dev~202401311334+c8a9e2c_x86_64.deb` with the version string `1:1.1.0~rc.15-dev~202401311334+c8a9e2c` Deb package version string comparison is Complex: https://man7.org/linux/man-pages/man7/deb-version.7.html With the previous versioning scheme for dev packages, the git hash ended up getting prioritized over the date string, see for example: `dpkg --compare-versions 1.1.0-rc.15-dev-202401100453666448f lt 1.1.0-rc.15-dev-20240120072786916a3; echo $?` -> 1 (comparison failure) A simple schema change avoiding most dashes could rescue the hash trouble: `dpkg --compare-versions 1.1.0~rc.15-dev-202401100453+666448f lt 1.1.0-rc.15-dev-202401200727+86916a3; echo $?` -> 0 (comparison success) .. But, the second problem is seeing a stable release as newer: `dpkg --compare-versions 1.1.0~rc.15-dev~202401100453+666448f lt 1.1.0; echo $?` -> 1 (comparison failure) .. Which can be solved by forcing the entire dev portion to not be interpreted as a debian version by substituting tildes: `dpkg --compare-versions 1.1.0~rc.15-dev~202401100453+666448f lt 1.1.0; echo $?` -> 0 (comparison success) .. But, old schema versions still seem newer due to their debian version: `dpkg --compare-versions 1.1.0-rc.15-dev-202401100453666448f lt 1.1.0~rc.15-dev~202401200727+86916a3; echo $?` -> 1 (comparison failure) Thus, the only solution is to change the scheme and increment the epoch value once to force all lesser default epoch versions to be seen as older: `dpkg --compare-versions 1.1.0-rc.15-dev-202401100453666448f lt 1:1.1.0~rc.15-dev~202401200727+86916a3; echo $?` -> 0 (comparison success) `dpkg --compare-versions 1:1.1.0~rc.15-dev~202401200727+86916a3 lt 1:1.1.0; echo $?` -> 0 (comparison success) * Drop epoch field from deb filenames GitHub Actions enforces NTFS compatible artifact filenames, ergo the colon required for the epoch field is banned. The epoc is still in the version field itself, just not in the filename. --------- Co-authored-by: Jinna Kiisuo <jinna+git@nocturnal.fi>
2024-02-05 09:06:43 +01:00
# GitHub enforces NTFS compatible filenames for artifacts so we need to drop the EPOCH field
DEB_VERSION_FULL=$(shell dpkg-parsechangelog --show-field Version | sed -E 's/^[0-9]+://')
%:
dh $@ --with systemd
override_dh_auto_clean:
override_dh_autoreconf:
override_dh_auto_build:
# this runs "make -- release/${PACKAGE} release/kanidm-ssh"
KANIDM_BUILD_PROFILE=release_suse_generic dh_auto_build -- release/${PACKAGE} release/kanidm-ssh
override_dh_auto_test:
override_dh_shlibdeps:
override_dh_strip:
# Do the systemd things
override_dh_installinit:
install -g root -o root \
platform/debian/systemd/${PACKAGE}.service \
debian/
dh_systemd_enable -p${PACKAGE} --name=${PACKAGE} ${PACKAGE}.service
dh_installinit -p${PACKAGE} --no-start --noscripts
dh_systemd_start -p${PACKAGE} --no-restart-on-upgrade
install -g root -o root \
platform/debian/systemd/${PACKAGE}-tasks.service \
debian/
dh_systemd_enable -p${PACKAGE} --name=${PACKAGE}-tasks ${PACKAGE}-tasks.service
dh_installinit -p${PACKAGE} --name=${PACKAGE}-tasks --no-start --noscripts
dh_systemd_start -p${PACKAGE} --name=${PACKAGE}-tasks --no-restart-on-upgrade
override_dh_systemd_start:
echo "Not running dh_systemd_start"
override_dh_auto_install:
mkdir -p ${BINDIR}
mkdir -p ${PAMDIR}
mkdir -p ${LIBDIR}/security
install \
-g root -o root \
target/release/kanidm_ssh_authorizedkeys \
${BINDIR}
install \
-g root -o root \
target/release/kanidm_ssh_authorizedkeys_direct \
${BINDIR}
install \
-g root -o root \
target/release/kanidm_unixd \
${BINDIR}
install \
-g root -o root \
target/release/kanidm-unix \
${BINDIR}
install \
-g root -o root \
target/release/kanidm_unixd_tasks \
${BINDIR}
install \
-g root -o root \
target/release/libpam_kanidm.so \
${LIBDIR}/security/pam_kanidm.so
install \
-g root -o root \
target/release/libnss_kanidm.so \
${LIBDIR}/libnss_kanidm.so.2
install \
-g root -o root -m 644 \
debian/kanidm.pam \
${PAMDIR}/kanidm
override_dh_installexamples:
mkdir -p ${SHARED_DIR}
install -D \
-g root -o root \
examples/kanidm \
${SHARED_DIR}/
install -D \
-g root -o root \
examples/unixd \
${SHARED_DIR}/
override_dh_builddeb:
dh_builddeb --filename ${PACKAGE}_${DISTRIBUTOR}_${DEB_VERSION_FULL}_${DEB_HOST_GNU_CPU}.deb