From 35c8330fb72f0fc3977c7ec491c1c17a0606bc02 Mon Sep 17 00:00:00 2001 From: Cassiano Aquino Date: Sat, 20 Feb 2021 15:51:08 +0000 Subject: [PATCH] add custom binary support files docs rephrase --- src/docs/markdown/build.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/docs/markdown/build.md b/src/docs/markdown/build.md index 6b5064e..4488b4c 100644 --- a/src/docs/markdown/build.md +++ b/src/docs/markdown/build.md @@ -64,3 +64,30 @@ Or similarly for Linux ARMv6 when you're not on Linux or on ARMv6: The same works for `xcaddy`. To cross-compile for macOS:
GOOS=darwin xcaddy build
+ +## Package support files for custom builds for Debian/Ubuntu/Raspbian + +This procedure aims to simplify running custom `caddy` binaries while keeping support files from the `caddy` package. + +This procedure allows users to take advantage of the default configuration, systemd service files and bash-completion from the official package. + +Requirements: +- Install `caddy` package according to these [instructions](https://caddyserver.com/docs/install#debian-ubuntu-raspbian) +- Build your custom `caddy` binary according to the procedure listed in this document. (see above) +- Your custom `caddy` binary should be located in the current directory. + +Procedure: +
dpkg-divert --divert /usr/bin/caddy.default --rename /usr/bin/caddy
+mv ./caddy /usr/bin/caddy.custom
+update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.default 10
+update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.custom 50
+
+ + +`dpkg-divert` will move `/usr/bin/caddy` binary to `/usr/bin/caddy.default` and put a divertion in place in case any package want to install a file to this location. + +`update-alternatives` will create a symlink from the desired caddy binary to `/usr/bin/caddy` + +You can change between the custom and default `caddy` binaries by executing +
update-alternatives --config caddy
+and following the on screen information. \ No newline at end of file