Adding cleaning function

This commit is contained in:
DarkFeather 2024-04-04 17:04:19 -05:00
parent 0e42f49f1f
commit 5a28cc9b52
Signed by: DarkFeather
GPG Key ID: 1CC1E3F4ED06F296

17
maat
View File

@ -138,6 +138,20 @@ function UpdateLocalRepo() {
set +x set +x
} }
### Clean source tracking
function CleanSrcTracking() {
searchbase="${homedir}/src"
for path in `find "$searchbase" -maxdepth 1 -mindepth 1 -type d`; do
cd "$path"
giturl="$(git config remote.origin.url)"
if ! grep "$giturl" "$aurconf"; then
cd "$searchbase"
rm -Rf "$path"
fi
done
}
# Clear variables # Clear variables
aurconf='/usr/local/etc/Maat/aur.list' aurconf='/usr/local/etc/Maat/aur.list'
baseurl='https://aninix.net/AniNIX' baseurl='https://aninix.net/AniNIX'
@ -210,7 +224,8 @@ SeedWebFile
if [ -n "$MAATTESTINGVAR" ]; then if [ -n "$MAATTESTINGVAR" ]; then
BuildRepo "$baseurl"/HelloWorld BuildRepo "$baseurl"/HelloWorld
else else
for AniNIXrepo in `curl -s "$baseurl" | grep 'class="name"' | cut -f 4 -d \" | sed "s#^#https://$(echo "$baseurl" | cut -f 3 -d /)#" | sed 's/$/.git/'`; do CleanSrcTracking
for AniNIXrepo in `curl -s "$baseurl" | grep 'class="text primary name"' | cut -f 4 -d \" | sed "s#^#https://$(echo "$baseurl" | cut -f 3 -d /)#" | sed 's/$/.git/'`; do
BuildRepo "$AniNIXrepo" '.' BuildRepo "$AniNIXrepo" '.'
done done
fi fi