summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Filippov2018-05-31 14:46:47 +0100
committerAleksey Filippov2018-05-31 14:47:24 +0100
commitacb3f1c86735fecee495491b73dbe5d1b0f6937e (patch)
tree1ebb855748fbed37b4f4df3f951ef39a8d8797f6
parent03070e46672ba67c94c2c658c346fb708568b274 (diff)
downloadaur-acb3f1c86735fecee495491b73dbe5d1b0f6937e.tar.gz
Add systemd service and configuration files
-rw-r--r--.SRCINFO13
-rw-r--r--PKGBUILD22
-rw-r--r--mtproxy-config.service8
-rw-r--r--mtproxy-config.timer9
-rw-r--r--mtproxy.conf4
-rw-r--r--mtproxy.service11
6 files changed, 63 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a78cb38d6c3b..c9f7a41dc811 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,26 @@
# Generated by mksrcinfo v8
-# Thu May 31 12:38:17 UTC 2018
+# Thu May 31 13:47:24 UTC 2018
pkgbase = mtproxy-git
pkgdesc = Proxy server for Telegram messaging app
pkgver = 0.0.0
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/TelegramMessenger/MTProxy
arch = i686
arch = x86_64
license = GPLv2
license = LGPLv2
depends = zlib
+ backup = etc/mtproxy.conf
source = mtproxy-git::git+https://github.com/TelegramMessenger/MTProxy.git
+ source = mtproxy.conf
+ source = mtproxy-config.service
+ source = mtproxy-config.timer
+ source = mtproxy.service
md5sums = SKIP
+ md5sums = 6f01f66a7b42d07f9b84c2dc8d364468
+ md5sums = 7381aebdd60a0640e1f0210b39aa208d
+ md5sums = aa2367c3f759632473824fabcc3544ff
+ md5sums = d6ce9d722ebe818254dd472a1026acd8
pkgname = mtproxy-git
diff --git a/PKGBUILD b/PKGBUILD
index 9dd6ad3d5618..e947ab0234ec 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -16,7 +16,7 @@
pkgname=mtproxy-git
pkgver=0.0.0
-pkgrel=1
+pkgrel=2
pkgdesc="Proxy server for Telegram messaging app"
arch=('i686' 'x86_64')
url='https://github.com/TelegramMessenger/MTProxy'
@@ -24,9 +24,18 @@ license=('GPLv2' 'LGPLv2')
depends=('zlib')
source=(
"$pkgname::git+https://github.com/TelegramMessenger/MTProxy.git"
+ mtproxy.conf
+ mtproxy-config.service
+ mtproxy-config.timer
+ mtproxy.service
)
noextract=()
-md5sums=(SKIP)
+md5sums=('SKIP'
+ '6f01f66a7b42d07f9b84c2dc8d364468'
+ '7381aebdd60a0640e1f0210b39aa208d'
+ 'aa2367c3f759632473824fabcc3544ff'
+ 'd6ce9d722ebe818254dd472a1026acd8')
+backup=('etc/mtproxy.conf')
build() {
cd "$srcdir/$pkgname"
@@ -36,4 +45,13 @@ build() {
package() {
cd "$srcdir/$pkgname"
install -Dm 755 objs/bin/mtproto-proxy "$pkgdir/usr/bin/mtproto-proxy"
+ # SystemD configuration
+ install -Dm 644 "$srcdir/mtproxy.conf" "$pkgdir/etc/mtproxy.conf"
+ for srv in mtproxy-config.service mtproxy-config.timer mtproxy.service; do
+ install -Dm 644 \
+ "$srcdir/$srv" \
+ "$pkgdir/usr/lib/systemd/system/$srv"
+ done
+ # Create directory for configuration
+ install -d "$pkgdir/var/lib/mtproxy"
}
diff --git a/mtproxy-config.service b/mtproxy-config.service
new file mode 100644
index 000000000000..b37f5217af80
--- /dev/null
+++ b/mtproxy-config.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Updates Telegram configuration
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/curl -s https://core.telegram.org/getProxyConfig -o /var/lib/mtproxy/multi.conf
+ExecStart=/usr/bin/curl -s https://core.telegram.org/getProxySecret -o /var/lib/mtproxy/secret.conf
+StandardError=journal
diff --git a/mtproxy-config.timer b/mtproxy-config.timer
new file mode 100644
index 000000000000..0ada4b4f93a1
--- /dev/null
+++ b/mtproxy-config.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Daily update of Telegram configuration
+
+[Timer]
+OnCalendar=daily
+Persistent=true
+
+[Install]
+WantedBy=timers.target
diff --git a/mtproxy.conf b/mtproxy.conf
new file mode 100644
index 000000000000..05704533264b
--- /dev/null
+++ b/mtproxy.conf
@@ -0,0 +1,4 @@
+USER=nobody
+STATS_PORT=8888
+CLIENT_PORT=443
+SECRET=<MY SECRET>
diff --git a/mtproxy.service b/mtproxy.service
new file mode 100644
index 000000000000..5fc17cdb5cbd
--- /dev/null
+++ b/mtproxy.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Telegram proxy server
+Requires=mtproxy-config.service
+
+[Service]
+Type=simple
+EnvironmentFile=/etc/mtproxy.conf
+ExecStart=/usr/bin/mtproto-proxy --user=${USER} --port=${STATS_PORT} --http-ports=${CLIENT_PORT} --mtproto-secret=${SECRET} --aes-pwd=/var/lib/mtproxy/secret.conf /var/lib/mtproxy/multi.conf
+
+[Install]
+WantedBy=network-online.target