From eafaac963ccfa14a12377cdbde12a26a82063d20 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Tue, 24 Jan 2023 08:58:18 -0300 Subject: Making sure the script is not running with sudo --- install.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 3e63805..3023d00 100755 --- a/install.sh +++ b/install.sh @@ -18,6 +18,8 @@ echo "====================================================" echo "Welcome to YAMS (Yet Another Media Server)" echo "Installation process should be really quick" echo "We just need you to answer some questions" +echo "We are going to ask for your sudo password in the end" +echo "To finish the installation of the CLI" echo "====================================================" echo "" @@ -69,6 +71,10 @@ echo "Checking prerequisites..." check_dependencides "docker" check_dependencides "docker-compose" +if [[ "$EUID" = 0 ]]; then + send_error_message "YAMS has to run without sudo! Please, run it again with regular permissions" +fi + # ============================================================================================ # ============================================================================================ @@ -78,7 +84,7 @@ read -p "Where do you want to install the docker-compose file? [/opt/yams]: " in # Checking if the install_location exists install_location=${install_location:-/opt/yams} -[[ -f $install_location ]] || mkdir -p $install_location || send_error_message "There was an error with your install location! (Maybe you forgot to run with sudo?)" +[[ -f $install_location ]] || mkdir -p $install_location || send_error_message "There was an error with your install location! Make sure the directory exists and the user \"$USER\" has permissions on it" install_location=$(realpath $install_location) filename="$install_location/docker-compose.yaml" @@ -194,7 +200,7 @@ echo "Configuring the docker-compose file for the user \"$username\" on \"$insta echo "" echo "Copying $filename..." -cp docker-compose.example.yaml $filename || send_error_message "You need to have permissions on the folder! (Maybe you forgot to run with sudo?)" +cp docker-compose.example.yaml $filename || send_error_message "Your user ($USER) needs to have permissions on the installation folder!" # Set PUID sed -i -e "s//$puid/g" $filename -- cgit v1.2.3