Extra small refactors

This commit is contained in:
Roger Gonzalez 2023-10-21 18:46:51 -03:00
parent 27284eddae
commit eb13d6e0da
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
2 changed files with 48 additions and 28 deletions

View File

@ -110,12 +110,12 @@ This function verifies that the dependencies are installed. ~Docker~ and ~docker
for YAMS to work. for YAMS to work.
#+begin_src bash #+begin_src bash
check_dependencides() { check_dependencies() {
if command -v $1 &> /dev/null; then if command -v "$1" &> /dev/null; then
send_success_message "$1 exists ✅" send_success_message "$1 exists ✅"
else else
echo -e $(printf "\e[31m ⚠️ $1 not found! ⚠️\e[0m") 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 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"} install_docker=${install_docker:-"n"}
if [ "$install_docker" == "y" ]; then if [ "$install_docker" == "y" ]; then
@ -138,15 +138,25 @@ finish installing.
#+begin_src bash #+begin_src bash
running_services_location() { running_services_location() {
host_ip=$(hostname -I | awk '{ print $1 }') host_ip=$(hostname -I | awk '{ print $1 }')
echo "qBittorrent: http://$host_ip:8080/"
echo "Radarr: http://$host_ip:7878/" services=(
echo "Sonarr: http://$host_ip:8989/" "qBittorrent:8080"
echo "Lidarr: http://$host_ip:8686/" "Radarr:7878"
echo "Readarr: http://$host_ip:8787/" "Sonarr:8989"
echo "Prowlarr: http://$host_ip:9696/" "Lidarr:8686"
echo "Bazarr: http://$host_ip:6767/" "Readarr:8787"
echo "$media_service: http://$host_ip:$media_service_port/" "Prowlarr:9696"
echo "Portainer: http://$host_ip:9000/" "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 #+end_src

View File

@ -32,12 +32,12 @@ send_error_message() {
exit 255 exit 255
} }
check_dependencides() { check_dependencies() {
if command -v $1 &> /dev/null; then if command -v "$1" &> /dev/null; then
send_success_message "$1 exists ✅" send_success_message "$1 exists ✅"
else else
echo -e $(printf "\e[31m ⚠️ $1 not found! ⚠️\e[0m") 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 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"} install_docker=${install_docker:-"n"}
if [ "$install_docker" == "y" ]; then if [ "$install_docker" == "y" ]; then
@ -50,15 +50,25 @@ check_dependencides() {
running_services_location() { running_services_location() {
host_ip=$(hostname -I | awk '{ print $1 }') host_ip=$(hostname -I | awk '{ print $1 }')
echo "qBittorrent: http://$host_ip:8080/"
echo "Radarr: http://$host_ip:7878/" services=(
echo "Sonarr: http://$host_ip:8989/" "qBittorrent:8080"
echo "Lidarr: http://$host_ip:8686/" "Radarr:7878"
echo "Readarr: http://$host_ip:8787/" "Sonarr:8989"
echo "Prowlarr: http://$host_ip:9696/" "Lidarr:8686"
echo "Bazarr: http://$host_ip:6767/" "Readarr:8787"
echo "$media_service: http://$host_ip:$media_service_port/" "Prowlarr:9696"
echo "Portainer: http://$host_ip:9000/" "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..." echo "Checking prerequisites..."