ソースを参照

Update easy-install.sh

bug fixing
Samrand Hassan 1 年間 前
コミット
27a3f27356
1 ファイル変更10 行追加6 行削除
  1. 10 6
      easy-install.sh

+ 10 - 6
easy-install.sh

@@ -25,18 +25,22 @@ fi
 REPO_NAME="v2ray-nginx-cloudflare"
 REPO_URL="https://github.com/samrand96/v2ray-nginx-cloudflare.git"
 
-if [ -d "$REPO_NAME" ]; then
-  echo "Repository $REPO_NAME already exists. Skipping cloning."
+# Check if the repository directory exists and is a Git repository
+if [ -d "$REPO_NAME/.git" ]; then
+  echo "Repository '$REPO_NAME' already exists and is a Git repository. Skipping cloning."
 else
-  if ! git clone "$REPO_URL"; then
+  echo "Cloning repository '$REPO_NAME'..."
+  if git clone "$REPO_URL"; then
+    echo "Repository cloned successfully."
+  else
     echo "Failed to clone the repository. Exiting."
     exit 1
   fi
 fi
 
-# Navigate to the repository directory
 cd "$REPO_NAME" || { echo "Failed to navigate to the repository directory. Exiting."; exit 1; }
 
+
 # Generate random UUID
 read -p "Do you want to use a custom UUID? (Y/n): " CUSTOM_UUID
 if [[ "${CUSTOM_UUID:-Y}" =~ ^[Yy]$ ]]; then
@@ -63,7 +67,7 @@ if ! sed -i "s#YOUR_DOMAIN#$DOMAIN#g" ./docker-compose.yml || ! sed -i "s#YOUR_E
 fi
 
 # Compose the Docker setup
-if ! docker-compose up -d; then
+if ! sudo docker-compose up -d; then
   echo "Failed to start Docker containers. Exiting."
   exit 1
 fi
@@ -78,4 +82,4 @@ if [[ "${USE_CDN:-Y}" =~ ^[Yy]$ ]]; then
   fi
 fi
 
-echo "Setup completed successfully."
+echo "Setup completed successfully."