From f159bd954a83573207b1a18422e581b086c016b5 Mon Sep 17 00:00:00 2001 From: Steve Illichevskiy Date: Thu, 2 Oct 2014 20:52:22 +0400 Subject: [PATCH] Add preinst and postrm for daemon mode Generate config --- debian/install | 3 +++ debian/postrm | 4 ++++ debian/preinst | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 debian/postrm create mode 100644 debian/preinst diff --git a/debian/install b/debian/install index eeb51dc..1f080e9 100644 --- a/debian/install +++ b/debian/install @@ -1,2 +1,5 @@ bin/telegram-cli usr/bin +bin/telegram-cli usr/share/telegram-daemon/bin +start-telegram-daemon /usr/share/telegram-daemon/bin +test.lua /var/lib/telegram-daemon/ server.pub etc/telegram-cli \ No newline at end of file diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..aad36bf --- /dev/null +++ b/debian/postrm @@ -0,0 +1,4 @@ +#!/bin/sh +deluser telegramd +rm -r /etc/telegram-daemon/ +rm -r /var/log/telegram-daemon/ diff --git a/debian/preinst b/debian/preinst new file mode 100644 index 0000000..ef269ee --- /dev/null +++ b/debian/preinst @@ -0,0 +1,18 @@ +#!/bin/sh +adduser --system --home /var/lib/telegram-daemon/ telegramd + usermod -c "Telegram Daemon" telegramd + usermod -d "/var/lib/telegram-daemon/" telegramd + usermod -g "telegramd" telegramd + usermod -s "/bin/false" telegramd + +mkdir /etc/telegram-daemon/ +mkdir /var/log/telegram-daemon/ +touch /etc/telegram-daemon/telegram-daemon.achat.conf +echo "execute telegram-cli" > /etc/telegram-daemon/telegram-daemon.achat.conf +echo "-d" >> /etc/telegram-daemon/telegram-daemon.achat.conf +echo "-vvvv" >> /etc/telegram-daemon/telegram-daemon.achat.conf +echo "-E" >> /etc/telegram-daemon/telegram-daemon.achat.conf +echo "-R" >> /etc/telegram-daemon/telegram-daemon.achat.conf +echo "-D" >> /etc/telegram-daemon/telegram-daemon.achat.conf +echo "-C" >> /etc/telegram-daemon/telegram-daemon.achat.conf +echo "-P 2391" >> /etc/telegram-daemon/telegram-daemon.achat.conf \ No newline at end of file