Separate user creation

This commit is contained in:
Michael De Roover 2021-12-30 15:22:35 +01:00
parent 7243a87191
commit 39c1deacc0
Signed by: vim
GPG Key ID: 075496E232CE04CB

View File

@ -23,7 +23,7 @@ mkconfig(){
echo "logchat = $logchat" >> config.py echo "logchat = $logchat" >> config.py
} }
addfiles(){ mkuser(){
# Create user account, distro mess awaits here... # Create user account, distro mess awaits here...
# Debian has both useradd and adduser # Debian has both useradd and adduser
if [ -e /sbin/useradd ] if [ -e /sbin/useradd ]
@ -37,7 +37,9 @@ addfiles(){
adduser -S bot adduser -S bot
return 0 return 0
fi fi
}
addfiles(){
# Install executable and config # Install executable and config
mkdir /etc/ubot mkdir /etc/ubot
install -o root -g bot -m640 config.py /etc/ubot/config.py install -o root -g bot -m640 config.py /etc/ubot/config.py
@ -58,6 +60,8 @@ addfiles(){
pip3 install -U telethon pip3 install -U telethon
# Generate config if not built yet # Generate config if not built yet
[ ! -f config.py ] && mkconfig [ ! -f config.py ] && mkconfig
# Create a new user
mkuser
# Install files if config is (now) present # Install files if config is (now) present
[ -f config.py ] && addfiles [ -f config.py ] && addfiles