diff --git a/build_gitea/Linux/build.sh b/build_gitea/Linux/build.sh index 8c774c7..08b4bb4 100644 --- a/build_gitea/Linux/build.sh +++ b/build_gitea/Linux/build.sh @@ -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 diff --git a/build_gitea/README.md b/build_gitea/README.md index 9724114..1341fbf 100644 --- a/build_gitea/README.md +++ b/build_gitea/README.md @@ -15,27 +15,27 @@ curl -L https://github.com/minoplhy/scriptbox/raw/main/build_gitea/Linux/build.s ```bash while [ ${#} -gt 0 ]; do case "$1" in - --git-tag | -v) + --git-tag | -v) shift GITEA_GIT_TAG=$1 ;; # Gitea Git Tag - --golang-version | -g) + --golang-version | -g) shift - GO_VERSION=$1 + GO_VERSION=$1 ;; # GOLANG Version - --nodejs-version | -n) + --nodejs-version | -n) shift - NODEJS_VERSION=$1 + NODEJS_VERSION=$1 ;; # NodeJS Version - --static | -s) - BUILD_STATIC=true + --static | -s) + BUILD_STATIC=true ;; # Also Build Static Assets file --type=* ) BUILD_TYPE="${1#*=}" 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