diff --git a/repo/caddy-bgme/Caddyfile b/repo/caddy-bgme/Caddyfile new file mode 100644 index 0000000..e8dda50 --- /dev/null +++ b/repo/caddy-bgme/Caddyfile @@ -0,0 +1,40 @@ +# The Caddyfile is an easy way to configure your Caddy web server. +# +# https://caddyserver.com/docs/caddyfile +# +# The configuration below serves a welcome page over HTTP on port 80. +# To use your own domain name (with automatic HTTPS), first make +# sure your domain's A/AAAA DNS records are properly pointed to +# this machine's public IP, then replace the line below with your +# domain name. +# +# https://caddyserver.com/docs/caddyfile/concepts#addresses + +{ + # Restrict the admin interface to a local unix file socket whose directory + # is restricted to caddy:caddy. By default the TCP socket allows arbitrary + # modification for any process and user that has access to the local + # interface. If admin over TCP is turned on one should make sure + # implications are well understood. + admin "unix//run/caddy/admin.socket" +} + +http:// { + # Set this path to your site's directory. + root * /usr/share/caddy + + # Enable the static file server. + file_server + + # Another common task is to set up a reverse proxy: + # reverse_proxy localhost:8080 + + # Or serve a PHP site through php-fpm: + # php_fastcgi localhost:9000 + + # Refer to the directive documentation for more options. + # https://caddyserver.com/docs/caddyfile/directives +} + +# Import additional caddy config files in /etc/caddy/conf.d/ +import /etc/caddy/conf.d/* diff --git a/repo/caddy-bgme/PKGBUILD b/repo/caddy-bgme/PKGBUILD new file mode 100644 index 0000000..f936192 --- /dev/null +++ b/repo/caddy-bgme/PKGBUILD @@ -0,0 +1,105 @@ +# Base on https://github.com/archlinux/svntogit-packages/tree/packages/bash/trunk +# Contributor: Levente Polyak +# Contributor: Christian Rebischke +# Contributor: Wei Congrui < crvv.mail at gmail dot com > +# Contributor: Carl George < arch at cgtx dot us > +# Contributor: Eric Engeström +# Contributor: Andreas Linz +# Contributor: Akshay S Dinesh + +pkgname=caddy-bgme +_pkgname=caddy +pkgver=2.8.4 +_gitcommit=v2.8.4 +_distcommit=2f024e8988f98bcfc4e2d9924139ae4914a24e9a +pkgrel=5 +pkgdesc='Fast web server with automatic HTTPS' +url='https://caddyserver.com' +arch=('x86_64') +license=('Apache') +depends=('glibc' 'brotli') +makedepends=('go' 'git' 'gzip') +conflicts=('caddy' 'caddy-bgme-git') +provides=('caddy') +backup=('etc/caddy/Caddyfile') +source=( + caddy-git::"git+https://github.com/caddyserver/caddy#tag=${_gitcommit}" + caddy-dist::"git+https://github.com/caddyserver/dist#commit=${_distcommit}" + forwardproxy::"git+https://github.com/klzgrad/forwardproxy.git" + main.go + caddy.sysusers + caddy.tmpfiles + Caddyfile +) +sha512sums=('20170f3bd5ce291af6b9506f364ecb43a853e546b06b3124554829c52504a1feed250500588c13ce824db73049e8a6a6bf5feb622547c4ad6d700439c6ef1319' + '1420146603d3a104c454323c3f579cfea46bf32d0ffae94739a547a4c5032170d6e0cec02b58f70e1e9f6488bd08e959fae072ff4848e3c718359d74e6aa6d9c' + 'SKIP' + 'c3f8800257362cb8b003bff9e1575a209b36f0387ff0055ed73dd1260748c6c459d15d584201042ec92e775d373ec526e6e3cfe8d3bc1f7ece5673901b94e453' + 'c893d88fec89e37da6596030c8dce7103e7e575371e8542a24d2a0741e877358d85219f2d8ade9d6aa0f515efe1156a4badd9fef5f65f553a5b0c72330c4728f' + '55ee8d3f8b14f9adddc7a1026addcea4f85b4bae4cd512fd4da2a5e8adaae4b6fd0f486d2e3847f75518f4710a897b4fca84e48ee15700b968bad762125c4742' + '716da3f4edeb3561243aeaf5c32b01ff7a4ac810b6deba8364fb12a1f71b6a5278c34a97b289bcfdc48784679b942bf780f1f36d416a575791168c94b0d59fe0') + +pkgver() { + cd "${_pkgname}-git" + git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + mkdir ${_pkgname} + cd ${_pkgname} + cp ../main.go . + go mod init caddy + go mod edit -replace "github.com/caddyserver/forwardproxy=../forwardproxy" + go get github.com/caddyserver/caddy/v2@${_gitcommit} + go mod tidy + + # welcome page + cp ../caddy-dist/welcome/index.html . + sed 's|/var/www/html|/srv/http|g' -i index.html +} + +build() { + cd ${_pkgname} + export CGO_LDFLAGS="${LDFLAGS}" + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" + go build . + + for i in zsh bash fish; do + ./caddy completion $i >caddy.$i + done + + ./caddy manpage --directory manpages + gzip manpages/* +} + +check() { + cd "${_pkgname}" + ./caddy version + ./caddy build-info + ./caddy list-modules +} + +package() { + cd "${_pkgname}" + install -Dm 755 caddy -t "${pkgdir}/usr/bin" + + install -Dm 644 "${srcdir}/caddy-dist/init/caddy.service" "${srcdir}/caddy-dist/init/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 index.html "${pkgdir}/usr/share/caddy/index.html" + + install -Dm 644 caddy.zsh "${pkgdir}/usr/share/zsh/site-functions/_caddy" + install -Dm 644 caddy.bash "${pkgdir}/usr/share/bash-completion/completions/caddy" + install -Dm 644 caddy.fish -t "${pkgdir}/usr/share/fish/vendor_completions.d" + + install -Dm 644 manpages/* -t "${pkgdir}/usr/share/man/man8" +} + +# vim: ts=2 sw=2 et: diff --git a/repo/caddy-bgme/caddy.sysusers b/repo/caddy-bgme/caddy.sysusers new file mode 100644 index 0000000..6fb5633 --- /dev/null +++ b/repo/caddy-bgme/caddy.sysusers @@ -0,0 +1 @@ +u caddy - "caddy daemon" /var/lib/caddy diff --git a/repo/caddy-bgme/caddy.tmpfiles b/repo/caddy-bgme/caddy.tmpfiles new file mode 100644 index 0000000..25f170f --- /dev/null +++ b/repo/caddy-bgme/caddy.tmpfiles @@ -0,0 +1,3 @@ +d /var/lib/caddy 0750 caddy caddy +d /var/log/caddy 0750 caddy caddy +d /run/caddy 0750 caddy caddy diff --git a/repo/caddy-bgme/lilac.py b/repo/caddy-bgme/lilac.py new file mode 100644 index 0000000..7c08978 --- /dev/null +++ b/repo/caddy-bgme/lilac.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +from lilaclib import * + + +def get_caddy_latest_release_tag(): + resp = s.get( + 'https://api.github.com/repos/caddyserver/caddy/releases/latest' + ) + body = resp.json() + return body["tag_name"] + + +def get_caddy_dist_commit_by_tag(tag): + resp = s.get( + 'https://api.github.com/repos/caddyserver/dist/tags' + ) + body = resp.json() + + _dist_commit = list(filter(lambda x: x["name"] == tag, body)) + if len(_dist_commit) == 1: + dist_commit = _dist_commit[0] + return dist_commit["commit"]["sha"] + else: + raise OSError("Not Found {} dist commit".format(tag)) + + +def pre_build(): + caddy_tag = get_caddy_latest_release_tag() + dist_commit = get_caddy_dist_commit_by_tag(caddy_tag) + + pkgver = caddy_tag.lstrip('v') + + for line in edit_file('PKGBUILD'): + if line.startswith('_gitcommit='): + line = '_gitcommit={}'.format(caddy_tag) + if line.startswith('_distcommit='): + line = '_distcommit={}'.format(dist_commit) + print(line) + + update_pkgver_and_pkgrel(pkgver) diff --git a/repo/caddy-bgme/lilac.yaml b/repo/caddy-bgme/lilac.yaml new file mode 100644 index 0000000..b93743e --- /dev/null +++ b/repo/caddy-bgme/lilac.yaml @@ -0,0 +1,57 @@ +maintainers: + - github: yingziwu + email: i@bgme.me + +build_prefix: extra-x86_64 + +post_build: git_pkgbuild_commit + +update_on: + - source: manual + manual: 5 + - source: github + github: caddyserver/caddy + use_latest_release: true + - source: github + github: klzgrad/forwardproxy + branch: naive + - source: go + go: github.com/fvbommel/caddy-combine-ip-ranges + - source: go + go: github.com/fvbommel/caddy-dns-ip-range + - source: go + go: github.com/fvbommel/caddy-dns-ip-range + - source: go + go: github.com/fvbommel/caddy-dns-ip-range + - source: go + go: github.com/WeidiDeng/caddy-cloudflare-ip + - source: go + go: github.com/xcaddyplugins/caddy-trusted-cloudfront + - source: go + go: github.com/digilolnet/caddy-bunny-ip + - source: go + go: github.com/tuzzmaniandevil/caddy-dynamic-clientip + - source: go + go: github.com/lanrat/caddy-dynamic-remoteip + - source: go + go: github.com/corazawaf/coraza-caddy + - source: go + go: github.com/caddyserver/cache-handler + - source: go + go: github.com/sillygod/cdp-cache + - source: go + go: github.com/caddy-dns/cloudflare + - source: go + go: github.com/dunglas/caddy-cbrotli + - source: go + go: github.com/silinternational/certmagic-storage-dynamodb/v3 + - source: go + go: github.com/zhangjiayin/caddy-geoip2 + - source: go + go: github.com/mholt/caddy-ratelimit + - source: go + go: github.com/caddyserver/replace-response + - source: go + go: github.com/mholt/caddy-webdav + - source: go + go: github.com/abiosoft/caddy-json-schema diff --git a/repo/caddy-bgme/main.go b/repo/caddy-bgme/main.go new file mode 100644 index 0000000..58f9bfe --- /dev/null +++ b/repo/caddy-bgme/main.go @@ -0,0 +1,85 @@ +// Copyright 2015 Matthew Holt and The Caddy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package main is the entry point of the Caddy application. +// Most of Caddy's functionality is provided through modules, +// which can be plugged in by adding their import below. +// +// There is no need to modify the Caddy source code to customize your +// builds. You can easily build a custom Caddy with these simple steps: +// +// 1. Copy this file (main.go) into a new folder +// 2. Edit the imports below to include the modules you want plugged in +// 3. Run `go mod init caddy` +// 4. Run `go install` or `go build` - you now have a custom binary! +// +// Or you can use xcaddy which does it all for you as a command: +// https://github.com/caddyserver/xcaddy +package main + +import ( + caddycmd "github.com/caddyserver/caddy/v2/cmd" + + // plug in Caddy modules here + _ "github.com/caddyserver/caddy/v2/modules/standard" + + // naive proxy + _ "github.com/caddyserver/forwardproxy" + + // ip sources + _ "github.com/fvbommel/caddy-combine-ip-ranges" + _ "github.com/fvbommel/caddy-dns-ip-range" + _ "github.com/WeidiDeng/caddy-cloudflare-ip" + _ "github.com/xcaddyplugins/caddy-trusted-cloudfront" + _ "github.com/digilolnet/caddy-bunny-ip" + + // match + _ "github.com/tuzzmaniandevil/caddy-dynamic-clientip" + _ "github.com/lanrat/caddy-dynamic-remoteip" + + // WAF + _ "github.com/corazawaf/coraza-caddy" + + // cache + _ "github.com/caddyserver/cache-handler" + _ "github.com/sillygod/cdp-cache" + + // dns.providers + _ "github.com/caddy-dns/cloudflare" + + // encoders + _ "github.com/dunglas/caddy-cbrotli" + + // storage + _ "github.com/silinternational/certmagic-storage-dynamodb/v3" + + // geoip + _ "github.com/zhangjiayin/caddy-geoip2" + + // ratelimit + _ "github.com/mholt/caddy-ratelimit" + + // response handler + _ "github.com/caddyserver/replace-response" + + // webdav + _ "github.com/mholt/caddy-webdav" + + // cli + _ "github.com/abiosoft/caddy-json-schema" +) + +func main() { + caddycmd.Main() +} diff --git a/tools/add-aur/main.py b/tools/add-aur/main.py deleted file mode 100644 index d5ae1f3..0000000 --- a/tools/add-aur/main.py +++ /dev/null @@ -1,2 +0,0 @@ -import httpx -