summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSieve Lau2023-09-26 12:14:08 +0800
committerSieve Lau2023-09-26 12:14:08 +0800
commit9989e46661e9ecbac7b30fbea6f9b06a78c1d7fe (patch)
tree1d7a306ef99cf9e44e08181100daacd7d75fb0c2
downloadaur-9989e46661e9ecbac7b30fbea6f9b06a78c1d7fe.tar.gz
init, on commit 784
-rw-r--r--.SRCINFO19
-rw-r--r--PKGBUILD54
-rw-r--r--mosdns.service19
3 files changed, 92 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..88e8710c0c5e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = mosdns-git
+ pkgdesc = A DNS forwarder
+ pkgver = r784.b753642
+ pkgrel = 1
+ url = https://github.com/IrineSistiana/mosdns
+ arch = x86_64
+ license = GPL3
+ makedepends = git
+ makedepends = go
+ depends = glibc
+ optdepends = bash-completion: bash completions
+ optdepends = zsh-completions: zsh completitons
+ backup = etc/mosdns/config.yaml
+ source = mosdns::git+https://github.com/IrineSistiana/mosdns
+ source = mosdns.service
+ sha512sums = SKIP
+ sha512sums = 24fe05400b65259cb3c7f5a59f81ce6ee15787d9151ad23b8850aa0e44061c1a4e58882d11ccaa0e3c00ccf531a1b79fe4d28262663af67328ea4a2fba69e4de
+
+pkgname = mosdns-git
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..c2f4b6102883
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,54 @@
+# Maintainer: Sieve Lau <sievelau@gmail.com>
+
+pkgname=mosdns-git
+pkgver=r784.b753642
+pkgrel=1
+pkgdesc="A DNS forwarder"
+arch=('x86_64')
+url="https://github.com/IrineSistiana/mosdns"
+license=('GPL3')
+depends=('glibc')
+makedepends=('git' 'go')
+optdepends=('bash-completion: bash completions'
+ 'zsh-completions: zsh completitons')
+backup=('etc/mosdns/config.yaml')
+source=("${pkgname%-git}::git+https://github.com/IrineSistiana/mosdns"
+ "mosdns.service")
+sha512sums=('SKIP'
+ '24fe05400b65259cb3c7f5a59f81ce6ee15787d9151ad23b8850aa0e44061c1a4e58882d11ccaa0e3c00ccf531a1b79fe4d28262663af67328ea4a2fba69e4de')
+
+pkgver() {
+ cd $srcdir/${pkgname%-git}
+ (
+ set -o pipefail
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
+ )
+}
+
+prepare() {
+ mkdir -p "${pkgname%-git}/build"
+}
+
+build() {
+ cd "${pkgname%-git}/build"
+ export CGO_CFLAGS="${CFLAGS}"
+ export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CXXFLAGS="${CXXFLAGS}"
+ export CGO_LDFLAGS="${LDFLAGS}"
+ go build -buildmode=pie -trimpath -ldflags="-linkmode external -s -w -X main.version=$(git describe --tags --long --always)" -mod=readonly -modcacherw -o mosdns ../
+ go run ../ config gen config.yaml
+ go run ../ completion bash >bash-completion
+ go run ../ completion zsh >zsh-completion
+}
+
+package() {
+ cd "${srcdir}/${pkgname%-git}"
+ install -Dm755 "build/mosdns" "${pkgdir}/usr/bin/mosdns"
+ install -Dm644 "build/config.yaml" "${pkgdir}/etc/mosdns/config.yaml"
+ install -Dm644 "build/bash-completion" "${pkgdir}/usr/share/bash-completion/completions/mosdns"
+ install -Dm644 "build/zsh-completion" "${pkgdir}/usr/share/zsh/site-functions/_mosdns"
+ install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/mosdns/LICENSE"
+
+ cd "${srcdir}"
+ install -Dm644 "mosdns.service" "${pkgdir}/usr/lib/systemd/system/mosdns.service"
+}
diff --git a/mosdns.service b/mosdns.service
new file mode 100644
index 000000000000..9f320d0d5d5b
--- /dev/null
+++ b/mosdns.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Mosdns
+Documentation=https://irine-sistiana.gitbook.io/mosdns-wiki
+After=network.target
+
+[Service]
+Type=simple
+DynamicUser=yes
+ExecStart=/usr/bin/mosdns start -d /etc/mosdns -c config.yaml
+TimeoutStopSec=5s
+PrivateTmp=true
+ProtectSystem=strict
+AmbientCapabilities=CAP_NET_BIND_SERVICE
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+NoNewPrivileges=true
+Restart=always
+RestartSec=10s
+[Install]
+WantedBy=multi-user.target \ No newline at end of file