-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-db.sh
More file actions
executable file
·62 lines (50 loc) · 1.68 KB
/
update-db.sh
File metadata and controls
executable file
·62 lines (50 loc) · 1.68 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# update-db.sh - Update the Meowix Linux package database and push changes to Git
# Check if the user is in the same working directory as the script
script_path=$(dirname "$(realpath -s "$0")")
if [ "$(pwd)" != "$script_path" ]; then
echo "Please run the script from the same directory as the script."
exit 1
fi
# Check if the "x86_64" folder exists in the working directory
if [ ! -d "x86_64" ]; then
echo "The 'x86_64' folder does not exist in the working directory."
exit 1
fi
# Delete Meowix-Repo.db and Meowix-Repo.files if they exist in x86_64
if [ -f "x86_64/Meowix-Repo.db" ]; then
rm "x86_64/Meowix-Repo.db"
fi
if [ -f "x86_64/Meowix-Repo.files" ]; then
rm "x86_64/Meowix-Repo.files"
fi
# Change directory to x86_64
cd "x86_64" || exit 1
# Run the command to create Meowix-Repo.db.tar.gz and Meowix-Repo.files.tar.gz
repo-add ./Meowix-Repo.db.tar.gz ./*.pkg.tar.zst
# Delete symlinks Meowix-Repo.db and Meowix-Repo.files
rm Meowix-Repo.db Meowix-Repo.files
# Rename .db.tar.gz and .files.tar.gz to remove .tar.gz suffix
mv Meowix-Repo.db.tar.gz Meowix-Repo.db
mv Meowix-Repo.files.tar.gz Meowix-Repo.files
# Change back to the previous directory
cd - || exit 1
# Show contents of the x86_64 directory
echo "Contents of the x86_64 directory:"
if command -v lsd &>/dev/null; then
lsd x86_64/
else
ls x86_64/
fi
# Offer to push changes to Git
read -r -p "Do you want to push the changes to Git? (yes/no): " choice
if [ "$choice" != "yes" ]; then
echo "Exiting without pushing to Git."
exit 0
fi
# Push changes to Git
git add -A
read -r -p "Enter the commit message: " commit_message
git commit -m "$commit_message"
git push
echo "Update process completed successfully."