summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaruue Icymoon2023-09-01 22:39:09 +0800
committerHaruue Icymoon2023-09-01 22:39:09 +0800
commit98ccf0c735d293d26f0a4857589dc12aa8b4dfe8 (patch)
tree23424fe2dd677444b3ea6c46deeb63cedd8d621a
downloadaur-98ccf0c735d293d26f0a4857589dc12aa8b4dfe8.tar.gz
init: hysteria1-bin
-rw-r--r--.SRCINFO22
-rw-r--r--.gitignore2
-rw-r--r--PKGBUILD33
-rw-r--r--hysteria1-server@.service18
-rw-r--r--hysteria1.install64
-rw-r--r--hysteria1@.service18
-rw-r--r--sysusers.conf1
-rw-r--r--tmpfiles.conf1
8 files changed, 159 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..d9d8b86a6c1e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = hysteria1-bin
+ pkgdesc = A feature-packed network utility optimized for networks of poor quality (Binary Release) (Legacy Version)
+ pkgver = 1.3.5
+ pkgrel = 1
+ url = https://v1.hysteria.network/
+ install = hysteria1.install
+ arch = x86_64
+ license = GPL3
+ provides = hysteria1
+ conflicts = hysteria1
+ source = hysteria1-1.3.5-1-linux-amd64::https://github.com/apernet/hysteria/releases/download/v1.3.5/hysteria-linux-amd64
+ source = hysteria1@.service
+ source = hysteria1-server@.service
+ source = sysusers.conf
+ source = tmpfiles.conf
+ sha256sums = 41dc8bc3fff6fc1f031666eb294f10b481b80b66229d7c6aca88398d0fba839d
+ sha256sums = 91c77e6888daae39c3bdfa27ec70a6c0adc1f0ab087f2f3865dd2aadd48811d5
+ sha256sums = a4cd153ca00a14ce0e66f5384ebdc509c4dcd60e464ea3a7eb1c4c6516180596
+ sha256sums = 44f1cb2fedfc94dc396ceb215e62237dbc8c74c035c45a3430c1f3748d266dd9
+ sha256sums = 1e93d9f2b312eaf02ac00229106cd796e0cd54a9a468a0a8d3ae843399c1c310
+
+pkgname = hysteria1-bin
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..18cd11e71f95
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/src
+/pkg
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..8bdf8855b55f
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Haruue Icymoon <i@haruue.moe>
+# Contributor: 4679 <4679 at pm dot me>
+
+_pkgbase=hysteria1
+pkgname=$_pkgbase-bin
+pkgver=1.3.5
+pkgrel=1
+pkgdesc='A feature-packed network utility optimized for networks of poor quality (Binary Release) (Legacy Version)'
+arch=('x86_64')
+url='https://v1.hysteria.network/'
+license=('GPL3')
+provides=('hysteria1')
+conflicts=('hysteria1')
+install=$_pkgbase.install
+source=("$_pkgbase-$pkgver-$pkgrel-linux-amd64::https://github.com/apernet/hysteria/releases/download/v$pkgver/hysteria-linux-amd64"
+ 'hysteria1@.service'
+ 'hysteria1-server@.service'
+ 'sysusers.conf'
+ 'tmpfiles.conf')
+sha256sums=('41dc8bc3fff6fc1f031666eb294f10b481b80b66229d7c6aca88398d0fba839d'
+ '91c77e6888daae39c3bdfa27ec70a6c0adc1f0ab087f2f3865dd2aadd48811d5'
+ 'a4cd153ca00a14ce0e66f5384ebdc509c4dcd60e464ea3a7eb1c4c6516180596'
+ '44f1cb2fedfc94dc396ceb215e62237dbc8c74c035c45a3430c1f3748d266dd9'
+ '1e93d9f2b312eaf02ac00229106cd796e0cd54a9a468a0a8d3ae843399c1c310')
+
+package() {
+ install -Dm755 "$srcdir/$_pkgbase-$pkgver-$pkgrel-linux-amd64" "${pkgdir}/usr/bin/${_pkgbase}"
+ install -Dm644 "$srcdir/sysusers.conf" "$pkgdir/usr/lib/sysusers.d/${_pkgbase}.conf"
+ install -Dm644 "$srcdir/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/${_pkgbase}.conf"
+ install -Dm644 "$srcdir/hysteria1@.service" "$pkgdir/usr/lib/systemd/system/hysteria1@.service"
+ install -Dm644 "$srcdir/hysteria1-server@.service" "$pkgdir/usr/lib/systemd/system/hysteria1-server@.service"
+ install -dm755 "$pkgdir/etc/hysteria"
+}
diff --git a/hysteria1-server@.service b/hysteria1-server@.service
new file mode 100644
index 000000000000..727d952b04b7
--- /dev/null
+++ b/hysteria1-server@.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Hysteria (Legacy) Server Service
+Documentation=https://v1.hysteria.network/
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/hysteria1 server --config %i.json --no-check
+WorkingDirectory=/etc/hysteria
+User=hysteria
+Group=hysteria
+Environment=HYSTERIA_LOG_LEVEL=info
+CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
+AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
+NoNewPrivileges=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/hysteria1.install b/hysteria1.install
new file mode 100644
index 000000000000..649f100f439c
--- /dev/null
+++ b/hysteria1.install
@@ -0,0 +1,64 @@
+_hysteria_user="hysteria"
+_hysteria_homedir="/var/lib/hysteria"
+
+has_command() {
+ local _command=$1
+ type -P "$_command" > /dev/null 2>&1
+}
+tput() {
+ if has_command tput; then
+ command tput "$@"
+ fi
+}
+all_off="$(tput sgr0)"
+bold="${all_off}$(tput bold)"
+red="${bold}$(tput setaf 1)"
+blue="${bold}$(tput setaf 4)"
+yellow="${bold}$(tput setaf 3)"
+note() {
+ printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
+}
+
+_hysteria_ensure_usermod() {
+ local _origin_homedir=$(eval echo ~"$_hysteria_user")
+ # in the old version, homedir is not specified in the sysusers.conf
+ # and therefore set to / by default.
+ if [[ "$_origin_homedir" == "/" ]]; then
+ usermod -d "$_hysteria_homedir" "$_hysteria_user"
+ note "The homedir of user $_hysteria_user has been changed from $_origin_homedir to $_hysteria_homedir"
+ fi
+}
+
+_hysteria_v1_systemd_unit_migrate_hint() {
+ note "If you are migrating from the \"hysteria{,-bin}\" package, please note that the \"hysteria1{,-bin}\" package uses different names for systemd units."
+ echo
+ echo -e "\t" "hysteria@.service => hysteria${red}1${all_off}@.service"
+ echo -e "\t" "hysteria-server@.service => hysteria${red}1${all_off}-server@.service"
+ echo
+ local _enabled_units=(
+ $(ls /etc/systemd/system/multi-user.target.wants/ | grep -P 'hysteria(-server)?@')
+ )
+ if [ ${#_enabled_units[@]} -ne 0 ]; then
+ note "The following commands can be used to convert all enabled hysteria systemd services to the hysteria1 services. Be sure to check carefully before running any of them, especially if you also have hysteria v2 running on this machine."
+ echo
+ for unit in "${_enabled_units[@]}"; do
+ echo -e "\t" "systemctl disable $unit"
+ echo -e "\t" "systemctl enable ${unit/hysteria/hysteria1}"
+ done
+ echo
+ fi
+}
+
+_hysteria_v1_deprected_warning() {
+ note "Hysteria v1 is deprecated and no longer supported, use at your own risk."
+}
+
+post_install() {
+ post_upgrade
+ _hysteria_v1_systemd_unit_migrate_hint
+}
+
+post_upgrade() {
+ _hysteria_ensure_usermod
+ _hysteria_v1_deprected_warning
+}
diff --git a/hysteria1@.service b/hysteria1@.service
new file mode 100644
index 000000000000..915cf5bda898
--- /dev/null
+++ b/hysteria1@.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Hysteria (Legacy) Client Service
+Documentation=https://v1.hysteria.network/
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/hysteria1 client --config %i.json --no-check
+WorkingDirectory=/etc/hysteria
+User=hysteria
+Group=hysteria
+Environment=HYSTERIA_LOG_LEVEL=info
+CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
+AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
+NoNewPrivileges=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sysusers.conf b/sysusers.conf
new file mode 100644
index 000000000000..26de80fc5ac0
--- /dev/null
+++ b/sysusers.conf
@@ -0,0 +1 @@
+u hysteria - "Hysteria" /var/lib/hysteria
diff --git a/tmpfiles.conf b/tmpfiles.conf
new file mode 100644
index 000000000000..5813c3bad5c2
--- /dev/null
+++ b/tmpfiles.conf
@@ -0,0 +1 @@
+d /var/lib/hysteria 0750 hysteria hysteria