Upgraded YAMS version to v2.0 #60

Merged
rogs merged 32 commits from v2 into master 2023-10-21 22:02:31 -03:00
Showing only changes of commit 72c31fd328 - Show all commits

26
yams
View File

@ -18,41 +18,41 @@ help() {
echo "start starts yams services" echo "start starts yams services"
echo "destroy destroy yams services so you can start from scratch" echo "destroy destroy yams services so you can start from scratch"
echo "check-vpn checks if the VPN is working as expected" echo "check-vpn checks if the VPN is working as expected"
echo "update updates YAMS echo "update updates YAMS"
} }
send_success_message() { send_success_message() {
echo -e $(printf "\e[32m$1\e[0m") echo -e "$(printf "\e[32m$1\e[0m")"
} }
send_error_message() { send_error_message() {
echo -e $(printf "\e[31m$1\e[0m") echo -e "$(printf "\e[31m$1\e[0m")"
exit 255 exit 255
} }
if [ $option == "--help" ]; then if [ "$option" == "--help" ]; then
help help
exit 0 exit 0
fi fi
if [ $option == "restart" ]; then if [ "$option" == "restart" ]; then
$dc stop && $dc up -d $dc stop && $dc up -d
echo "YAMS is starting. Wait 1 min until all the services are up and running..." echo "YAMS is starting. Wait 1 min until all the services are up and running..."
exit 0 exit 0
fi fi
if [ $option == "stop" ]; then if [ "$option" == "stop" ]; then
$dc stop $dc stop
exit 0 exit 0
fi fi
if [ $option == "start" ]; then if [ "$option" == "start" ]; then
$dc up -d $dc up -d
echo "YAMS is starting. Wait 1 min until all the services are up and running..." echo "YAMS is starting. Wait 1 min until all the services are up and running..."
exit 0 exit 0
fi fi
if [ $option == "check-vpn" ]; then if [ "$option" == "check-vpn" ]; then
echo "Getting your qBittorrent IP..." echo "Getting your qBittorrent IP..."
qbittorrent_ip=$(docker exec qbittorrent sh -c "curl -s ifconfig.me"); qbittorrent_ip=$(docker exec qbittorrent sh -c "curl -s ifconfig.me");
echo "$qbittorrent_ip" echo "$qbittorrent_ip"
@ -63,19 +63,19 @@ if [ $option == "check-vpn" ]; then
echo "$your_ip" echo "$your_ip"
echo "Your local IP country is $(curl -s https://am.i.mullvad.net/country)" echo "Your local IP country is $(curl -s https://am.i.mullvad.net/country)"
echo echo
if [ $qbittorrent_ip == $your_ip ]; then if [ "$qbittorrent_ip" == "$your_ip" ]; then
send_error_message "Your IPs are the same! qBittorrent is NOT working! ⚠️" send_error_message "Your IPs are the same! qBittorrent is NOT working! ⚠️"
else else
send_success_message "Your IPs are different. qBittorrent is working as expected! ✅ " send_success_message "Your IPs are different. qBittorrent is working as expected! ✅ "
fi fi
fi fi
if [ $option == "destroy" ]; then if [ "$option" == "destroy" ]; then
echo echo
echo echo
read -p "Are you sure you want to destroy all your yams services? THIS IS NOT RECOVERABLE! ⚠️ ️🚨 [y/N]: " destroy_now read -pr "Are you sure you want to destroy all your yams services? THIS IS NOT RECOVERABLE! ⚠️ ️🚨 [y/N]: " destroy_now
destroy_now=${destroy_now:-"n"} destroy_now=${destroy_now:-"n"}
if [ $destroy_now == "y" ]; then if [ "$destroy_now" == "y" ]; then
$dc down $dc down
echo echo
echo echo
@ -84,7 +84,7 @@ if [ $option == "destroy" ]; then
fi fi
fi fi
if [ $option == "update" ]; then if [ "$option" == "update" ]; then
echo "Updating YAMS..." echo "Updating YAMS..."
$dc stop $dc stop
rm -rf /tmp/yams && mkdir /tmp/yams rm -rf /tmp/yams && mkdir /tmp/yams