@@ -38,40 +38,72 @@ check_supported_distro() {
3838 fi
3939}
4040
41- # Output functions for user feedback
42- # Handle [INFO] (blue) [WARNING] (yellow) [ERROR] (red) [SUCCESS] (Green) [FAILURE] (magenta)
41+ # Color definitions for output formatting
42+ COLOR_INFO=' \033[0;34m'
43+ COLOR_WARNING=' \033[1;33m'
44+ COLOR_ERROR=' \033[0;31m'
45+ COLOR_SUCCESS=' \033[0;32m'
46+ COLOR_FAILURE=' \033[0;35m'
47+ COLOR_ACTION=' \033[0;36m' # Cyan for action steps
48+ COLOR_RESET=' \033[0m'
49+
50+ # Output functions for user feedback (enhanced with emojis)
4351print_output () {
4452 local type=" $1 "
4553 local message=" $2 "
54+ local icon color
4655
4756 case " $type " in
4857 INFO)
49- printf ' %b[INFO] %b %s\n' ' \033[0;34m' ' \033[0m' " $message "
58+ icon=" ℹ️"
59+ color=" $COLOR_INFO "
60+ ;;
61+ ACTION)
62+ icon=" 🛠️"
63+ color=" $COLOR_ACTION "
5064 ;;
5165 WARNING)
52- printf ' %b[WARNING] %b %s\n' ' \033[1;33m' ' \033[0m' " $message "
66+ icon=" ⚠️"
67+ color=" $COLOR_WARNING "
5368 ;;
5469 ERROR)
55- printf ' %b[ERROR] %b %s\n' ' \033[0;31m' ' \033[0m' " $message "
70+ icon=" ❌"
71+ color=" $COLOR_ERROR "
5672 ;;
5773 SUCCESS)
58- printf ' %b[SUCCESS] %b %s\n' ' \033[0;32m' ' \033[0m' " $message "
74+ icon=" ✅"
75+ color=" $COLOR_SUCCESS "
5976 ;;
6077 FAILURE)
61- printf ' %b[FAILURE] %b %s\n' ' \033[0;35m' ' \033[0m' " $message "
78+ icon=" 🔥"
79+ color=" $COLOR_FAILURE "
6280 ;;
6381 * )
64- printf ' %s\n' " $message "
82+ icon=" 🧊"
83+ color=" "
6584 ;;
6685 esac
86+
87+ # Colorize message suffix after ':' if present
88+ if [[ $message == * :* ]]; then
89+ local prefix=" ${message%%:* } :"
90+ local suffix=" ${message#*: } "
91+ printf ' %b%s%b %s %b%s%b\n' \
92+ " $color " " $icon " " $COLOR_RESET " \
93+ " $prefix " " $color " " $suffix " " $COLOR_RESET "
94+ else
95+ printf ' %b%s%b %s\n' " $color " " $icon " " $COLOR_RESET " " $message "
96+ fi
6797}
6898
69- # Convenience wrappers for common output types
99+ # Convenience wrappers
70100print_info () { print_output " INFO" " $1 " ; }
101+ print_action () { print_output " ACTION" " $1 " ; }
71102print_warning () { print_output " WARNING" " $1 " ; }
72103print_error () { print_output " ERROR" " $1 " ; }
73104print_success () { print_output " SUCCESS" " $1 " ; }
74105print_failure () { print_output " FAILURE" " $1 " ; }
106+ print_generic () { print_output " " " $1 " ; }
75107
76108# Detect architecture and map to binary name
77109detect_arch () {
@@ -201,13 +233,13 @@ verify_binary_integrity() {
201233
202234 # Try GitHub CLI attestation verification first (most secure)
203235 if check_gh_cli; then
204- print_info " Verifying with GitHub CLI attestations..."
236+ print_action " Verifying with GitHub CLI attestations..."
205237 if gh attestation verify " $install_path " --repo " $repo " 2> /dev/null; then
206- print_success " ✓ GitHub CLI attestation verification passed"
238+ print_success " GitHub CLI attestation verification passed"
207239 return 0
208240 else
209- print_warning " ⚠ GitHub CLI attestation verification failed or not available"
210- print_info " Falling back to GitHub API verification..."
241+ print_warning " GitHub CLI attestation verification failed or not available"
242+ print_action " Falling back to GitHub API verification..."
211243 fi
212244 else
213245 if [[ -n ${GITHUB_ACTIONS:- } ]]; then
@@ -306,7 +338,7 @@ get_release_tag() {
306338 case " $tool " in
307339 wget)
308340 response=$( wget -qO- " $api " 2> /dev/null) || {
309- handle_error $? " wget -qO- $api " " Failed to fetch release information from API"
341+ handle_error $? " wget -qO $api " " Failed to fetch release information from API"
310342 }
311343 ;;
312344 curl)
@@ -357,16 +389,16 @@ download() {
357389 local tool
358390 tool=$( check_download_tools)
359391
360- print_info " Downloading: $url "
392+ print_action " Downloading: $url "
361393 case " $tool " in
362394 wget)
363395 wget -qO " $output " " $url " || {
364396 handle_error $? " wget -qO $output $url " " Failed to download binary"
365397 }
366398 ;;
367399 curl)
368- curl -sL -o " $output " " $url " || {
369- handle_error $? " curl -sL -o $output $url " " Failed to download binary"
400+ curl -fsSL -o " $output " " $url " || {
401+ handle_error $? " curl -fsSL -o $output $url " " Failed to download binary"
370402 }
371403 ;;
372404 esac
@@ -379,13 +411,14 @@ download() {
379411 exit 1
380412 fi
381413}
414+
382415# Main installation
383416main () {
384417 # Check if running on supported distribution
385418 check_supported_distro
386419
387420 print_info " qBittorrent-nox Static Binary Installer"
388- print_info " = ======================================="
421+ print_generic " ======================================="
389422
390423 local arch=" ${FORCE_ARCH:- $(detect_arch)} "
391424 local libtorrent_ver=" ${LIBTORRENT_VERSION:- v2} "
@@ -396,19 +429,23 @@ main() {
396429 print_info " LibTorrent version: $libtorrent_ver "
397430 print_info " Attestation verification: $( check_gh_cli && printf ' %s' " enabled" || printf ' %s' " disabled (gh cli not found)" ) "
398431
432+ # Prepare installation directory
433+ print_action " Creating install directory: $HOME /bin"
434+ mkdir -p " $HOME /bin" || {
435+ handle_error $? " mkdir -p $HOME /bin" " Failed to create installation directory"
436+ }
437+
399438 # Get release and download
400439 local release_tag
401440 release_tag=$( get_release_tag)
402441 local url
403442 url=$( create_download_url " $arch " " $release_tag " )
404443
405- # Create install directory
406- mkdir -p " $HOME /bin" || {
407- handle_error $? " mkdir -p $HOME /bin" " Failed to create installation directory"
408- }
409-
410444 # Download and install binary
411445 download " $url " " $install_path "
446+
447+ # Set executable permissions
448+ print_action " Setting executable permissions for: $install_path "
412449 chmod 755 " $install_path " || {
413450 handle_error $? " chmod 755 $install_path " " Failed to set executable permissions"
414451 }
0 commit comments