-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate_server.sh
47 lines (39 loc) · 1.29 KB
/
update_server.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
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Function to handle repository operations
update_server() {
local server=$1
local package_name=$PACKAGE_NAME
# Check if the server directory exists
if [ -d "$server" ]; then
print_message1 "Repository '$server' exists"
# Update the repository database
print_message1 "Updating the repository database"
cp -r $destination/* $server/x86_64/
cd $server/x86_64/
./update_repo.sh
# Push to server
print_message1 "Pushing to $server"
cd ..
git add .
# Set the remote URL
git remote set-url origin "[email protected]:tcet-opensource/$server.git"
# Create commit message
if [ "$ans" == "all" ]; then
commit_message="[PKG-UPD] All Packages Are Updated"
elif [ "$ans" == "few" ]; then
commit_message="[PKG-UPD] Few Packages Are Updated"
else
commit_message="[PKG-UPD] $package_name"
fi
# Commit changes
git commit -S -m "$commit_message"
# Attempt to push and check the exit status
if ! git push; then
print_message4 "Git push failed."
perform_cleanup
fi
cd ..
else
print_message3 "Repository '$server' not found."
fi
}