Finish up the installer
This commit is contained in:
parent
03b5e60a97
commit
0bfbf113b4
2
bin/ubot
2
bin/ubot
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
import sys
|
||||
sys.path.append("/var/ubot")
|
||||
from telethon import TelegramClient, events
|
||||
from config import *
|
||||
|
||||
|
10
install
10
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user