From 12cc48bb6a6db11b5d79195105800a3ba96db6a4 Mon Sep 17 00:00:00 2001 From: master3395 Date: Mon, 26 Jan 2026 21:14:59 +0100 Subject: [PATCH] Fix permission denied error - use absolute path and exec for cyberpanel.sh - Use absolute path (/tmp/cyberpanel-96375.sh) instead of relative path - Use exec instead of ./ to execute the script - Ensures proper permissions and execution in process substitution context - Clean up script file after execution --- install.sh | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/install.sh b/install.sh index 0ddc603cc..96ff30cd5 100644 --- a/install.sh +++ b/install.sh @@ -101,31 +101,34 @@ check_disk_space # Download and execute cyberpanel.sh for the specified branch echo "Downloading CyberPanel installer for branch: $BRANCH_NAME" -rm -f cyberpanel.sh -rm -f install.tar.gz + +# Use absolute path for downloaded script +SCRIPT_PATH="/tmp/cyberpanel-$$.sh" +rm -f "$SCRIPT_PATH" cyberpanel.sh install.tar.gz # For v2.5.5-dev, try to get the cyberpanel.sh from the branch if [ "$BRANCH_NAME" = "v2.5.5-dev" ] || [ "$BRANCH_NAME" = "stable" ]; then # Try to download from the branch-specific URL - if curl --silent -o cyberpanel.sh "https://raw.githubusercontent.com/master3395/cyberpanel/$BRANCH_NAME/cyberpanel.sh" 2>/dev/null; then - if [ -f cyberpanel.sh ] && [ -s cyberpanel.sh ]; then - chmod +x cyberpanel.sh + if curl --silent -o "$SCRIPT_PATH" "https://raw.githubusercontent.com/master3395/cyberpanel/$BRANCH_NAME/cyberpanel.sh" 2>/dev/null; then + if [ -f "$SCRIPT_PATH" ] && [ -s "$SCRIPT_PATH" ]; then + chmod +x "$SCRIPT_PATH" echo "✅ Downloaded cyberpanel.sh from branch $BRANCH_NAME" - ./cyberpanel.sh "$@" - exit $? + exec "$SCRIPT_PATH" "$@" fi fi fi # Fallback to standard cyberpanel.sh download -curl --silent -o cyberpanel.sh "https://cyberpanel.sh/?dl&$SERVER_OS" 2>/dev/null || \ -wget -q -O cyberpanel.sh "https://cyberpanel.sh/?dl&$SERVER_OS" 2>/dev/null - -if [ -f cyberpanel.sh ] && [ -s cyberpanel.sh ]; then - chmod +x cyberpanel.sh - ./cyberpanel.sh "$@" -else - echo "❌ Failed to download cyberpanel.sh" - echo "Please check your internet connection and try again" - exit 1 +if curl --silent -o "$SCRIPT_PATH" "https://cyberpanel.sh/?dl&$SERVER_OS" 2>/dev/null || \ + wget -q -O "$SCRIPT_PATH" "https://cyberpanel.sh/?dl&$SERVER_OS" 2>/dev/null; then + if [ -f "$SCRIPT_PATH" ] && [ -s "$SCRIPT_PATH" ]; then + chmod +x "$SCRIPT_PATH" + echo "✅ Downloaded cyberpanel.sh from standard source" + exec "$SCRIPT_PATH" "$@" + fi fi + +# If we get here, download failed +echo "❌ Failed to download cyberpanel.sh" +echo "Please check your internet connection and try again" +exit 1