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
This commit is contained in:
usmannasir 2025-11-09 19:32:22 +05:00
parent 6b999e5c8b
commit 6f5d883c80
1 changed files with 22 additions and 1 deletions

View File

@ -1950,9 +1950,30 @@ Current_Dir="$(pwd)"
rm -f /usr/local/lsws/cyberpanel-tmp rm -f /usr/local/lsws/cyberpanel-tmp
mkdir /usr/local/lsws/cyberpanel-tmp mkdir /usr/local/lsws/cyberpanel-tmp
cd /usr/local/lsws/cyberpanel-tmp || exit 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 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 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 # Install required packages for building PHP extensions
if [[ "$Server_OS" = "Ubuntu" ]] ; then if [[ "$Server_OS" = "Ubuntu" ]] ; then