build_gitea: support adding patches to build
This commit is contained in:
parent
33125f2154
commit
98feebacf6
@ -4,7 +4,6 @@ DESTINATION=~/gitea-binaries
|
|||||||
|
|
||||||
rm -rf $DESTINATION
|
rm -rf $DESTINATION
|
||||||
mkdir -p $DESTINATION
|
mkdir -p $DESTINATION
|
||||||
cd $MAKE_DIR
|
|
||||||
|
|
||||||
while [ ${#} -gt 0 ]; do
|
while [ ${#} -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -39,6 +38,17 @@ while [ ${#} -gt 0 ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
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
|
esac
|
||||||
@ -123,10 +133,23 @@ then
|
|||||||
if git show-ref $GITEA_GIT_TAG --quiet; then
|
if git show-ref $GITEA_GIT_TAG --quiet; then
|
||||||
git checkout $GITEA_GIT_TAG
|
git checkout $GITEA_GIT_TAG
|
||||||
else
|
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
|
fi
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
# Sometimes VPS Provider's CPU limitation is dick
|
# Sometimes VPS Provider's CPU limitation is dick
|
||||||
|
@ -15,27 +15,27 @@ curl -L https://github.com/minoplhy/scriptbox/raw/main/build_gitea/Linux/build.s
|
|||||||
```bash
|
```bash
|
||||||
while [ ${#} -gt 0 ]; do
|
while [ ${#} -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--git-tag | -v)
|
--git-tag | -v)
|
||||||
shift
|
shift
|
||||||
GITEA_GIT_TAG=$1
|
GITEA_GIT_TAG=$1
|
||||||
;; # Gitea Git Tag
|
;; # Gitea Git Tag
|
||||||
--golang-version | -g)
|
--golang-version | -g)
|
||||||
shift
|
shift
|
||||||
GO_VERSION=$1
|
GO_VERSION=$1
|
||||||
;; # GOLANG Version
|
;; # GOLANG Version
|
||||||
--nodejs-version | -n)
|
--nodejs-version | -n)
|
||||||
shift
|
shift
|
||||||
NODEJS_VERSION=$1
|
NODEJS_VERSION=$1
|
||||||
;; # NodeJS Version
|
;; # NodeJS Version
|
||||||
--static | -s)
|
--static | -s)
|
||||||
BUILD_STATIC=true
|
BUILD_STATIC=true
|
||||||
;; # Also Build Static Assets file
|
;; # Also Build Static Assets file
|
||||||
--type=* )
|
--type=* )
|
||||||
BUILD_TYPE="${1#*=}"
|
BUILD_TYPE="${1#*=}"
|
||||||
BUILD_TYPE="${BUILD_TYPE,,}"
|
BUILD_TYPE="${BUILD_TYPE,,}"
|
||||||
case $BUILD_TYPE in
|
case $BUILD_TYPE in
|
||||||
"gitea") BUILD_TYPE="gitea" ;;
|
"gitea") BUILD_TYPE="gitea" ;;
|
||||||
"forgejo") BUILD_TYPE="forgejo" ;;
|
"forgejo") BUILD_TYPE="forgejo" ;;
|
||||||
"")
|
"")
|
||||||
echo "ERROR : --type= is empty!"
|
echo "ERROR : --type= is empty!"
|
||||||
exit 1
|
exit 1
|
||||||
@ -46,6 +46,17 @@ while [ ${#} -gt 0 ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
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
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user