This repository has been archived by the owner on May 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
repo_updater.sh
executable file
·69 lines (56 loc) · 1.79 KB
/
repo_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
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
63
64
65
66
67
68
#!/usr/bin/env bash
## Copyright (C) 2022-present Metis Linux || Pwnwriter <info@metislinux.org>
## Everyone is permitted to copy and distribute copies of this file under MIT License
# DIRS
repo=recon
PKGDIR="$(pwd)/${repo}/os/x86_64/"
cleanup() {
cd "$PKGDIR" || { echo "Error: Unable to navigate to $PKGDIR"; exit 1; }
rm -rf recon.db* metis.files*
cd ../ || { echo "Error: Unable to navigate back from $PKGDIR"; exit 1; }
echo -e "[*] Repo cleaned successfully [*]"
}
gitadd() {
git add --all || { echo "Error: Failed to add files to Git"; exit 1; }
read -p "Enter commit message: " commitmsg
git commit -m "$commitmsg" || { echo "Error: Failed to commit changes"; exit 1; }
git push --force || { echo "Error: Failed to push changes"; exit 1; }
echo -e "[*] Added all packages to the repository [*]\n"
}
updaterepo() {
cd "$PKGDIR" || { echo "Error: Unable to navigate to $PKGDIR"; exit 1; }
repo-add -n -R recon.db.tar.gz *.pkg.tar.zst* || { echo "Error: Failed to update repository"; exit 1; }
cd ../ || { echo "Error: Unable to navigate back from $PKGDIR"; exit 1; }
echo -e "[*] Repo updated successfully [*]"
echo -e "\n"
}
usages() {
cat <<- EOF
Usage: $(basename "$0") [-c] [-u] [-g]
Options:
-h Show this help message
-u Update Repo
-g Add files to GitHub repo
-c Clean current repo
To add Metis repo, first create a zst archive of the file and use -c -u -g respectively to add it to the repository.
EOF
}
# Getopts implementation for arguments
if [[ $# -eq 0 ]]; then
usages
exit 1
fi
while getopts 'cugh' option; do
case "$option" in
c)
cleanup ;;
u)
updaterepo ;;
g)
gitadd ;;
h)
usages ;;
?)
exit 1 ;;
esac
done