summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Gonzalez <roger@rogs.me>2023-01-24 08:58:18 -0300
committerRoger Gonzalez <roger@rogs.me>2023-01-24 08:58:18 -0300
commiteafaac963ccfa14a12377cdbde12a26a82063d20 (patch)
treedd7176971cba28bcfd4aff406937c37b303e4b8e
parente47762d0452972ad986874671140b93604e83970 (diff)
Making sure the script is not running with sudo
-rwxr-xr-xinstall.sh10
1 files 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/<your_PUID>/$puid/g" $filename