From b84d47972e0667d22264a01e185f17af6d96277e Mon Sep 17 00:00:00 2001 From: Trumeet Date: Sun, 14 Nov 2021 11:51:29 -0800 Subject: Add PKGBUILD for pacman --- .idea/vcs.xml | 3 +++ arch/.gitignore | 5 ++++ arch/PKGBUILD | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ arch/default.conf | 3 +++ arch/mutebot@.service | 14 ++++++++++ arch/sysusers.conf | 1 + arch/tmpfiles.conf | 2 ++ 7 files changed, 101 insertions(+) create mode 100644 arch/.gitignore create mode 100644 arch/PKGBUILD create mode 100644 arch/default.conf create mode 100644 arch/mutebot@.service create mode 100644 arch/sysusers.conf create mode 100644 arch/tmpfiles.conf diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 7dc97e3..3d11bc7 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,6 +2,9 @@ + + + \ No newline at end of file diff --git a/arch/.gitignore b/arch/.gitignore new file mode 100644 index 0000000..1ae28f2 --- /dev/null +++ b/arch/.gitignore @@ -0,0 +1,5 @@ +*.zst +pkg/ +src/ +td/ +mutebot/ \ No newline at end of file diff --git a/arch/PKGBUILD b/arch/PKGBUILD new file mode 100644 index 0000000..ee8e7f8 --- /dev/null +++ b/arch/PKGBUILD @@ -0,0 +1,73 @@ +# Maintainer: Yuuta Liang +pkgname=mutebot-git +pkgver=r5.00391bf +pkgrel=1 +pkgdesc="Yet another simple Telegram bot that mutes new members in groups." +arch=(x86_64) +url="https://github.com/Trumeet/mutebot" +license=('custom') +groups=() +depends=(zlib openssl) +makedepends=('git') +provides=("${pkgname%-git}") +conflicts=("${pkgname%-git}") +replaces=() +backup=(etc/mutebot/) +options=() +install= +source=('mutebot::git+https://github.com/Trumeet/mutebot.git' +'td::git+https://github.com/tdlib/td.git' +'mutebot@.service' +'sysusers.conf' +'tmpfiles.conf' +'default.conf') +noextract=() +md5sums=('SKIP' + 'SKIP' + 'f269f32f5c61b8ddd9bab84cb846541b' + '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 mutebot +} + +check() { + cd "$srcdir/${pkgname%-git}" +} + +package() { + cd "$srcdir/${pkgname%-git}" + mkdir -p "$pkgdir/etc/mutebot/" + chmod 700 "$pkgdir/etc/mutebot/" + install -Dm700 "$srcdir/default.conf" "$pkgdir/etc/mutebot/default.conf" + mkdir -p "$pkgdir/usr/lib/sysusers.d/" + install -Dm644 "$srcdir/sysusers.conf" "$pkgdir/usr/lib/sysusers.d/mutebot.conf" + mkdir -p "$pkgdir/var/lib/mutebot/" + chmod 700 "$pkgdir/var/lib/mutebot/" + mkdir -p "$pkgdir/usr/lib/tmpfiles.d/" + install -Dm644 "$srcdir/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/mutebot.conf" + mkdir -p "$pkgdir/usr/lib/systemd/system/" + install -Dm644 "$srcdir/mutebot@.service" "$pkgdir/usr/lib/systemd/system/mutebot@.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/mutebot" "$pkgdir/usr/bin/mutebot" +} diff --git a/arch/default.conf b/arch/default.conf new file mode 100644 index 0000000..8cf3d27 --- /dev/null +++ b/arch/default.conf @@ -0,0 +1,3 @@ +TD_API_ID= +TD_API_HASH= +TD_BOT_TOKEN= diff --git a/arch/mutebot@.service b/arch/mutebot@.service new file mode 100644 index 0000000..a9f0b21 --- /dev/null +++ b/arch/mutebot@.service @@ -0,0 +1,14 @@ +[Unit] +Description=mutebot +Documentation=man:mutebot(1) +After=network.target network-online.target nss-lookup.target + +[Service] +Type=simple +User=mutebot +EnvironmentFile=/etc/mutebot/%i.conf +ExecStartPre=/usr/bin/mutebot -l -d /var/lib/mutebot/%i/ +ExecStart=/usr/bin/mutebot -d /var/lib/mutebot/%i/ + +[Install] +WantedBy=multi-user.target diff --git a/arch/sysusers.conf b/arch/sysusers.conf new file mode 100644 index 0000000..e656719 --- /dev/null +++ b/arch/sysusers.conf @@ -0,0 +1 @@ +u mutebot - "mutebot daemon" /var/lib/mutebot/ /bin/nologin diff --git a/arch/tmpfiles.conf b/arch/tmpfiles.conf new file mode 100644 index 0000000..0483c19 --- /dev/null +++ b/arch/tmpfiles.conf @@ -0,0 +1,2 @@ +d /etc/mutebot/ 0700 mutebot nobody - +d /var/lib/mutebot/ 0700 mutebot nobody - -- cgit v1.2.3