Skip to content

Commit f536747

Browse files
authored
chore: added alpha to install script for linux (#86)
1 parent 95e8419 commit f536747

File tree

1 file changed

+64
-15
lines changed

1 file changed

+64
-15
lines changed

scripts/install.sh

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,44 @@ progress_bar() {
8787
printf "] ${BOLD}%d%%${RESET}" $percentage
8888
}
8989

90+
# Compare commit SHAs between repos
91+
compare_commits() {
92+
local main_repo="aayush2622/Dartotsu"
93+
local alpha_repo="grayankit/Dartotsu-Downloader"
94+
95+
echo -ne "${CYAN}${ICON_INFO}${RESET} Checking commit synchronization..."
96+
97+
# Get latest commits from both repos
98+
local main_commit=$(curl -s "https://api.github.com/repos/${main_repo}/commits" | grep '"sha"' | head -1 | cut -d '"' -f 4 | cut -c1-7)
99+
local main_date=$(curl -s "https://api.github.com/repos/${main_repo}/commits" | grep '"date"' | head -1 | cut -d '"' -f 4)
100+
101+
local alpha_release=$(curl -s "https://api.github.com/repos/${alpha_repo}/releases/latest")
102+
local alpha_tag=$(echo "$alpha_release" | grep '"tag_name"' | cut -d '"' -f 4)
103+
local alpha_date=$(echo "$alpha_release" | grep '"published_at"' | cut -d '"' -f 4)
104+
105+
echo -e " ${GREEN}${ICON_SUCCESS}${RESET}"
106+
echo
107+
echo -e "${BOLD}${BLUE}╭─ COMMIT COMPARISON ────────────────────────────────╮${RESET}"
108+
echo -e "${BOLD}${BLUE}${RESET} Main Repo (${main_repo}): ${BLUE}${BOLD}${RESET}"
109+
echo -e "${BOLD}${BLUE}${RESET} Latest Commit: ${YELLOW}${main_commit}${RESET} ${BLUE}${BOLD}${RESET}"
110+
echo -e "${BOLD}${BLUE}${RESET} Date: ${GRAY}$(date -d "$main_date" '+%Y-%m-%d %H:%M:%S')${RESET} ${BLUE}${BOLD}${RESET}"
111+
echo -e "${BOLD}${BLUE}${RESET} ${BLUE}${BOLD}${RESET}"
112+
echo -e "${BOLD}${BLUE}${RESET} Alpha Repo (${alpha_repo}): ${BLUE}${BOLD}${RESET}"
113+
echo -e "${BOLD}${BLUE}${RESET} Latest Tag: ${PURPLE}${alpha_tag}${RESET} ${BLUE}${BOLD}${RESET}"
114+
echo -e "${BOLD}${BLUE}${RESET} Date: ${GRAY}$(date -d "$alpha_date" '+%Y-%m-%d %H:%M:%S')${RESET} ${BLUE}${BOLD}${RESET}"
115+
echo -e "${BOLD}${BLUE}${RESET} ${BLUE}${BOLD}${RESET}"
116+
117+
# Check if commits match (simplified comparison)
118+
if [[ "$alpha_tag" == *"$main_commit"* ]]; then
119+
echo -e "${BOLD}${BLUE}${RESET} Status: ${GREEN}${ICON_SUCCESS} Synchronized${RESET} ${BLUE}${BOLD}${RESET}"
120+
else
121+
echo -e "${BOLD}${BLUE}${RESET} Status: ${YELLOW}${ICON_WARNING} Out of sync${RESET} ${BLUE}${BOLD}${RESET}"
122+
fi
123+
124+
echo -e "${BOLD}${BLUE}╰────────────────────────────────────────────────────╯${RESET}"
125+
echo
126+
}
127+
90128
# Animated text typing effect
91129
type_text() {
92130
local text="$1"
@@ -172,16 +210,18 @@ show_menu() {
172210
}
173211

174212
# Version selection menu
213+
# Replace the existing version_menu function with:
175214
version_menu() {
176215
echo
177216
echo -e "${BOLD}${CYAN}┌─ VERSION SELECTION ────────────────────────────────┐${RESET}"
178217
echo -e "${BOLD}${CYAN}${RESET} ${CYAN}${BOLD}${RESET}"
179218
echo -e "${BOLD}${CYAN}${RESET} ${ICON_ROCKET} ${GREEN}${BOLD}[S]${RESET} Stable Release ${GRAY}(Recommended)${RESET} ${CYAN}${BOLD}${RESET}"
180219
echo -e "${BOLD}${CYAN}${RESET} ${ICON_SPARKLES} ${YELLOW}${BOLD}[P]${RESET} Pre-release ${GRAY}(Latest Features)${RESET} ${CYAN}${BOLD}${RESET}"
220+
echo -e "${BOLD}${CYAN}${RESET} ${ICON_SPARKLES} ${PURPLE}${BOLD}[A]${RESET} Alpha Build ${GRAY}(Experimental)${RESET} ${CYAN}${BOLD}${RESET}"
181221
echo -e "${BOLD}${CYAN}${RESET} ${CYAN}${BOLD}${RESET}"
182222
echo -e "${BOLD}${CYAN}└────────────────────────────────────────────────────┘${RESET}"
183223
echo
184-
echo -ne "${BOLD}${WHITE}Your choice${RESET} ${GRAY}(S/P)${RESET}: "
224+
echo -ne "${BOLD}${WHITE}Your choice${RESET} ${GRAY}(S/P/A)${RESET}: "
185225
}
186226

187227
# =============================================================================
@@ -439,20 +479,29 @@ install_app() {
439479
read -n 1 ANSWER
440480
echo
441481

442-
case "${ANSWER,,}" in
443-
p)
444-
API_URL="https://api.github.com/repos/$OWNER/$REPO/releases"
445-
info_msg "Fetching pre-release versions..."
446-
;;
447-
s|"")
448-
API_URL="https://api.github.com/repos/$OWNER/$REPO/releases/latest"
449-
info_msg "Fetching stable release..."
450-
;;
451-
*)
452-
warn_msg "Invalid selection, defaulting to stable release..."
453-
API_URL="https://api.github.com/repos/$OWNER/$REPO/releases/latest"
454-
;;
455-
esac
482+
# Replace the case statement with:
483+
case "${ANSWER,,}" in
484+
p)
485+
API_URL="https://api.github.com/repos/$OWNER/$REPO/releases"
486+
info_msg "Fetching pre-release versions..."
487+
;;
488+
a)
489+
OWNER="grayankit"
490+
REPO="Dartotsu-Downloader"
491+
API_URL="https://api.github.com/repos/$OWNER/$REPO/releases/latest"
492+
info_msg "Fetching alpha build..."
493+
echo
494+
compare_commits
495+
;;
496+
s|"")
497+
API_URL="https://api.github.com/repos/$OWNER/$REPO/releases/latest"
498+
info_msg "Fetching stable release..."
499+
;;
500+
*)
501+
warn_msg "Invalid selection, defaulting to stable release..."
502+
API_URL="https://api.github.com/repos/$OWNER/$REPO/releases/latest"
503+
;;
504+
esac
456505

457506
# Fetch release info
458507
ASSET_URL=$(curl -s "$API_URL" | grep browser_download_url | cut -d '"' -f 4 | grep .zip | head -n 1)

0 commit comments

Comments
 (0)