diff --git a/Qortal-Setup-Linux.sh b/Qortal-Setup-Linux.sh index 8f745ff..b0b3775 100644 --- a/Qortal-Setup-Linux.sh +++ b/Qortal-Setup-Linux.sh @@ -1,13 +1,67 @@ #!/bin/bash -set -e +#set -e trap 'echo -e "\n${RED}❌ Setup cancelled by user. Exiting...${NC}"; exit 1' INT + +function print_gradient_progress_bar() { +# Function to print a gradient progress bar based on a given percentage +local percent=$1 +local total_steps=50 +local filled_steps=$((percent * total_steps / 100)) +local character="🮆" +progress_bar="" + +for ((j=0; j&1 | while read -r line; do +if [[ $line =~ ([0-9]+)% ]]; then +percent=${BASH_REMATCH[1]} +pline=$(echo $line | grep -E "% " | awk -F ' ' '{print $7}' | grep -E -o '[0-9]+') +print_gradient_progress_bar $pline +fi +done +} + + # Color Codes GREEN='\033[0;32m' YELLOW='\033[0;33m' CYAN='\033[0;36m' RED='\033[0;31m' NC='\033[0m' +start_color=(35 206 255) # Sky blue +end_color=(100 112 240) # Lilac intro_block=' ---------------------------------------- @@ -76,18 +130,18 @@ echo -e "${YELLOW}📋 Detected distro:${NC} ${GREEN}${DISTRO}${NC} ${CYAN}${VER # Install Required Packages echo -e "${CYAN}🔧 Installing dependencies...${NC}" case "$DISTRO" in - ubuntu|debian) + ubuntu|debian|linuxmint) sudo apt update - sudo apt install -y openjdk-17-jre curl unzip libfuse2 jq zlib1g-dev imagemagick + sudo apt install -y openjdk-17-jre curl unzip libfuse2 jq zlib1g-dev imagemagick wget ;; fedora) - sudo dnf install -y java-17-openjdk curl unzip fuse jq zlib-devel ImageMagick + sudo dnf install -y java-17-openjdk curl unzip fuse jq zlib-devel ImageMagick wget ;; arch) - sudo pacman -Sy --noconfirm jre17-openjdk curl unzip fuse2 jq zlib imagemagick + sudo pacman -Sy --noconfirm jre17-openjdk curl unzip fuse2 jq zlib imagemagick wget ;; alpine) - sudo apk add --no-cache openjdk17 curl unzip fuse jq zlib-dev imagemagick + sudo apk add --no-cache openjdk17 curl unzip fuse jq zlib-dev imagemagick wget ;; *) echo -e "${RED}⚠️ Unsupported distro: ${DISTRO}. Please install openjdk-17, curl, unzip, jq, zlib1g-dev and fuse manually.${NC}" @@ -123,7 +177,7 @@ if [ -d "$HOME/qortal" ]; then BACKUP_EXECUTED=false QORTAL_CORE_GOOD=true else - echo "${RED}⚠️ Qortal Core is not fully synced.${NC} ${CYAN}Proceeding...Will stop Qortal, backup existing data, and continue...${NC}" + echo -e "${RED}⚠️ Qortal Core is not fully synced.${NC} ${CYAN}Proceeding...Will stop Qortal, backup existing data, and continue...${NC}" if pgrep -f "qortal.jar" > /dev/null && curl -s "http://localhost:12391/admin/status" | grep -q "height"; then if [ -f "${HOME}/qortal/stop.sh" ]; then @@ -144,14 +198,15 @@ if [ -d "$HOME/qortal" ]; then fi if [ "$QORTAL_CORE_GOOD" == "false" ]; then - echo "${GREEN}Downloading Qortal Core...${NC}" - curl -LO https://github.com/Qortal/qortal/releases/latest/download/qortal.zip +print_gradient_text "Downloading Qortal Core, please wait." "${start_color[0]}" "${start_color[1]}" "${start_color[2]}" "${end_color[0]}" "${end_color[1]}" "${end_color[2]}" + wget_dl_with_progressbar "https://github.com/Qortal/qortal/releases/latest/download/qortal.zip" unzip qortal.zip rm qortal.zip chmod +x "$HOME/qortal/"*.sh chmod +x "$HOME/qortal/qort" fi + # Download Architecture-specific Qortal Hub echo -e "\n ${CYAN}Checking for Desktop Environment..." if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ] || [ -n "$XDG_CURRENT_DESKTOP" ]; then @@ -171,8 +226,9 @@ if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ] || [ -n "$XDG_CURRENT_DESKTOP" HUB_URL="https://github.com/Qortal/Qortal-Hub/releases/latest/download/Qortal-Hub.AppImage" fi - echo -e "\n ${CYAN}⬇️ Downloading Qortal Hub...${NC}" - curl -LO "$HUB_URL" + echo -e "\n" + print_gradient_text "⬇️ Downloading Qortal Hub..." "${start_color[0]}" "${start_color[1]}" "${start_color[2]}" "${end_color[0]}" "${end_color[1]}" "${end_color[2]}" + wget_dl_with_progressbar "$HUB_URL" if [ -f "${HOME}/qortal/Qortal-Hub" ]; then echo -e "\n ${GREEN} Existing Hub config found, re-configuring..." rm -rf Qortal-Hub @@ -205,7 +261,7 @@ if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ] || [ -n "$XDG_CURRENT_DESKTOP" [Desktop Entry] Name=Qortal Comment=Qortal Applications -Icon=qortal-logo +Icon=${HOME}/Pictures/icons/qortal-hub-app-logo.png Type=Directory EOL @@ -216,7 +272,7 @@ EOL Name=Qortal Hub Comment=Launch Qortal Hub Exec=$HOME/qortal/Qortal-Hub$SANDBOX_FLAG -Icon=qortal-hub +Icon=${HOME}/Pictures/icons/qortal-hub-app-logo.png Terminal=false Type=Application Categories=Qortal; @@ -321,3 +377,4 @@ else echo -e "\n ${GREEN}curl -L -o ~/auto-fix-qortal.sh https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/auto-fix-qortal.sh && chmod +x ~/auto-fix-qortal.sh && cd && ./auto-fix-qortal.sh${NC}" fi +