From 6f5d883c80fbc0ee7a85d4595a53eb8b93f348fb Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 9 Nov 2025 19:32:22 +0500 Subject: [PATCH] Add graceful error handling for timezonedb installation If timezonedb download or extraction fails, log a warning and continue with installation instead of exiting. This prevents installation from failing when the cyberpanel.sh proxy URL returns 403 or other errors. Checks added: - Verify timezonedb.tgz downloaded successfully - Verify tar extraction succeeded - Verify cd to timezonedb directory succeeded - Clean up temp directory and return gracefully on any failure --- cyberpanel.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 17ce2e110..ae962a835 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1950,9 +1950,30 @@ Current_Dir="$(pwd)" rm -f /usr/local/lsws/cyberpanel-tmp mkdir /usr/local/lsws/cyberpanel-tmp cd /usr/local/lsws/cyberpanel-tmp || exit + +# Try to download timezonedb, but continue if it fails wget -O timezonedb.tgz https://cyberpanel.sh/pecl.php.net/get/timezonedb +if [ ! -f timezonedb.tgz ] || [ ! -s timezonedb.tgz ]; then + log_info "WARNING: Failed to download timezonedb, skipping installation" + cd "$Current_Dir" || exit + rm -rf /usr/local/lsws/cyberpanel-tmp + return 0 +fi + tar xzvf timezonedb.tgz -cd timezonedb-* || exit +if [ ! -d timezonedb-* ]; then + log_info "WARNING: Failed to extract timezonedb, skipping installation" + cd "$Current_Dir" || exit + rm -rf /usr/local/lsws/cyberpanel-tmp + return 0 +fi + +cd timezonedb-* || { + log_info "WARNING: Cannot enter timezonedb directory, skipping installation" + cd "$Current_Dir" || exit + rm -rf /usr/local/lsws/cyberpanel-tmp + return 0 +} # Install required packages for building PHP extensions if [[ "$Server_OS" = "Ubuntu" ]] ; then