summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorjzefklly2022-10-16 17:01:21 +0800
committerjzefklly2022-10-16 17:01:21 +0800
commitcecb132b5bcdd388482b622d3c1d94fb87554782 (patch)
tree7f30a1b47163a9b75443b2756085ef439e6392b6
downloadaur-cecb132b5bcdd388482b622d3c1d94fb87554782.tar.gz
initial commit
-rw-r--r--.SRCINFO26
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD63
-rw-r--r--ktra.service21
-rw-r--r--ktra.sysusers1
-rw-r--r--ktra.tmpfiles1
-rw-r--r--ktra.toml24
7 files changed, 141 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..fe7ee6096a91
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,26 @@
+pkgbase = ktra-git
+ pkgdesc = Your Little Cargo Registry
+ pkgver = 0.7.0.r0.g07ffd10
+ pkgrel = 1
+ url = https://github.com/moriturus/ktra
+ arch = x86_64
+ license = Apache
+ license = MIT
+ makedepends = cargo
+ makedepends = git
+ depends = gcc-libs
+ provides = ktra
+ conflicts = ktra
+ backup = etc/ktra.toml
+ source = ktra::git+https://github.com/moriturus/ktra.git
+ source = ktra.service
+ source = ktra.sysusers
+ source = ktra.tmpfiles
+ source = ktra.toml
+ sha256sums = SKIP
+ sha256sums = 8415def2810b845b3b960448f40bac214bb1bd21e481b624f0a3e2aab7b093dd
+ sha256sums = 838072db74b691e28cc28c46982dd9af9806b4283179ab4a96df8d7624685f96
+ sha256sums = 466c7ce99bace309a30ea753d9b8b46ebfd8868ef7bb5016abdfb0a00543bddd
+ sha256sums = 97f4f75a722dd239097d552b56a62f967f791ab6aac8859a3324893deb909e55
+
+pkgname = ktra-git
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..c35253292e55
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.pkg.tar*
+/.vscode
+/ktra
+/pkg
+/src
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..c17f897a9e08
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,63 @@
+# Maintainer: jzefklly <jzefklly@163.com>
+
+_pkgname=ktra
+pkgname=$_pkgname-git
+pkgver=0.7.0.r0.g07ffd10
+pkgrel=1
+pkgdesc="Your Little Cargo Registry"
+arch=("x86_64")
+url="https://github.com/moriturus/ktra"
+license=("Apache" "MIT")
+depends=("gcc-libs")
+makedepends=("cargo" "git")
+provides=("$_pkgname")
+conflicts=("$_pkgname")
+backup=("etc/ktra.toml")
+source=(
+ "$_pkgname::git+https://github.com/moriturus/ktra.git"
+ "ktra.service"
+ "ktra.sysusers"
+ "ktra.tmpfiles"
+ "ktra.toml"
+)
+sha256sums=(
+ "SKIP"
+ "8415def2810b845b3b960448f40bac214bb1bd21e481b624f0a3e2aab7b093dd"
+ "838072db74b691e28cc28c46982dd9af9806b4283179ab4a96df8d7624685f96"
+ "466c7ce99bace309a30ea753d9b8b46ebfd8868ef7bb5016abdfb0a00543bddd"
+ "97f4f75a722dd239097d552b56a62f967f791ab6aac8859a3324893deb909e55"
+)
+
+export RUSTUP_TOOLCHAIN=stable
+export CARGO_TARGET_DIR=target
+
+pkgver() {
+ cd "$_pkgname"
+ git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd "$_pkgname"
+ cargo update
+ cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
+}
+
+build() {
+ cd "$_pkgname"
+ cargo build --frozen --release
+}
+
+# check() {
+# cd "$_pkgname"
+# cargo test --frozen
+# }
+
+package() {
+ install -Dm0644 "$_pkgname.service" "${pkgdir}/usr/lib/systemd/system/$_pkgname.service"
+ install -Dm0644 "$_pkgname.sysusers" "${pkgdir}/usr/lib/sysusers.d/$_pkgname.conf"
+ install -Dm0644 "$_pkgname.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/$_pkgname.conf"
+ install -Dm0644 "$_pkgname.toml" "${pkgdir}/etc/$_pkgname.toml"
+
+ cd "$_pkgname"
+ install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$_pkgname"
+}
diff --git a/ktra.service b/ktra.service
new file mode 100644
index 000000000000..f5d2af957093
--- /dev/null
+++ b/ktra.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=Your Little Cargo Registry
+After=network.target network-online.target nss-lookup.target
+
+StartLimitIntervalSec=30s
+StartLimitBurst=5
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/ktra -c /etc/ktra.toml
+Restart=always
+RestartSec=3s
+Environment=RUST_LOG=info
+
+User=ktra
+Group=ktra
+ReadOnlyPaths=/
+ReadWritePaths=/var/lib/ktra/
+
+[Install]
+WantedBy=multi-user.target
diff --git a/ktra.sysusers b/ktra.sysusers
new file mode 100644
index 000000000000..c3eaa5f2939f
--- /dev/null
+++ b/ktra.sysusers
@@ -0,0 +1 @@
+u ktra - "Your Little Cargo Registry" /var/lib/ktra /bin/nologin
diff --git a/ktra.tmpfiles b/ktra.tmpfiles
new file mode 100644
index 000000000000..74993aa95343
--- /dev/null
+++ b/ktra.tmpfiles
@@ -0,0 +1 @@
+d /var/lib/ktra 0750 ktra ktra
diff --git a/ktra.toml b/ktra.toml
new file mode 100644
index 000000000000..02a9502c6a38
--- /dev/null
+++ b/ktra.toml
@@ -0,0 +1,24 @@
+[index_config]
+# remote_url = ""
+local_path = "/var/lib/ktra/index/"
+# branch = "main"
+# https_username = ""
+# https_password = ""
+# ssh_privkey_path = "/var/lib/ktra/id_ed25519"
+# ssh_key_passphrase = ""
+# ssh_pubkey_path = "/var/lib/ktra/id_ed25519.pub"
+# ssh_username = ""
+# git_email = "undefined@example.com"
+# git_name = "ktra-driver"
+
+[crate_files_config]
+dl_dir_path = "/var/lib/ktra/dl/"
+cache_dir_path = "/var/lib/ktra/crates_io_caches/"
+# dl_path = ["dl"]
+
+[db_config]
+db_dir_path = "/var/lib/ktra/db/"
+
+[server_config]
+# address = [0, 0, 0, 0]
+# port = 8000