Skip to content

Commit 6b320ad

Browse files
committed
Update all scripts to use fetch_lib.sh with three-tier fallback
- Modernize 6 scripts still using old direct lib.sh sourcing pattern - fetch_lib.sh was added in Sept 2020, time to standardize - All scripts now benefit from GitHub β†’ CDN β†’ Local backup fallback - nextcloud_install_production.sh uses simplified pattern (no local check)
1 parent 74aa4b2 commit 6b320ad

File tree

6 files changed

+43
-6
lines changed

6 files changed

+43
-6
lines changed

β€Žnetwork/trusted.shβ€Ž

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
true
33
SCRIPT_NAME="Set trusted domain"
44
# shellcheck source=lib.sh
5-
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
5+
if [ -f /var/scripts/fetch_lib.sh ]
6+
then
7+
# shellcheck source=static/fetch_lib.sh
8+
source /var/scripts/fetch_lib.sh
9+
elif ! source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/static/fetch_lib.sh)
10+
then
11+
source <(curl -sL https://cdn.statically.io/gh/nextcloud/vm/main/static/fetch_lib.sh)
12+
fi
613

714
# Removed in NC 26.0.0.
815

β€Žnextcloud_install_production.shβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ SCRIPT_NAME="Nextcloud Install Script"
3939
SCRIPT_EXPLAINER="This script is installing all requirements that are needed for Nextcloud to run.
4040
It's the first of two parts that are necessary to finish your customized Nextcloud installation."
4141
# shellcheck source=lib.sh
42-
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
42+
if ! source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/static/fetch_lib.sh)
43+
then
44+
source <(curl -sL https://cdn.statically.io/gh/nextcloud/vm/main/static/fetch_lib.sh)
45+
fi
4346

4447
# Check for errors + debug code and abort if something isn't right
4548
# 1 = ON

β€Žnot-supported/pi-hole.shβ€Ž

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,13 @@ mkdir -p "$SCRIPTS"
226226
# Insert the new lines into pihole-update.sh
227227
cat << PIHOLE_UPDATE > "$SCRIPTS/pihole-update.sh"
228228
#!/bin/bash
229-
. <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
229+
if [ -f /var/scripts/fetch_lib.sh ]
230+
then
231+
source /var/scripts/fetch_lib.sh
232+
elif ! source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/static/fetch_lib.sh)
233+
then
234+
source <(curl -sL https://cdn.statically.io/gh/nextcloud/vm/main/static/fetch_lib.sh)
235+
fi
230236
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
231237
notify_admin_gui "Starting the Pi-hole update." "You will be notified when it is done."
232238
# Create backup first

β€Žstatic/test_connection.shβ€Ž

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
true
33
SCRIPT_NAME="Test Connection (old)"
44
# shellcheck source=lib.sh
5-
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
5+
if [ -f /var/scripts/fetch_lib.sh ]
6+
then
7+
# shellcheck source=static/fetch_lib.sh
8+
source /var/scripts/fetch_lib.sh
9+
elif ! source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/static/fetch_lib.sh)
10+
then
11+
source <(curl -sL https://cdn.statically.io/gh/nextcloud/vm/main/static/fetch_lib.sh)
12+
fi
613

714
# This is needed since we removed this from the startup script, or changed name so it can't be downloaded anymore
815
msg_box "You are running an outdated release.

β€Žstatic/update.shβ€Ž

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
true
66
SCRIPT_NAME="Update Server + Nextcloud"
77
# shellcheck source=lib.sh
8-
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
8+
if [ -f /var/scripts/fetch_lib.sh ]
9+
then
10+
# shellcheck source=static/fetch_lib.sh
11+
source /var/scripts/fetch_lib.sh
12+
elif ! source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/static/fetch_lib.sh)
13+
then
14+
source <(curl -sL https://cdn.statically.io/gh/nextcloud/vm/main/static/fetch_lib.sh)
15+
fi
916

1017
# Check for errors + debug code and abort if something isn't right
1118
# 1 = ON

β€Žtorrent/create.shβ€Ž

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111

1212
# shellcheck source=lib.sh
1313
# shellcheck disable=SC2046
14-
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
14+
if [ -f /var/scripts/fetch_lib.sh ]
15+
then
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)
21+
fi
1522

1623
# Check for errors + debug code and abort if something isn't right
1724
# 1 = ON

0 commit comments

Comments
Β (0)