Skip to content

Commit 74f9e13

Browse files
committed
fix: add fallback for updating certificates
1 parent 414ef93 commit 74f9e13

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

command-ctrl.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,15 @@ update() {
8282
echo "Downloading $UPDATE_URL"
8383
curl -s -f $UPDATE_URL --output $UPDATE_FILE_PATH
8484
RESULT=$?
85-
if test "$RESULT" == "77" && ! test -f /etc/ssl/certs/ca-certificates.crt; then
85+
if ( test "$RESULT" == "60" || test "$RESULT" == "77" ) && ! test -f /etc/ssl/certs/ca-certificates.crt; then
8686
echo "Download failed, attempting to update certs and retry"
87-
update-ca-certificates
87+
if command -v update-ca-certificates &> /dev/null; then
88+
update-ca-certificates
89+
else
90+
opkg update
91+
opkg install ca-certificates
92+
opkg upgrade ca-certificates
93+
fi
8894
curl -s -f $UPDATE_URL --output $UPDATE_FILE_PATH
8995
RESULT=$?
9096
fi

0 commit comments

Comments
 (0)