Run installer as root
This commit is contained in:
parent
d1c90cbcd9
commit
7243a87191
20
install
20
install
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Preliminary sanity checks
|
||||
[ $(id -u) = 0 ] && echo "Please do not run as root." && exit 1
|
||||
[ $(id -u) != 0 ] && echo "Please run this installer as root." && exit 1
|
||||
[ $0 != ./install ] && echo "Not launched from repository root." && exit 1
|
||||
|
||||
# Functions
|
||||
@ -28,34 +28,34 @@ addfiles(){
|
||||
# Debian has both useradd and adduser
|
||||
if [ -e /sbin/useradd ]
|
||||
then
|
||||
sudo useradd -r bot
|
||||
useradd -r bot
|
||||
return 0
|
||||
fi
|
||||
# Alpine only has adduser (Busybox)
|
||||
if [ -e /sbin/adduser ]
|
||||
then
|
||||
sudo adduser -S bot
|
||||
adduser -S bot
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Install executable and config
|
||||
sudo mkdir /etc/ubot
|
||||
sudo install -o root -g bot -m640 config.py /etc/ubot/config.py
|
||||
sudo install -m755 bin/ubot /usr/bin/ubot
|
||||
mkdir /etc/ubot
|
||||
install -o root -g bot -m640 config.py /etc/ubot/config.py
|
||||
install -m755 bin/ubot /usr/bin/ubot
|
||||
|
||||
# Install service files on installed inits
|
||||
if [ -e /sbin/openrc ]
|
||||
then
|
||||
sudo install -m755 init/openrc /etc/init.d/ubot
|
||||
sudo ln -s /sbin/openrc /etc/periodic/15min/openrc
|
||||
install -m755 init/openrc /etc/init.d/ubot
|
||||
ln -s /sbin/openrc /etc/periodic/15min/openrc
|
||||
elif [ -e /lib/systemd/systemd ]
|
||||
then
|
||||
sudo install -m644 init/systemd /etc/systemd/system/ubot.service
|
||||
install -m644 init/systemd /etc/systemd/system/ubot.service
|
||||
fi
|
||||
}
|
||||
|
||||
# Install dependencies
|
||||
sudo pip3 install -U telethon
|
||||
pip3 install -U telethon
|
||||
# Generate config if not built yet
|
||||
[ ! -f config.py ] && mkconfig
|
||||
# Install files if config is (now) present
|
||||
|
Loading…
x
Reference in New Issue
Block a user