Skip to content

Commit a5ebfe0

Browse files
committed
Use fetch_lib.sh in update script instead of duplicating fallback logic
- Source fetch_lib.sh which handles GitHub β†’ CDN β†’ Local backup - Check for local fetch_lib.sh first before downloading - Add CDN fallback for fetch_lib.sh itself - Cleaner code, no duplication of fallback logic
1 parent 6a627bb commit a5ebfe0

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

β€Žnextcloud_update.shβ€Ž

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,13 @@
1111
true
1212
SCRIPT_NAME="Nextcloud Update Script"
1313
# shellcheck source=lib.sh
14-
if ! source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
14+
if [ -f /var/scripts/fetch_lib.sh ]
1515
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
16+
# shellcheck source=static/fetch_lib.sh
17+
source /var/scripts/fetch_lib.sh
18+
elif ! source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/static/fetch_lib.sh)
19+
then
20+
source <(curl -sL https://cdn.statically.io/gh/nextcloud/vm/main/static/fetch_lib.sh)
3021
fi
3122

3223
# Get all needed variables from the library

0 commit comments

Comments
Β (0)