summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Hua2023-09-30 20:23:37 +0800
committerZhang Hua2023-09-30 20:23:37 +0800
commitbbc57e60f115f32fe97fe8f0274c410053eb0a4d (patch)
tree4a2f80d15c77dc927190bc01916c889c30248d90
downloadaur-bbc57e60f115f32fe97fe8f0274c410053eb0a4d.tar.gz
First commit
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD36
-rw-r--r--hath-rust.service34
-rw-r--r--hath-rust.sysusers1
-rw-r--r--hath-rust.tmpfiles3
5 files changed, 79 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..f1fd06e45639
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+pkg
+src
+*.pkg.tar.*
+*.log
+hath-rust
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..768cde14e879
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,36 @@
+pkgname=hath-rust
+pkgdesc="Hentai@Home but rusty"
+pkgver=1.0.2
+pkgrel=1
+arch=("x86_64")
+url="https://github.com/james58899/hath-rust"
+license=("GPL3")
+options=("!lto") # https://github.com/briansmith/ring/issues/1444
+depends=("openssl")
+makedepends=("rust" "git")
+source=(
+ "git+$url.git#tag=v$pkgver"
+ "hath-rust.service"
+ "hath-rust.tmpfiles"
+ "hath-rust.sysusers"
+)
+sha256sums=('SKIP'
+ '5d2234eb0d842260a63bcb3e6d75270cbda06b2d5b26046d279063f74c059f54'
+ 'c8723c66c17d9fe289bb6bbbf6cfb662a8e67c3d7ca6f4d3dd27bd675eff6df5'
+ '28b78e349e96777177e6f95f078c3d09fec0dcd174b1a70d5dc9b18e309b0a81')
+
+build() {
+ cd "$srcdir/hath-rust"
+ cargo build --release
+}
+package() {
+ cd "$srcdir/hath-rust"
+ install -Dm755 "target/release/hath-rust" \
+ "$pkgdir/usr/bin/hath-rust"
+ install -Dm644 "$srcdir/hath-rust.service" \
+ "$pkgdir/usr/lib/systemd/system/hath-rust.service"
+ install -Dm644 "$srcdir/hath-rust.tmpfiles" \
+ "$pkgdir/usr/lib/tmpfiles.d/hath-rust.conf"
+ install -Dm644 "$srcdir/hath-rust.sysusers" \
+ "$pkgdir/usr/lib/sysusers.d/hath-rust.conf"
+}
diff --git a/hath-rust.service b/hath-rust.service
new file mode 100644
index 000000000000..efd9fec0a031
--- /dev/null
+++ b/hath-rust.service
@@ -0,0 +1,34 @@
+[Unit]
+Description=Hentai@Home but Rusty
+Documentation=https://github.com/james58899/hath-rust/wiki
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+Type=simple
+EnvironmentFile=/etc/hath-rust.conf
+ExecStart=hath-rust --port=$PORT --max-connection=$MAX_CONNECTION \
+ --cache-dir=/var/lib/hath-rust/cache \
+ --data-dir=/var/lib/hath-rust/data \
+ --download-dir=/var/lib/hath-rust/download \
+ --log-dir=/var/log/hath-rust \
+ --temp-dir=/tmp/hath-rust
+# Isolation
+WorkingDirectory=/var/lib/hath
+User=hath-rust
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+NoNewPrivileges=yes
+# Sandboxing
+ProtectSystem=strict
+ProtectHome=yes
+ReadWritePaths=/var/log/hath-rust
+ReadWritePaths=/var/lib/hath-rust
+ReadWritePaths=/tmp/hath-rust
+PrivateTmp=yes
+PrivateUsers=yes
+ProtectKernelModules=yes
+ProtectControlGroups=yes
+
+[Install]
+WantedBy=multi-user.target
+Alias=hath.service \ No newline at end of file
diff --git a/hath-rust.sysusers b/hath-rust.sysusers
new file mode 100644
index 000000000000..e6e1f147aa13
--- /dev/null
+++ b/hath-rust.sysusers
@@ -0,0 +1 @@
+u hath-rust - "Hentai@Home User" /var/lib/hath-rust -
diff --git a/hath-rust.tmpfiles b/hath-rust.tmpfiles
new file mode 100644
index 000000000000..8f534b833c99
--- /dev/null
+++ b/hath-rust.tmpfiles
@@ -0,0 +1,3 @@
+d /var/log/hath-rust - hath-rust hath-rust 30d -
+v /var/lib/hath-rust 0700 hath-rust hath-rust - -
+f /etc/hath-rust.conf - - - - PORT=443\nMAX_CONNECTION=65535