From 580d4da129bbe2ed6aa4d044b5949baa8399d79b Mon Sep 17 00:00:00 2001 From: Edmund Tan Date: Tue, 22 Jul 2025 23:59:31 +0800 Subject: [PATCH] fixed script new5 --- UI/includes/enrollment.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/UI/includes/enrollment.php b/UI/includes/enrollment.php index 9c2ea93..a993485 100644 --- a/UI/includes/enrollment.php +++ b/UI/includes/enrollment.php @@ -532,12 +532,19 @@ EOF; * Add OpenZiti GPG key with enhanced error handling for PHP execution environment */ private function addOpenZitiGpgKey() { - $this->reportProgress('INSTALL', 'Downloading OpenZiti GPG key...'); - - // Method 1: Try the original piped command with enhanced environment $gpgKeyUrl = 'https://get.openziti.io/tun/package-repos.gpg'; $gpgKeyPath = '/usr/share/keyrings/openziti.gpg'; + // First, check if GPG key already exists and is valid + if (file_exists($gpgKeyPath) && filesize($gpgKeyPath) > 0) { + $this->reportProgress('INSTALL', 'OpenZiti GPG key already exists (' . filesize($gpgKeyPath) . ' bytes), skipping installation'); + logMessage('INFO', 'GPG key already exists at: ' . $gpgKeyPath); + return true; + } + + $this->reportProgress('INSTALL', 'Downloading OpenZiti GPG key...'); + + // Method 1: Try the original piped command with enhanced environment // First, try the enhanced piped command with explicit environment $envCommand = 'export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" && export HOME="/root" && export GNUPGHOME="/root/.gnupg"'; $gpgCommand = $envCommand . ' && curl -sSLf ' . $gpgKeyUrl . ' | gpg --dearmor --output ' . $gpgKeyPath;