From eb13d6e0da36824e31550084da92efcffd869f13 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Sat, 21 Oct 2023 18:46:51 -0300 Subject: Extra small refactors --- docs.org | 38 ++++++++++++++++++++++++-------------- install.sh | 38 ++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 28 deletions(-) diff --git a/docs.org b/docs.org index 4640926..da44753 100644 --- a/docs.org +++ b/docs.org @@ -110,12 +110,12 @@ This function verifies that the dependencies are installed. ~Docker~ and ~docker for YAMS to work. #+begin_src bash -check_dependencides() { - if command -v $1 &> /dev/null; then - send_success_message "$1 exists ✅ " +check_dependencies() { + if command -v "$1" &> /dev/null; then + send_success_message "$1 exists ✅" else - echo -e $(printf "\e[31m ⚠️ $1 not found! ⚠️\e[0m") - read -p "Do you want YAMS to install docker and docker-compose? IT ONLY WORKS ON DEBIAN AND UBUNTU! [y/N]: " install_docker + echo -e "\e[31m⚠️ $1 not found! ⚠️\e[0m" + read -p "Do you want YAMS to install docker and docker-compose? (IT ONLY WORKS ON DEBIAN AND UBUNTU) [y/N]: " install_docker install_docker=${install_docker:-"n"} if [ "$install_docker" == "y" ]; then @@ -138,15 +138,25 @@ finish installing. #+begin_src bash running_services_location() { host_ip=$(hostname -I | awk '{ print $1 }') - echo "qBittorrent: http://$host_ip:8080/" - echo "Radarr: http://$host_ip:7878/" - echo "Sonarr: http://$host_ip:8989/" - echo "Lidarr: http://$host_ip:8686/" - echo "Readarr: http://$host_ip:8787/" - echo "Prowlarr: http://$host_ip:9696/" - echo "Bazarr: http://$host_ip:6767/" - echo "$media_service: http://$host_ip:$media_service_port/" - echo "Portainer: http://$host_ip:9000/" + + services=( + "qBittorrent:8080" + "Radarr:7878" + "Sonarr:8989" + "Lidarr:8686" + "Readarr:8787" + "Prowlarr:9696" + "Bazarr:6767" + "$media_service:$media_service_port" + "Portainer:9000" + ) + + echo -e "Service URLs:" + for service in "${services[@]}"; do + service_name="${service%%:*}" + service_port="${service##*:}" + echo "$service_name: http://$host_ip:$service_port/" + done } #+end_src diff --git a/install.sh b/install.sh index eb02686..6b29335 100644 --- a/install.sh +++ b/install.sh @@ -32,12 +32,12 @@ send_error_message() { exit 255 } -check_dependencides() { - if command -v $1 &> /dev/null; then - send_success_message "$1 exists ✅ " +check_dependencies() { + if command -v "$1" &> /dev/null; then + send_success_message "$1 exists ✅" else - echo -e $(printf "\e[31m ⚠️ $1 not found! ⚠️\e[0m") - read -p "Do you want YAMS to install docker and docker-compose? IT ONLY WORKS ON DEBIAN AND UBUNTU! [y/N]: " install_docker + echo -e "\e[31m⚠️ $1 not found! ⚠️\e[0m" + read -p "Do you want YAMS to install docker and docker-compose? (IT ONLY WORKS ON DEBIAN AND UBUNTU) [y/N]: " install_docker install_docker=${install_docker:-"n"} if [ "$install_docker" == "y" ]; then @@ -50,15 +50,25 @@ check_dependencides() { running_services_location() { host_ip=$(hostname -I | awk '{ print $1 }') - echo "qBittorrent: http://$host_ip:8080/" - echo "Radarr: http://$host_ip:7878/" - echo "Sonarr: http://$host_ip:8989/" - echo "Lidarr: http://$host_ip:8686/" - echo "Readarr: http://$host_ip:8787/" - echo "Prowlarr: http://$host_ip:9696/" - echo "Bazarr: http://$host_ip:6767/" - echo "$media_service: http://$host_ip:$media_service_port/" - echo "Portainer: http://$host_ip:9000/" + + services=( + "qBittorrent:8080" + "Radarr:7878" + "Sonarr:8989" + "Lidarr:8686" + "Readarr:8787" + "Prowlarr:9696" + "Bazarr:6767" + "$media_service:$media_service_port" + "Portainer:9000" + ) + + echo -e "Service URLs:" + for service in "${services[@]}"; do + service_name="${service%%:*}" + service_port="${service##*:}" + echo "$service_name: http://$host_ip:$service_port/" + done } echo "Checking prerequisites..." -- cgit v1.2.3