build_gitea: support adding patches to build

This commit is contained in:
minoplhy 2024-10-28 12:04:16 +07:00
parent 33125f2154
commit 98feebacf6
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF
2 changed files with 45 additions and 11 deletions

View File

@ -4,7 +4,6 @@ DESTINATION=~/gitea-binaries
rm -rf $DESTINATION
mkdir -p $DESTINATION
cd $MAKE_DIR
while [ ${#} -gt 0 ]; do
case "$1" in
@ -39,6 +38,17 @@ while [ ${#} -gt 0 ]; do
;;
esac
;;
--patch=* )
PATCH_FILES="${1#*=}"
case $PATCH_FILES in
"")
echo "ERROR: --patch= is empty!"
exit 1
;;
*)
;;
esac
;; # Add Patches to your Gitea build. Format -> patch1.patch or patch1.patch,patch2.patch (Absolute path)
*)
;;
esac
@ -123,10 +133,23 @@ then
if git show-ref $GITEA_GIT_TAG --quiet; then
git checkout $GITEA_GIT_TAG
else
echo -e "\nGIT_TAG variable doesn't match the repo tag/version. exit to prevent further issue." && exit 1 && rm -rf $MAKE_DIR
echo -e "\GITEA_GIT_TAG variable doesn't match the repo tag/version. exit to prevent further issue." && exit 1
fi
else
echo -e "GIT_TAG variable not found. will build on "main" branch."
echo -e "GITEA_GIT_TAG variable not found. will build on "main" branch."
fi
if [[ -n $PATCH_FILES ]]
then
for patch in $(echo "$PATCH_FILES" | tr ',' '\n'); do
if git apply --check $patch; then
git apply $patch
printf "Info: PATCH '%s' applied successful!\n" $patch
else
printf "Error: PATCH '%s' cannot be applied! exiting...\n" $patch
exit 1
fi
done
fi
# Sometimes VPS Provider's CPU limitation is dick

View File

@ -35,7 +35,7 @@ while [ ${#} -gt 0 ]; do
BUILD_TYPE="${BUILD_TYPE,,}"
case $BUILD_TYPE in
"gitea") BUILD_TYPE="gitea" ;;
"forgejo") BUILD_TYPE="forgejo" ;;
"forgejo") BUILD_TYPE="forgejo" ;;
"")
echo "ERROR : --type= is empty!"
exit 1
@ -46,6 +46,17 @@ while [ ${#} -gt 0 ]; do
;;
esac
;;
--patch=* )
PATCH_FILES="${1#*=}"
case $PATCH_FILES in
"")
echo "ERROR: --patch= is empty!"
exit 1
;;
*)
;;
esac
;; # Add Patches to your Gitea build. Format -> patch1.patch or patch1.patch,patch2.patch (Absolute path)
*)
;;
esac