From 574b7ce5f1aa45d854e52aa1bd154590d6d85647 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 5 Apr 2023 14:10:59 +0200 Subject: [PATCH 1/2] use id command instead of variable --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 8dd5660..4555ee8 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/sh # quick install (and run) script for upfast using systemd -if [ $EUID -ne 0] +if [ "$(id -u)" -ne 0 ] then echo "Please run as root" exit 1 From 4d3cac88512f858603f7d1aa2f856a5d0227342e Mon Sep 17 00:00:00 2001 From: root Date: Wed, 5 Apr 2023 14:15:54 +0200 Subject: [PATCH 2/2] added error detection --- install.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 4555ee8..d460b2c 100755 --- a/install.sh +++ b/install.sh @@ -7,20 +7,26 @@ then exit 1 fi -useradd --shell /bin/sh --system --home-dir /usr/local/upfast upfast -mkdir -p /usr/local/upfast # dodge copying of skeletons +useradd --shell /bin/sh --system --home-dir /usr/local/upfast upfast || + exit 1 +mkdir -p /usr/local/upfast || # dodge copying of skeletons + exit 1 chown upfast:upfast /usr/local/upfast chmod 700 /usr/local/upfast su upfast -c' cd -git clone https://code.cronyakatsuki.xyz/crony/upfast . +git clone https://code.cronyakatsuki.xyz/tlast/upfast . || + exit 1 python3 -m venv env -. ./env/bin/activate -pip install -r requirements.txt -mkdir upload' +. ./env/bin/activate || + exit1 +pip install -r requirements.txt || + exit 1 +mkdir upload' || + exit 1 cp ./upfast.service /etc/systemd/system/upfast.service systemctl daemon-reload