From 0bfbf113b4b0917d07b839ad3c74a3cfcf295b7b Mon Sep 17 00:00:00 2001 From: Michael De Roover Date: Sat, 1 Jan 2022 23:25:26 +0100 Subject: [PATCH] Finish up the installer --- bin/ubot | 2 ++ install | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/ubot b/bin/ubot index 620b306..020c315 100755 --- a/bin/ubot +++ b/bin/ubot @@ -1,4 +1,6 @@ #!/usr/bin/python3 +import sys +sys.path.append("/var/ubot") from telethon import TelegramClient, events from config import * diff --git a/install b/install index ae00482..6de3078 100755 --- a/install +++ b/install @@ -41,7 +41,7 @@ mkuser(){ addfiles(){ # Install executable and config - install -m770 -o root -g bot /var/ubot + install -dm770 -o root -g bot /var/ubot install -m640 -o root -g bot config.py /var/ubot/config.py install -m755 -o root -g root bin/ubot /usr/bin/ubot @@ -57,6 +57,8 @@ addfiles(){ } # Install dependencies +[ $(which apt) ] && apt install python3-pip +[ $(which apk) ] && apk add py3-pip pip3 install -U telethon # Generate config if not built yet [ ! -f config.py ] && mkconfig @@ -65,4 +67,10 @@ mkuser # Install files if config is (now) present [ -f config.py ] && addfiles +# Run Telethon for the first time +echo "Please log in to Telegram now." +echo "Afterwards you can hit Ctrl-C and start the ubot service." +umask 0077 +su bot -s /usr/bin/ubot + return 0