From 89405ac84dc6fbb61fb71303cdc60ef4e1db22a9 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Sat, 21 Oct 2023 18:32:07 -0300 Subject: Renamed install_location to install_directory --- docs.org | 52 +++++++++++++++++++++++++++++----------------------- install.sh | 48 +++++++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/docs.org b/docs.org index 0500c02..59eff9f 100644 --- a/docs.org +++ b/docs.org @@ -26,7 +26,7 @@ - [[#success-message][Success message!]] - [[#final-steps][Final steps]] - [[#install-the-yams-cli][Install the YAMS CLI]] - - [[#set-the-correct-permissions-to-the-media-folder][Set the correct permissions to the media folder]] + - [[#set-the-correct-permissions-to-the-media-and-install-directories][Set the correct permissions to the media and install directories]] - [[#create-the-config-directory][Create the config directory]] - [[#display-closing-message][Display closing message]] @@ -179,21 +179,21 @@ fi #+begin_src bash default_install_location="/opt/yams" -read -p "Where do you want to install the docker-compose file? [$default_install_location]: " install_location -install_location=${install_location:-$default_install_location} +read -p "Where do you want to install the docker-compose file? [$default_install_location]: " install_directory +install_directory=${install_directory:-$default_install_directory} -if [ ! -d "$install_location" ]; then - echo "The directory \"$install_location\" does not exists. Attempting to create..." - if mkdir -p "$install_location"; then - send_success_message "Directory $install_location created ✅" +if [ ! -d "$install_directory" ]; then + echo "The directory \"$install_directory\" does not exists. Attempting to create..." + if mkdir -p "$install_directory"; then + send_success_message "Directory $install_directory created ✅" else - send_error_message "There was an error creating the installation directory at \"$install_location\". Make sure you have the necessary permissions ❌" + send_error_message "There was an error creating the installation directory at \"$install_directory\". Make sure you have the necessary permissions ❌" fi fi -filename="$install_location/docker-compose.yaml" -custom_file_filename="$install_location/docker-compose.custom.yaml" -env_file="$install_location/.env" +filename="$install_directory/docker-compose.yaml" +custom_file_filename="$install_directory/docker-compose.custom.yaml" +env_file="$install_directory/.env" #+end_src ** Setting the correct user @@ -315,7 +315,7 @@ if [ "$setup_vpn" == "y" ]; then echo fi -echo "Configuring the docker-compose file for the user \"$username\" on \"$install_location\"..." +echo "Configuring the docker-compose file for the user \"$username\" on \"$install_directory\"..." #+end_src * Installing YAMS @@ -368,7 +368,7 @@ if [ "$media_service" == "plex" ]; then sed -i -e "s|#network_mode: host # plex|network_mode: host # plex|g" "$filename" fi -sed -i -e "s||$install_location|g" "$env_file" +sed -i -e "s||$install_directory|g" "$env_file" if [ "$setup_vpn" == "y" ]; then sed -i -e "s||$vpn_service|g" "$env_file" \ @@ -390,7 +390,7 @@ fi #+begin_src bash sed -i -e "s||$filename|g" yams \ -e "s||$custom_file_filename|g" yams \ - -e "s||$install_location|g" yams + -e "s||$install_directory|g" yams #+end_src ** Success message! @@ -430,7 +430,7 @@ else fi #+end_src -** Set the correct permissions to the media folder +** Set the correct permissions to the media and install directories :PROPERTIES: :ID: 4cfb9397-776d-46db-84cc-54b78395cba8 :END: @@ -439,9 +439,15 @@ This adds the correct permissions to the media folder, in case they are not corr #+begin_src bash if sudo chown -R "$puid":"$pgid" "$media_directory"; then - send_success_message "Media folder ownership and permissions set successfully ✅" + send_success_message "Media directory ownership and permissions set successfully ✅" else - send_error_message "Failed to set ownership and permissions for the media folder. Check permissions ❌" + send_error_message "Failed to set ownership and permissions for the media directory. Check permissions ❌" +fi + +if sudo chown -R "$puid":"$pgid" "$install_directory"; then + send_success_message "Install directory ownership and permissions set successfully ✅" +else + send_error_message "Failed to set ownership and permissions for the install directory. Check permissions ❌" fi #+end_src @@ -454,17 +460,17 @@ This is where all the configurations are going to be saved. If it doesn't it wil it can't be created, we'll raise an error. #+begin_src bash -if [[ -d "$install_location/config" ]]; then - send_success_message "Configuration folder \"$install_location/config\" exists ✅" +if [[ -d "$install_directory/config" ]]; then + send_success_message "Configuration folder \"$install_directory/config\" exists ✅" else - if sudo mkdir -p "$install_location/config"; then - send_success_message "Configuration folder \"$install_location/config\" created ✅" + if sudo mkdir -p "$install_directory/config"; then + send_success_message "Configuration folder \"$install_directory/config\" created ✅" else send_error_message "Failed to create or access the configuration folder. Check permissions ❌" fi fi -if sudo chown -R "$puid":"$pgid" "$install_location/config"; then +if sudo chown -R "$puid":"$pgid" "$install_directory/config"; then send_success_message "Configuration folder ownership and permissions set successfully ✅" else send_error_message "Failed to set ownership and permissions for the configuration folder. Check permissions ❌" @@ -493,7 +499,7 @@ echo " \__\/ \ \::/ \ \:\ \ \::/ " echo " \__\/ \__\/ \__\/ " echo "========================================================" send_success_message "All done!✅ Enjoy YAMS!" -echo "You can check the installation on $install_location" +echo "You can check the installation on $install_directory" echo "========================================================" echo "Everything should be running now! To check everything running, go to:" echo diff --git a/install.sh b/install.sh index b90b66f..cdecb73 100644 --- a/install.sh +++ b/install.sh @@ -73,21 +73,21 @@ fi default_install_location="/opt/yams" -read -p "Where do you want to install the docker-compose file? [$default_install_location]: " install_location -install_location=${install_location:-$default_install_location} +read -p "Where do you want to install the docker-compose file? [$default_install_location]: " install_directory +install_directory=${install_directory:-$default_install_directory} -if [ ! -d "$install_location" ]; then - echo "The directory \"$install_location\" does not exists. Attempting to create..." - if mkdir -p "$install_location"; then - send_success_message "Directory $install_location created ✅" +if [ ! -d "$install_directory" ]; then + echo "The directory \"$install_directory\" does not exists. Attempting to create..." + if mkdir -p "$install_directory"; then + send_success_message "Directory $install_directory created ✅" else - send_error_message "There was an error creating the installation directory at \"$install_location\". Make sure you have the necessary permissions ❌" + send_error_message "There was an error creating the installation directory at \"$install_directory\". Make sure you have the necessary permissions ❌" fi fi -filename="$install_location/docker-compose.yaml" -custom_file_filename="$install_location/docker-compose.custom.yaml" -env_file="$install_location/.env" +filename="$install_directory/docker-compose.yaml" +custom_file_filename="$install_directory/docker-compose.custom.yaml" +env_file="$install_directory/.env" read -p "What's the user that is going to own the media server files? [$USER]: " username username=${username:-$USER} @@ -181,7 +181,7 @@ if [ "$setup_vpn" == "y" ]; then echo fi -echo "Configuring the docker-compose file for the user \"$username\" on \"$install_location\"..." +echo "Configuring the docker-compose file for the user \"$username\" on \"$install_directory\"..." copy_files=( "docker-compose.example.yaml:$filename" @@ -211,7 +211,7 @@ if [ "$media_service" == "plex" ]; then sed -i -e "s|#network_mode: host # plex|network_mode: host # plex|g" "$filename" fi -sed -i -e "s||$install_location|g" "$env_file" +sed -i -e "s||$install_directory|g" "$env_file" if [ "$setup_vpn" == "y" ]; then sed -i -e "s||$vpn_service|g" "$env_file" \ @@ -226,7 +226,7 @@ fi sed -i -e "s||$filename|g" yams \ -e "s||$custom_file_filename|g" yams \ - -e "s||$install_location|g" yams + -e "s||$install_directory|g" yams send_success_message "Everything installed correctly! 🎉" @@ -244,22 +244,28 @@ else fi if sudo chown -R "$puid":"$pgid" "$media_directory"; then - send_success_message "Media folder ownership and permissions set successfully ✅" + send_success_message "Media directory ownership and permissions set successfully ✅" else - send_error_message "Failed to set ownership and permissions for the media folder. Check permissions ❌" + send_error_message "Failed to set ownership and permissions for the media directory. Check permissions ❌" fi -if [[ -d "$install_location/config" ]]; then - send_success_message "Configuration folder \"$install_location/config\" exists ✅" +if sudo chown -R "$puid":"$pgid" "$install_directory"; then + send_success_message "Install directory ownership and permissions set successfully ✅" else - if sudo mkdir -p "$install_location/config"; then - send_success_message "Configuration folder \"$install_location/config\" created ✅" + send_error_message "Failed to set ownership and permissions for the install directory. Check permissions ❌" +fi + +if [[ -d "$install_directory/config" ]]; then + send_success_message "Configuration folder \"$install_directory/config\" exists ✅" +else + if sudo mkdir -p "$install_directory/config"; then + send_success_message "Configuration folder \"$install_directory/config\" created ✅" else send_error_message "Failed to create or access the configuration folder. Check permissions ❌" fi fi -if sudo chown -R "$puid":"$pgid" "$install_location/config"; then +if sudo chown -R "$puid":"$pgid" "$install_directory/config"; then send_success_message "Configuration folder ownership and permissions set successfully ✅" else send_error_message "Failed to set ownership and permissions for the configuration folder. Check permissions ❌" @@ -281,7 +287,7 @@ echo " \__\/ \ \::/ \ \:\ \ \::/ " echo " \__\/ \__\/ \__\/ " echo "========================================================" send_success_message "All done!✅ Enjoy YAMS!" -echo "You can check the installation on $install_location" +echo "You can check the installation on $install_directory" echo "========================================================" echo "Everything should be running now! To check everything running, go to:" echo -- cgit v1.2.3