summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2022-04-01 21:13:31 -0700
committerTrumeet <yuuta@yuuta.moe>2022-04-01 21:13:31 -0700
commit318a1ef88bb5ea09ff4cf953908aef5c76735a46 (patch)
tree9cdd8be7679e6a336af7a82ca4947b3ffdac97b2 /arch
downloadksyxbot-318a1ef88bb5ea09ff4cf953908aef5c76735a46.tar
ksyxbot-318a1ef88bb5ea09ff4cf953908aef5c76735a46.tar.gz
ksyxbot-318a1ef88bb5ea09ff4cf953908aef5c76735a46.tar.bz2
ksyxbot-318a1ef88bb5ea09ff4cf953908aef5c76735a46.zip
First Commit
Diffstat (limited to 'arch')
-rw-r--r--arch/.gitignore5
-rw-r--r--arch/PKGBUILD73
-rw-r--r--arch/botd.conf3
-rw-r--r--arch/ksyxbotd.service13
-rw-r--r--arch/sysusers.conf1
-rw-r--r--arch/tmpfiles.conf2
6 files changed, 97 insertions, 0 deletions
diff --git a/arch/.gitignore b/arch/.gitignore
new file mode 100644
index 0000000..8991b67
--- /dev/null
+++ b/arch/.gitignore
@@ -0,0 +1,5 @@
+*.zst
+pkg/
+src/
+td/
+ksyxbot/
diff --git a/arch/PKGBUILD b/arch/PKGBUILD
new file mode 100644
index 0000000..9918a4f
--- /dev/null
+++ b/arch/PKGBUILD
@@ -0,0 +1,73 @@
+# Maintainer: Yuuta Liang <yuuta@yuuta.moe>
+pkgname=ksyxbot-git
+pkgver=r11.546381f
+pkgrel=1
+pkgdesc="ksyx ksyx ksyx"
+arch=(x86_64)
+url="https://git.yuuta.moe/ksyxbot.git"
+license=('custom')
+groups=()
+depends=(zlib openssl)
+makedepends=('git')
+provides=("${pkgname%-git}")
+conflicts=("${pkgname%-git}")
+replaces=()
+backup=(etc/ksyxbot/botd.conf)
+options=()
+install=
+source=('ksyxbot::git+https://git.yuuta.moe/ksyxbot.git'
+'td::git+https://github.com/tdlib/td.git'
+'ksyxbotd.service'
+'sysusers.conf'
+'tmpfiles.conf'
+'botd.conf')
+noextract=()
+md5sums=('SKIP'
+ 'SKIP'
+ '36f708d68d52bac366a333628a1213a7'
+ '9d905a018be08f0ac09796e301949afd'
+ 'b47ae2adc14a370080941b535843b095'
+ '062bd08b22c915956e2fe655204c9427')
+
+pkgver() {
+ cd "$srcdir/${pkgname%-git}"
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare() {
+ cd "$srcdir/${pkgname%-git}"
+ git submodule init
+ git config submodule.td.url $srcdir/td
+ git submodule update
+}
+
+build() {
+ cd "$srcdir/${pkgname%-git}"
+ mkdir -p cmake-build-release
+ cd cmake-build-release
+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH="$pkgdir/usr" ..
+ make ksyxbotd
+}
+
+check() {
+ cd "$srcdir/${pkgname%-git}"
+}
+
+package() {
+ cd "$srcdir/${pkgname%-git}"
+ mkdir -p "$pkgdir/etc/ksyxbot/"
+ chmod 700 "$pkgdir/etc/ksyxbot/"
+ install -Dm700 "$srcdir/default.conf" "$pkgdir/etc/ksyxbot/default.conf"
+ mkdir -p "$pkgdir/usr/lib/sysusers.d/"
+ install -Dm644 "$srcdir/sysusers.conf" "$pkgdir/usr/lib/sysusers.d/ksyxbot.conf"
+ mkdir -p "$pkgdir/var/lib/ksyxbot/"
+ chmod 700 "$pkgdir/var/lib/ksyxbot/"
+ mkdir -p "$pkgdir/usr/lib/tmpfiles.d/"
+ install -Dm644 "$srcdir/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/ksyxbot.conf"
+ mkdir -p "$pkgdir/usr/lib/systemd/system/"
+ install -Dm644 "$srcdir/ksyxbotd.service" "$pkgdir/usr/lib/systemd/system/ksyxbotd.service"
+ mkdir -p "$pkgdir/usr/share/licenses/${pkgname%-git}/"
+ install -Dm644 "./LICENSE" "$pkgdir/usr/share/licenses/${pkgname%-git}/LICENSE"
+ mkdir -p "$pkgdir/usr/bin/"
+ install -Dm755 "./cmake-build-release/ksyxbotd" "$pkgdir/usr/bin/ksyxbotd"
+}
diff --git a/arch/botd.conf b/arch/botd.conf
new file mode 100644
index 0000000..d1fbef4
--- /dev/null
+++ b/arch/botd.conf
@@ -0,0 +1,3 @@
+TD_API_ID=
+TD_API_HASH=
+BOT_TOKEN=
diff --git a/arch/ksyxbotd.service b/arch/ksyxbotd.service
new file mode 100644
index 0000000..c71fe66
--- /dev/null
+++ b/arch/ksyxbotd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=ksyxbotd
+Documentation=man:ksyxbotd(1)
+After=network.target network-online.target nss-lookup.target
+
+[Service]
+Type=simple
+User=ksyxbot
+EnvironmentFile=/etc/ksyxbot/botd.conf
+ExecStart=/usr/bin/ksyxbotd --td_path /var/lib/ksyxbot/td/ --db_path /var/lib/ksyxbot/db.sql
+
+[Install]
+WantedBy=multi-user.target
diff --git a/arch/sysusers.conf b/arch/sysusers.conf
new file mode 100644
index 0000000..652de4f
--- /dev/null
+++ b/arch/sysusers.conf
@@ -0,0 +1 @@
+u ksyxbot - "ksyxbotd" /var/lib/ksyxbot/ /bin/nologin
diff --git a/arch/tmpfiles.conf b/arch/tmpfiles.conf
new file mode 100644
index 0000000..5702e68
--- /dev/null
+++ b/arch/tmpfiles.conf
@@ -0,0 +1,2 @@
+d /etc/ksyxbot/ 0700 ksyxbot nobody -
+d /var/lib/ksyxbot/ 0700 ksyxbot nobody -