fixed script new5

This commit is contained in:
Edmund Tan 2025-07-22 23:59:31 +08:00
parent 8837fae1d8
commit 580d4da129
1 changed files with 10 additions and 3 deletions

View File

@ -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;