Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debian build path #1331

Merged
merged 7 commits into from Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 45 additions & 16 deletions .github/workflows/debian_package_kanidm.yml
Expand Up @@ -11,40 +11,69 @@ concurrency:
cancel-in-progress: true
jobs:
build-deb-package:
runs-on: ubuntu-20.04
name: Build deb packages
strategy:
matrix:
image:
- ubuntu:22.04
- ubuntu:20.04
- ubuntu:18.04
- debian:11
- debian:10
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
- name: Update package manager
run: sudo apt-get update
run: apt-get update
- name: Install dependencies
run: |
sudo apt-get install -y \
apt-get install -y \
lsb-release \
libpam0g-dev \
libudev-dev \
libssl-dev \
libsqlite3-dev \
pkg-config \
make
- uses: jetli/wasm-pack-action@v0.4.0
make \
curl \
sudo
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
# Optional version of wasm-pack to install(eg. 'v0.9.1', 'latest')
version: 'latest'
toolchain: stable
override: true
default: true
- name: "Doing the package build"
run: |
make -f platform/debian/Makefile debs/all
- name: Upload debs
uses: actions/upload-artifact@v3
with:
name: ubuntu-packages
path: |
target/*.deb
upload-to-releases:
name: Upload to releases
needs: build-deb-package
runs-on: ubuntu-latest
steps:
- name: Download previously built debs
uses: actions/download-artifact@v3
with:
name: ubuntu-packages
- name: List packages
run: |
ls
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Ubuntu Packages (20.04)"
files: target/*.deb
title: "Ubuntu Packages"
files: "*.deb"
if: ${{ github.ref == 'refs/heads/master' }}
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Expand Up @@ -22,6 +22,7 @@
- Florian Klink (flokli)
- Kaleb Olson (kalebo)
- Jan Christoph Ebersbach (jceb)
- Yuxuan Lu (leoleoasd)

## Acknowledgements

Expand Down
2 changes: 1 addition & 1 deletion examples/systemd/kanidm-unixd.service
@@ -1,5 +1,5 @@
# You should not need to edit this file. Instead, use a drop-in file by running:
# systemctl edit kanidm-unixd-tasks.service
# systemctl edit kanidm-unixd.service

[Unit]
Description=Kanidm Local Client Resolver
Expand Down
2 changes: 1 addition & 1 deletion examples/systemd/kanidmd.service
@@ -1,5 +1,5 @@
# You should not need to edit this file. Instead, use a drop-in file by running:
# systemctl edit kanidm-unixd-tasks.service
# systemctl edit kanidmd.service

[Unit]
Description=Kanidm, the IDM for rustaceans
Expand Down
4 changes: 1 addition & 3 deletions kanidm_book/src/packaging_debs.md
Expand Up @@ -16,10 +16,8 @@ debs/kanidm:
build a .deb for the Kanidm CLI
debs/kanidmd:
build a .deb for the Kanidm daemon
debs/kanidm-ssh:
build a .deb for the Kanidm SSH tools
debs/kanidm-unixd:
build a .deb for the Kanidm UNIX tools (PAM/NSS, unixd and related tools)
build a .deb for the Kanidm UNIX tools (PAM/NSS, unixd and related tools) and SSH tools
debs/all:
build all the debs
```
Expand Down
13 changes: 4 additions & 9 deletions platform/debian/Makefile
Expand Up @@ -7,23 +7,18 @@ help:
.PHONY: debs/kanidm
debs/kanidm: ## Build the Kanidm CLI package - make sure you set the environment variable KANIDM_BUILD_PROFILE
debs/kanidm:
./platform/debian/build_kanidm.sh kanidm
bash ./platform/debian/build_kanidm.sh kanidm

.PHONY: debs/kanidmd
debs/kanidmd: ## Build the Kanidmd package - make sure you set the environment variable KANIDM_BUILD_PROFILE
debs/kanidmd:
./platform/debian/build_kanidm.sh kanidmd

.PHONY: debs/kanidm-ssh
debs/kanidm-ssh: ## Bbuild the Kanidm SSH package - make sure you set the environment variable KANIDM_BUILD_PROFILE
debs/kanidm-ssh:
./platform/debian/build_kanidm.sh kanidm-ssh
bash ./platform/debian/build_kanidm.sh kanidmd

.PHONY: debs/kanidm-unixd
debs/kanidm-unixd: ## Build the Kanidm UNIX tools package (PAM/NSS, unixd and related tools) - make sure you set the environment variable KANIDM_BUILD_PROFILE
debs/kanidm-unixd:
./platform/debian/build_kanidm.sh kanidm-unixd
bash ./platform/debian/build_kanidm.sh kanidm-unixd

.PHONY: debs/all
debs/all: ## Build all the .deb packages - make sure you set the environment variable KANIDM_BUILD_PROFILE
debs/all: debs/kanidmd debs/kanidm debs/kanidm-ssh debs/kanidm-unixd
debs/all: debs/kanidmd debs/kanidm debs/kanidm-unixd
14 changes: 0 additions & 14 deletions platform/debian/kanidm-ssh/control

This file was deleted.

34 changes: 0 additions & 34 deletions platform/debian/kanidm-ssh/postinst

This file was deleted.

44 changes: 0 additions & 44 deletions platform/debian/kanidm-ssh/rules

This file was deleted.

2 changes: 2 additions & 0 deletions platform/debian/kanidm-unixd/postinst
Expand Up @@ -14,6 +14,8 @@ case "$1" in
echo "============================="
echo "Please ensure you create configuration files at /etc/kanidm/unixd and /etc/kanidm/config"
echo "Examples are in /usr/share/kanidm-unixd/"
echo "To configure pam module, please run pam-auth-update and select Kanidm"
echo "To configure nsswitch, please follow instructions in https://kanidm.github.io/kanidm/master/integrations/pam_and_nsswitch.html"
fi
;;

Expand Down
40 changes: 33 additions & 7 deletions platform/debian/kanidm-unixd/rules
@@ -1,6 +1,6 @@
#!/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
Expand All @@ -9,7 +9,12 @@ 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}
DISTRIBUTOR_ID=$(shell lsb_release -is)
DISTRIBUTOR_RELEASE=$(shell lsb_release -rs)
DISTRIBUTOR=$(DISTRIBUTOR_ID)_$(DISTRIBUTOR_RELEASE)
DEB_VERSION_FULL=$(shell dpkg-parsechangelog --show-field Version)

%:
dh $@ --with systemd
Expand All @@ -19,7 +24,7 @@ override_dh_auto_clean:
override_dh_autoreconf:

override_dh_auto_build:
KANIDM_BUILD_PROFILE=release_suse_generic dh_auto_build -- release/${PACKAGE}
KANIDM_BUILD_PROFILE=release_suse_generic dh_auto_build -- release/${PACKAGE} release/kanidm-ssh

override_dh_auto_test:
override_dh_shlibdeps:
Expand All @@ -28,24 +33,33 @@ override_dh_strip:
# Do the systemd things
override_dh_installinit:
install -g root -o root \
examples/systemd/${PACKAGE}.service \
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 \
examples/systemd/${PACKAGE}-tasks.service \
platform/debian/systemd/${PACKAGE}-tasks.service \
debian/
dh_systemd_enable -p${PACKAGE} --name=${PACKAGE}-tasks ${PACKAGE}-tasks.service
dh_installinit -p${PACKAGE} --no-start --noscripts
dh_systemd_start -p${PACKAGE} --no-restart-on-upgrade
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 ${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 \
Expand All @@ -66,6 +80,15 @@ override_dh_auto_install:
-g root -o root \
target/release/kanidm_cache_invalidate \
${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



override_dh_installexamples:
Expand All @@ -76,5 +99,8 @@ override_dh_installexamples:
${SHARED_DIR}/
install -D \
-g root -o root \
examples/config \
examples/unixd \
${SHARED_DIR}/

override_dh_builddeb:
dh_builddeb --filename ${PACKAGE}_${DISTRIBUTOR}_${DEB_VERSION_FULL}_${DEB_HOST_GNU_CPU}.deb
8 changes: 8 additions & 0 deletions platform/debian/kanidm/rules
@@ -1,6 +1,7 @@
#!/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
Expand All @@ -10,6 +11,10 @@ PACKAGE=kanidm
PKGDIR=debian/${PACKAGE}
BINDIR=${PKGDIR}/usr/bin/
SHARED_DIR=${PKGDIR}/usr/share/${PACKAGE}
DISTRIBUTOR_ID=$(shell lsb_release -is)
DISTRIBUTOR_RELEASE=$(shell lsb_release -rs)
DISTRIBUTOR=$(DISTRIBUTOR_ID)_$(DISTRIBUTOR_RELEASE)
DEB_VERSION_FULL=$(shell dpkg-parsechangelog --show-field Version)

%:
dh $@
Expand Down Expand Up @@ -42,3 +47,6 @@ override_dh_installexamples:
--mode 644 \
examples/config \
${SHARED_DIR}/kanidm

override_dh_builddeb:
dh_builddeb --filename ${PACKAGE}_${DISTRIBUTOR}_${DEB_VERSION_FULL}_${DEB_HOST_GNU_CPU}.deb