Skip to content

Commit

Permalink
create "-git" package version log after build & update
Browse files Browse the repository at this point in the history
avoid creating a log after the second run only and do it directly after build or update of a git package, this allows immediate updates if autogit hasn't been run since the last git commit.
  • Loading branch information
puxplaying authored Sep 3, 2021
1 parent 3c91bb0 commit 8da4d3c
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions autogit
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,27 @@ function maincheck() {
fi
fi
fi
# Check if it's a Git Package to create a log for updating
cd "$DIR/packages/$GITDIR/$p"
gitfile=.gitcheck
gitcheck="$(echo "$p" | tee "$gitfile")"
if [[ -n "$gitcheck" ]]; then
if grep -E *'-git' "$gitfile" &>/dev/null; then # If result matches (Name has a -git string)
gitpkgname="$(cat PKGBUILD | grep 'source=' | awk -F"/" '{print $NF}' | cut -f1 -d".")"
cd "$gitpkgname"

# Create a gitlog to check for updates
gitversionfile=.gitversioncheck
gitversioncheck="$(git show | head -1 | tee "$gitversionfile")"
# Generate a gitcheck file for a update reference
if [[ -n "$gitversioncheck" ]]; then
cd ..
rm -rf "$gitfile" &>/dev/null
echo -e "\e[2m[Git-Version Updated]\e[0m"
return 1
fi
fi
fi
else
echo "Package does not exist local, downloading ..."
mkdir -p "$DIR/packages/$GITDIR/$p" && cd "$DIR/packages/$GITDIR/$p"
Expand Down Expand Up @@ -275,6 +296,27 @@ function maincheck() {
fi
fi
fi
# Check if it's a Git Package to create a log for updating
cd "$DIR/packages/$GITDIR/$p"
gitfile=.gitcheck
gitcheck="$(echo "$p" | tee "$gitfile")"
if [[ -n "$gitcheck" ]]; then
if grep -E *'-git' "$gitfile" &>/dev/null; then # If result matches (Name has a -git string)
gitpkgname="$(cat PKGBUILD | grep 'source=' | awk -F"/" '{print $NF}' | cut -f1 -d".")"
cd "$gitpkgname"

# Create a gitlog to check for updates
gitversionfile=.gitversioncheck
gitversioncheck="$(git show | head -1 | tee "$gitversionfile")"
# Generate a gitcheck file for a update reference
if [[ -n "$gitversioncheck" ]]; then
cd ..
rm -rf "$gitfile" &>/dev/null
echo -e "\e[2m[Git-Version]\e[0m"
return 1
fi
fi
fi
fi
}
#
Expand Down

0 comments on commit 8da4d3c

Please sign in to comment.