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