-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupdater.sh
executable file
·36 lines (33 loc) · 931 Bytes
/
updater.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
REPO_URL="https://github.com/Burhanverse/Tunified.git"
# Function
update_repo() {
echo "Repository already exists. Updating..."
git pull --recurse-submodules --ff-only || {
echo "Pull failed. Forcing reset..."
git fetch --all
git reset --hard origin/main
git submodule update --init --recursive
}
echo "Repository updated successfully!"
}
# Check
if [ -d ".git" ]; then
# Verify
CURRENT_URL=$(git config --get remote.origin.url)
if [ "$CURRENT_URL" == "$REPO_URL" ]; then
update_repo
else
echo "Error: The current directory is a Git repository, but not for $REPO_URL."
exit 1
fi
else
# Clone
echo "Cloning repository..."
git clone --recurse-submodules $REPO_URL .
if [ $? -ne 0 ]; then
echo "Error: Failed to clone the repository."
exit 1
fi
echo "Repository cloned successfully!"
fi