From 7243a87191448c3b3c6f2fa133c7edbd36e902ad Mon Sep 17 00:00:00 2001 From: Michael De Roover Date: Thu, 30 Dec 2021 14:34:08 +0100 Subject: [PATCH] Run installer as root --- install | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/install b/install index 59215a0..43a6f49 100755 --- a/install +++ b/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