Fix cyberpanel_installer.sh execution permission issues

- Use bash to execute cyberpanel_installer.sh instead of relying on execute bit
- Verify file exists before execution
- Use absolute path to ensure correct file location
- Improve chmod error handling with verification
- Fixes 'Permission denied' error when cyberpanel.sh tries to execute installer
This commit is contained in:
master3395
2026-01-26 21:27:16 +01:00
parent a71c91b99a
commit 4f323d7a8d

View File

@@ -628,7 +628,11 @@ install_cyberpanel_direct() {
return 1
fi
chmod +x cyberpanel_installer.sh
# Make script executable and verify
chmod 755 cyberpanel_installer.sh 2>/dev/null || true
if [ ! -x "cyberpanel_installer.sh" ]; then
print_status "WARNING: Could not make cyberpanel_installer.sh executable, will use bash to execute"
fi
# Download the install directory
echo "Downloading installation files..."
@@ -696,10 +700,25 @@ install_cyberpanel_direct() {
echo ""
# Run installer and show live output, capturing the password
if [ "$DEBUG_MODE" = true ]; then
./cyberpanel_installer.sh --debug 2>&1 | tee /var/log/CyberPanel/install_output.log
# Use bash to execute to avoid permission issues
local installer_script="cyberpanel_installer.sh"
if [ ! -f "$installer_script" ]; then
print_status "ERROR: cyberpanel_installer.sh not found in current directory: $(pwd)"
return 1
fi
# Get absolute path to installer script
local installer_path
if [[ "$installer_script" = /* ]]; then
installer_path="$installer_script"
else
./cyberpanel_installer.sh 2>&1 | tee /var/log/CyberPanel/install_output.log
installer_path="$(pwd)/$installer_script"
fi
if [ "$DEBUG_MODE" = true ]; then
bash "$installer_path" --debug 2>&1 | tee /var/log/CyberPanel/install_output.log
else
bash "$installer_path" 2>&1 | tee /var/log/CyberPanel/install_output.log
fi
local install_exit_code=${PIPESTATUS[0]}