Skip to content

Commit

Permalink
sh
Browse files Browse the repository at this point in the history
  • Loading branch information
linkchw committed Aug 15, 2024
1 parent 8b2efea commit 65976da
Showing 1 changed file with 2 additions and 41 deletions.
43 changes: 2 additions & 41 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
#!/bin/bash

REPO_DIR="$(pwd)/name-family"

check_if_in_repo() {
local current_dir_name=$(basename "$(pwd)")
local current_dir_path=$(pwd)

if [ "$current_dir_name" == "name-family" ] || [ "$current_dir_path" == "$REPO_DIR" ]; then
return 0
else
return 1
fi
}

check_repo_exists() {
[ -d "$REPO_DIR" ]
}

navigate_to_repo() {
cd "$REPO_DIR" || { echo "Failed to change directory to '$REPO_DIR'."; exit 1; }
}

if check_if_in_repo; then
echo "Already in the repository directory. Pulling latest changes..."
else
if check_repo_exists; then
echo "Repository directory '$REPO_DIR' exists. Changing to the directory..."
navigate_to_repo
else
echo "Cloning the repository..."
git clone https://github.com/viraweb123/name-family.git

if [ $? -ne 0 ]; then
echo "Failed to clone repository."
exit 1
fi

navigate_to_repo
fi

git pull
fi
echo "Updating the Repository"
git pull

echo "Setting permissions for 'train/' directory..."
chmod 777 train/
Expand Down

0 comments on commit 65976da

Please sign in to comment.