diff --git a/next/PKGBUILD b/next/PKGBUILD index 257411f..bf38f0d 100644 --- a/next/PKGBUILD +++ b/next/PKGBUILD @@ -9,6 +9,7 @@ pkgname=caddy pkgver=2.3.0 _gitcommit=b4989773ebb2dff21283ee50ec667f9138bdd292 +_distcommit=e784a6dd41d1cd4f72de2a427961bfb097b72cf9 pkgrel=1 pkgdesc='Fast web server with automatic HTTPS' url='https://caddyserver.com' @@ -18,21 +19,23 @@ depends=('glibc') makedepends=('go' 'git') backup=('etc/caddy/Caddyfile') source=("git+https://github.com/caddyserver/caddy#tag=${_gitcommit}?signed" - index.html + caddy-dist::"git+https://github.com/caddyserver/dist#commit=${_distcommit}" caddy.service caddy-api.service caddy.tmpfiles caddy.sysusers Caddyfile - use-data-dir-for-autosave.patch) + use-data-dir-for-autosave.patch + override-main-module-version.patch) sha512sums=('SKIP' - '2abccd41f770daebf61285dc017249f20c707877ea3c870f4a2375bbbd2bf481a8652d1fd3c7afd7d6b5c54838e9d8474a33e2c9790ef67dcf9d79c4e52953b4' + 'SKIP' 'd162f16e16be1673f11c384b79505b82fedbecacea77c2e64303b573aa982ace5706fb74eb7d0b219c5935427459537b685832357aed5ee48345648f439bf274' 'a4d9bbcccf3c6fe9be2b7ba98214d579ecd40991c5cc520ca1d105f307b31622f1c6b5a6cd7a4e8b32ccd2a229ed70115cba9c507baa413803897b7183f9abe0' '55ee8d3f8b14f9adddc7a1026addcea4f85b4bae4cd512fd4da2a5e8adaae4b6fd0f486d2e3847f75518f4710a897b4fca84e48ee15700b968bad762125c4742' 'c893d88fec89e37da6596030c8dce7103e7e575371e8542a24d2a0741e877358d85219f2d8ade9d6aa0f515efe1156a4badd9fef5f65f553a5b0c72330c4728f' '716da3f4edeb3561243aeaf5c32b01ff7a4ac810b6deba8364fb12a1f71b6a5278c34a97b289bcfdc48784679b942bf780f1f36d416a575791168c94b0d59fe0' - '563d6b45e91fc584fb5a27caaa382f59c140cb0a1b28b8d8faced4f7c7cad86d8671eb6ac10056f41518a842c8f606130d7e0c71df2b731d5eb0b4c868ea5d41') + '563d6b45e91fc584fb5a27caaa382f59c140cb0a1b28b8d8faced4f7c7cad86d8671eb6ac10056f41518a842c8f606130d7e0c71df2b731d5eb0b4c868ea5d41' + 'b06369dd976cfcc9b519782c088efa5fba25db61663112fcc4e20b108d5165cbebcf63b6fe6d1e36119a55271374bac0037a4d07af412241d6a4d2b4f4efda0b') validpgpkeys=( 29D0817A67156E4F25DC24782A349DD577D586A5 # Matthew Holt ) @@ -44,8 +47,14 @@ pkgver() { prepare() { cd "${pkgname}" - sed 's|/var/www/html|/srv/http|g' -i "${srcdir}/index.html" + # welcome page + cp ../caddy-dist/welcome/index.html . + sed 's|/var/www/html|/srv/http|g' -i index.html + # do not write in /etc patch -Np1 < "${srcdir}/use-data-dir-for-autosave.patch" + # fix version identifier if not built from a module + patch -Np1 < "${srcdir}/override-main-module-version.patch" + sed 's|"unknown"|"v'"${pkgver}"'"|g' -i caddy.go } build() { @@ -61,18 +70,28 @@ build() { check() { cd "${pkgname}" go test ./... + version=$(./cmd/caddy/caddy version) + echo "Caddy version: ${version}" + if [[ $version != v$pkgver ]]; then + exit 1 + fi } package() { cd "${pkgname}" install -Dm 755 cmd/caddy/caddy -t "${pkgdir}/usr/bin" - install -Dm 644 "${srcdir}/caddy.service" -t "${pkgdir}/usr/lib/systemd/system" - install -Dm 644 "${srcdir}/caddy-api.service" -t "${pkgdir}/usr/lib/systemd/system" + + install -Dm 644 "${srcdir}/caddy.service" "${srcdir}/caddy-api.service" -t "${pkgdir}/usr/lib/systemd/system" install -Dm 644 "${srcdir}/caddy.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/caddy.conf" install -Dm 644 "${srcdir}/caddy.sysusers" "${pkgdir}/usr/lib/sysusers.d/caddy.conf" + install -Dm 644 "${srcdir}/Caddyfile" -t "${pkgdir}/etc/caddy" install -d "${pkgdir}/etc/caddy/conf.d" - install -Dm 644 "${srcdir}/index.html" "${pkgdir}/usr/share/caddy/index.html" + + install -Dm 644 index.html "${pkgdir}/usr/share/caddy/index.html" + + install -Dm 644 "${srcdir}/caddy-dist/scripts/completions/_caddy" -t "${pkgdir}/usr/share/zsh/site-functions" + install -Dm 644 "${srcdir}/caddy-dist/scripts/completions/bash-completion" "${pkgdir}/usr/share/bash-completion/completions/caddy" } # vim: ts=2 sw=2 et: diff --git a/next/index.html b/next/index.html deleted file mode 100644 index 7c0206e..0000000 --- a/next/index.html +++ /dev/null @@ -1,269 +0,0 @@ - - - - Caddy works! - - - - - - -
-
-
-
- - -

- Congratulations! - おめでとう! - Felicidades! - 恭喜! - बधाई हो! - Поздравляю!
 - 🎊 -

- -

- Your web server is working. Now make it work for you. 💪 -

-

- Caddy is ready to serve your site over HTTPS: -

-
    -
  1. Point your domain's A/AAAA DNS records at this machine.
  2. -
  3. Upload your site's files to /var/www/html. -
  4. - Edit your Caddyfile at /etc/caddy/Caddyfile: -
      -
    1. Replace :80 with your domain name
    2. -
    3. Change the site root to /var/www/html
    4. -
    -
  5. -
  6. Reload the configuration: systemctl reload caddy
  7. -
  8. Visit your site!
  9. -
-

If that worked 🥳

-

- Awesome! You won't have to look at this slanted page anymore. -

-

- Remember, Caddy can do a lot more than serve static files. It's also a powerful reverse proxy and application platform. You can use the Caddyfile to enable any other features you need. Or you could use Caddy's API to configure it programmatically. -

-

- Everything you need to know is either in the 📖 Caddy documentation or the manual for your OS/platform. Have fun! -

- -

If that didn't work 😶

-

- It's okay, you can fix it! First check the following things: -

-
    -
  • Service status: systemctl status caddy
  • -
  • Logs: journalctl --no-pager -u caddy
  • -
  • Are your site's files readable by the caddy user and group? ls -la /var/www/html
  • -
  • Is the caddy home directory writeable? ls -la /var/lib/caddy
  • -
  • Ensure your domain's A and/or AAAA records point to your machine's public IP address: dig example.com
  • -
  • Are your ports 80 and 443 externally reachable, and is Caddy able to bind to them? Check your firewalls, port forwarding, and other network configuration.
  • -
-

- WAIT! Before trying again, switch to Let's Encrypt's staging environment to avoid being accidentally rate limited. Once you get everything else working, it's safe to switch back. -

-

- Depending on your DNS provider, it may take a while for the DNS records to propagate. Even when everything is configured properly, automated challenges to obtain TLS certificates usually take several seconds, but may take up to several minutes or hours. -

- If you still need help, we have a great community! First try a search, and if your question is original, go ahead and ask it! Remember to pay it forward and help others too. 😁 -

-

- Visit Caddy on: - GitHub - or - Twitter - or - Our Forum -

-
-
- - - - - diff --git a/next/override-main-module-version.patch b/next/override-main-module-version.patch new file mode 100644 index 0000000..d64eea2 --- /dev/null +++ b/next/override-main-module-version.patch @@ -0,0 +1,28 @@ +From 56eacff9fa3a84b19ac9b8bb7072d9b7d96755e7 Mon Sep 17 00:00:00 2001 +From: anthraxx +Date: Sat, 13 Feb 2021 04:56:30 +0100 +Subject: [PATCH] override main module version which we can be filled with the + correct version + +Go BuildInfo only works if we build from a module, however we simply +want to build in tree. Therefor override the main module version with +something that we can dynamically replace. +--- + caddy.go | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/caddy.go b/caddy.go +index 70135ffb..04d95716 100644 +--- a/caddy.go ++++ b/caddy.go +@@ -679,6 +679,7 @@ func goModule(mod *debug.Module) *debug.Module { + mod.Version = "unknown" + bi, ok := debug.ReadBuildInfo() + if ok { ++ bi.Main.Version = "unknown" + mod.Path = bi.Main.Path + // The recommended way to build Caddy involves + // creating a separate main module, which +-- +2.30.0 +