summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO35
-rw-r--r--PKGBUILD56
-rw-r--r--vxray-rules-dat-git.install4
-rwxr-xr-xvxray-rules-dat-updater27
-rw-r--r--vxray-rules-dat-updater.service11
-rw-r--r--vxray-rules-dat-updater.sysusers1
-rw-r--r--vxray-rules-dat-updater.timer6
-rw-r--r--vxray-rules-dat-updater.tmpfiles2
8 files changed, 142 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..ad3f1f16ef8
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,35 @@
+pkgbase = vxray-rules-dat-git
+ pkgdesc = Enhanced edition of V2Ray and Xray rules dat files, compatible with Trojan-Go. Automaitcally update. DO NOT flag out-dated.
+ pkgver = 1
+ pkgrel = 1
+ url = https://github.com/Loyalsoldier/v2ray-rules-dat
+ install = vxray-rules-dat-git.install
+ arch = any
+ license = GPL
+ makedepends = git
+ depends = curl
+ provides = xray-domain-list-community
+ provides = xray-geoip
+ provides = v2ray-domain-list-community
+ provides = v2ray-geoip
+ provides = v2ray-rules-dat-git
+ provides = v2ray-rules-dat-git-for-xray
+ conflicts = xray-domain-list-community
+ conflicts = xray-geoip
+ conflicts = v2ray-domain-list-community
+ conflicts = v2ray-geoip
+ conflicts = v2ray-rules-dat-gitv2ray-rules-dat-git-for-xray
+ source = vxray-rules-dat-git::git+https://github.com/Loyalsoldier/v2ray-rules-dat.git
+ source = vxray-rules-dat-updater
+ source = vxray-rules-dat-updater.sysusers
+ source = vxray-rules-dat-updater.tmpfiles
+ source = vxray-rules-dat-updater.service
+ source = vxray-rules-dat-updater.timer
+ sha256sums = eb1d2175b8be7f9779639b2b24d8260f83116c9a743f1fb0052f056518ccfd11
+ sha256sums = a9de745de1166a4011dabe23dc726658c28fab774fac90f9e4e2ef178171e0cc
+ sha256sums = c855bae9e8a9e3fb7b5be4271bf6e05ad441eacd8272d505ee55a407b6bd263e
+ sha256sums = 1c3c0b854bbfd96b0d84383bfff84eb70e69ac5193b7a535f75183ca28634fc2
+ sha256sums = e282e023e2f4fbffabedc19a01c33e03cc5049c7cb2cd6e36398233a16bd2b84
+ sha256sums = 5bd55042d53d3794f27483277056f06f5e55d0e7702b0093ec6f17d7da6d548c
+
+pkgname = vxray-rules-dat-git
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..11302185556
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,56 @@
+# Maintainer: llxray <c60@outlook.de>
+pkgname=vxray-rules-dat-git
+_pkgname=vxray-rules-dat
+pkgdesc="Enhanced edition of V2Ray and Xray rules dat files, compatible with Trojan-Go. Automaitcally update. DO NOT flag out-dated."
+pkgver=1
+pkgrel=1
+arch=('any')
+url="https://github.com/Loyalsoldier/v2ray-rules-dat"
+license=('GPL')
+
+provides=('xray-domain-list-community' 'xray-geoip' 'v2ray-domain-list-community' 'v2ray-geoip' 'v2ray-rules-dat-git' 'v2ray-rules-dat-git-for-xray')
+conflicts=('xray-domain-list-community' 'xray-geoip' 'v2ray-domain-list-community' 'v2ray-geoip' 'v2ray-rules-dat-git''v2ray-rules-dat-git-for-xray')
+
+makedepends=('git')
+depends=('curl')
+
+install="vxray-rules-dat-git.install"
+
+source=(
+ "$pkgname::git+$url.git"
+ vxray-rules-dat-updater
+ vxray-rules-dat-updater.sysusers
+ vxray-rules-dat-updater.tmpfiles
+ vxray-rules-dat-updater.service
+ vxray-rules-dat-updater.timer
+)
+sha256sums=(
+ 'eb1d2175b8be7f9779639b2b24d8260f83116c9a743f1fb0052f056518ccfd11'
+ 'a9de745de1166a4011dabe23dc726658c28fab774fac90f9e4e2ef178171e0cc'
+ 'c855bae9e8a9e3fb7b5be4271bf6e05ad441eacd8272d505ee55a407b6bd263e'
+ '1c3c0b854bbfd96b0d84383bfff84eb70e69ac5193b7a535f75183ca28634fc2'
+ 'e282e023e2f4fbffabedc19a01c33e03cc5049c7cb2cd6e36398233a16bd2b84'
+ '5bd55042d53d3794f27483277056f06f5e55d0e7702b0093ec6f17d7da6d548c'
+)
+
+pkgver() {
+ cd "${srcdir}/${pkgname}"
+ git switch release >/dev/null 2>&1
+ printf "r%s" "$(git log --pretty=\"format:%B\" HEAD | tr -dc '[:digit:]')"
+}
+
+package() {
+ pushd "${srcdir}/${pkgname}"
+ git switch release >/dev/null 2>&1
+ install -Dm644 "./geoip.dat" "${pkgdir}/usr/share/xray/geoip.dat"
+ install -Dm644 "./geoip.dat" "${pkgdir}/usr/share/v2ray/geoip.dat"
+ install -Dm644 "./geosite.dat" "${pkgdir}/usr/share/xray/geosite.dat"
+ install -Dm644 "./geosite.dat" "${pkgdir}/usr/share/v2ray/geosite.dat"
+
+ popd
+ install -Dm755 "./${_pkgname}-updater" "${pkgdir}/usr/bin/${_pkgname}-updater"
+ install -Dm644 "./${_pkgname}-updater.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_pkgname}-updater.conf"
+ install -Dm644 "./${_pkgname}-updater.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_pkgname}-updater.conf"
+ install -Dm644 "./${_pkgname}-updater.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}-updater.service"
+ install -Dm644 "./${_pkgname}-updater.timer" "${pkgdir}/usr/lib/systemd/system/${_pkgname}-updater.timer"
+}
diff --git a/vxray-rules-dat-git.install b/vxray-rules-dat-git.install
new file mode 100644
index 00000000000..569c41593e4
--- /dev/null
+++ b/vxray-rules-dat-git.install
@@ -0,0 +1,4 @@
+post_install() {
+ printf $(tput bold)'Enable vxray-rules-dat-updater.timer to update rules automatically everyday.\n'
+ printf 'The most up-to-date geoip.dat and geosite.dat can be found under /var/lib/vxray-rules-dat'$(tput sgr0)'\n'
+}
diff --git a/vxray-rules-dat-updater b/vxray-rules-dat-updater
new file mode 100755
index 00000000000..6a245de27f9
--- /dev/null
+++ b/vxray-rules-dat-updater
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -e
+
+FastGit="https://hub.fastgit.org/Loyalsoldier/v2ray-rules-dat/releases/latest/"
+GitHub="https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/"
+JsDelivr="https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/"
+
+download_files() {
+ echo "Fetching geoip.dat"
+ curl -LO "${1}/geoip.dat"
+
+ echo "Fetching geosite.dat"
+ curl -LO "${1}/geosite.dat"
+}
+
+case "${1}" in
+"fastgit" | "fg")
+ download_files $FastGit
+ ;;
+"jsdelivr" | "js")
+ download_files $JsDelivr
+ ;;
+*)
+ download_files $GitHub
+ ;;
+esac
diff --git a/vxray-rules-dat-updater.service b/vxray-rules-dat-updater.service
new file mode 100644
index 00000000000..0332b3eb84b
--- /dev/null
+++ b/vxray-rules-dat-updater.service
@@ -0,0 +1,11 @@
+[Unit]
+Description = Service for update vxray-dat-rules files
+After = network.target
+
+[Service]
+Type = oneshot
+User = vxray-rules-dat
+Group = vxray-rules-dat
+
+WorkingDirectory = /var/lib/vxray-rules-dat
+ExecStart = /usr/bin/vxray-rules-dat-updater github
diff --git a/vxray-rules-dat-updater.sysusers b/vxray-rules-dat-updater.sysusers
new file mode 100644
index 00000000000..17e2ad07fe5
--- /dev/null
+++ b/vxray-rules-dat-updater.sysusers
@@ -0,0 +1 @@
+u vxray-rules-dat - "account for vxray-rules-dat updater" /var/lib/vxray-rules-dat
diff --git a/vxray-rules-dat-updater.timer b/vxray-rules-dat-updater.timer
new file mode 100644
index 00000000000..3cc2d16e4e0
--- /dev/null
+++ b/vxray-rules-dat-updater.timer
@@ -0,0 +1,6 @@
+[Timer]
+OnCalendar = daily
+Persistent = true
+
+[Install]
+WantedBy = timers.target
diff --git a/vxray-rules-dat-updater.tmpfiles b/vxray-rules-dat-updater.tmpfiles
new file mode 100644
index 00000000000..94f5df583e2
--- /dev/null
+++ b/vxray-rules-dat-updater.tmpfiles
@@ -0,0 +1,2 @@
+d /var/lib/vxray-rules-dat 0755 vxray-rules-dat vxray-rules-dat
+Z /var/lib/vxray-rules-dat - vxray-rules-dat vxray-rules-dat