File tree Expand file tree Collapse file tree 3 files changed +48
-3
lines changed
Expand file tree Collapse file tree 3 files changed +48
-3
lines changed Original file line number Diff line number Diff line change 627627 then
628628 if ! curl -sfL " $1 " /" $2 " -o " $3 " /" $2 "
629629 then
630+ # Try Statically.io CDN if this is a GitHub URL
631+ if [[ " $1 " == * " raw.githubusercontent.com" * ]]
632+ then
633+ local cdn_url=" ${1/ raw.githubusercontent.com/ cdn.statically.io\/ gh} "
634+ cdn_url=" ${cdn_url// \/ nextcloud\/ vm\/ / \/ nextcloud\/ vm\/ main\/ } "
635+ if curl -sfL " $cdn_url " /" $2 " -o " $3 " /" $2 "
636+ then
637+ return 0
638+ fi
639+ fi
630640 # Try local backup
631641 try_local_backup " $1 " " $2 " " $3 "
632642 fi
636646 do
637647 if [ " $retries " -ge 10 ]
638648 then
649+ # Try Statically.io CDN if this is a GitHub URL
650+ if [[ " $1 " == * " raw.githubusercontent.com" * ]]
651+ then
652+ local cdn_url=" ${1/ raw.githubusercontent.com/ cdn.statically.io\/ gh} "
653+ cdn_url=" ${cdn_url// \/ nextcloud\/ vm\/ / \/ nextcloud\/ vm\/ main\/ } "
654+ if curl -sfL " $cdn_url " /" $2 " -o " $3 " /" $2 "
655+ then
656+ print_text_in_color " $IGreen " " ✓ Used Statically.io CDN"
657+ break
658+ fi
659+ fi
639660 # Exhausted retries, try local backup
640661 if try_local_backup " $1 " " $2 " " $3 "
641662 then
Original file line number Diff line number Diff line change 1111true
1212SCRIPT_NAME=" Nextcloud Update Script"
1313# shellcheck source=lib.sh
14- source <( curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
14+ if ! source <( curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
15+ then
16+ # Try Statically.io CDN
17+ if source <( curl -sL https://cdn.statically.io/gh/nextcloud/vm/main/lib.sh)
18+ then
19+ echo " ✓ Used Statically.io CDN"
20+ # Try local backup
21+ elif [ -f /var/scripts/vm-repo-backup/lib.sh ]
22+ then
23+ echo " ⚠ GitHub unavailable, using local backup: lib.sh"
24+ # shellcheck source=lib.sh
25+ source /var/scripts/vm-repo-backup/lib.sh
26+ else
27+ echo " Failed to download lib.sh from all sources. Exiting."
28+ exit 1
29+ fi
30+ fi
1531
1632# Get all needed variables from the library
1733ncdb
Original file line number Diff line number Diff line change @@ -22,8 +22,12 @@ if ! [ -f /var/scripts/lib.sh ]
2222then
2323 if ! curl -sfL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh -o /var/scripts/lib.sh
2424 then
25+ # Try Statically.io CDN
26+ if curl -sfL https://cdn.statically.io/gh/nextcloud/vm/main/lib.sh -o /var/scripts/lib.sh
27+ then
28+ print_text_in_color " $IGreen " " ✓ Used Statically.io CDN"
2529 # Try local backup
26- if [ -f /var/scripts/vm-repo-backup/lib.sh ]
30+ elif [ -f /var/scripts/vm-repo-backup/lib.sh ]
2731 then
2832 print_text_in_color " $IYellow " " ⚠ GitHub unavailable, using local backup: lib.sh"
2933 cp /var/scripts/vm-repo-backup/lib.sh /var/scripts/lib.sh
@@ -37,8 +41,12 @@ elif ! [ -f /var/scripts/nextcloud-startup-script.sh ]
3741then
3842 if ! curl -sfL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh -o /var/scripts/lib.sh
3943 then
44+ # Try Statically.io CDN
45+ if curl -sfL https://cdn.statically.io/gh/nextcloud/vm/main/lib.sh -o /var/scripts/lib.sh
46+ then
47+ print_text_in_color " $IGreen " " ✓ Used Statically.io CDN"
4048 # Try local backup
41- if [ -f /var/scripts/vm-repo-backup/lib.sh ]
49+ elif [ -f /var/scripts/vm-repo-backup/lib.sh ]
4250 then
4351 print_text_in_color " $IYellow " " ⚠ GitHub unavailable, using local backup: lib.sh"
4452 cp /var/scripts/vm-repo-backup/lib.sh /var/scripts/lib.sh
You can’t perform that action at this time.
0 commit comments