build_gitea: support custom source folder

This commit is contained in:
minoplhy 2025-05-17 00:16:47 +07:00
parent 8f7be21ee8
commit 6efab71c33
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF
2 changed files with 49 additions and 12 deletions

View File

@ -40,6 +40,17 @@ while [ ${#} -gt 0 ]; do
;; ;;
esac esac
;; ;;
--source-folder=* )
SOURCE_FOLDER="${1#*=}"
case $SOURCE_FOLDER in
"")
echo "ERROR: --source-folder= is empty!"
exit 1
;;
*)
;;
esac
;; # Source folder for your gitea/forgejo build / in case --type does not satisfy you
--patch=* ) --patch=* )
PATCH_FILES="${1#*=}" PATCH_FILES="${1#*=}"
case $PATCH_FILES in case $PATCH_FILES in
@ -75,7 +86,17 @@ done
# If empty # If empty
NODEJS_VERSION=${NODEJS_VERSION:-"v20.17.0"} NODEJS_VERSION=${NODEJS_VERSION:-"v20.17.0"}
GO_VERSION=${GO_VERSION:-"1.23.2"} GO_VERSION=${GO_VERSION:-"1.23.2"}
BUILD_TYPE=${BUILD_TYPE:-"gitea"}
# Source folder get more priority than the --type
if [[ -z $SOURCE_FOLDER ]]; then
BUILD_TYPE=${BUILD_TYPE:-"gitea"}
fi
if [[ -n $SOURCE_FOLDER && ! -d $SOURCE_FOLDER ]]; then
printf "Error: folder '%s' not exist! exiting...\n" $SOURCE_FOLDER
exit 1
fi
DESTINATION=${DESTINATION:-"~/gitea-binaries"} DESTINATION=${DESTINATION:-"~/gitea-binaries"}
# Clean up old build # Clean up old build
@ -177,8 +198,8 @@ fi
# GIT_TAG= # GIT_TAG=
# specify the tag which gitea will build on # specify the tag which gitea will build on
if [[ -z $SOURCE_FOLDER ]]; then
case $BUILD_TYPE in case $BUILD_TYPE in
"gitea") "gitea")
echo "INFO: Building on gitea" echo "INFO: Building on gitea"
git clone https://github.com/go-gitea/gitea $DESTINATION/gitea-repo git clone https://github.com/go-gitea/gitea $DESTINATION/gitea-repo
@ -187,7 +208,12 @@ case $BUILD_TYPE in
echo "INFO: Building on forgejo" echo "INFO: Building on forgejo"
git clone https://codeberg.org/forgejo/forgejo $DESTINATION/gitea-repo #LOL git clone https://codeberg.org/forgejo/forgejo $DESTINATION/gitea-repo #LOL
;; ;;
esac esac
else
echo "INFO: Building on custom source"
echo "INFO: Copying source from original folder"
cp -r $SOURCE_FOLDER $DESTINATION/gitea-repo
fi
cd $DESTINATION/gitea-repo cd $DESTINATION/gitea-repo

View File

@ -53,6 +53,17 @@ while [ ${#} -gt 0 ]; do
;; ;;
esac esac
;; ;;
--source-folder=* )
SOURCE_FOLDER="${1#*=}"
case $SOURCE_FOLDER in
"")
echo "ERROR: --source-folder= is empty!"
exit 1
;;
*)
;;
esac
;; # Source folder for your gitea/forgejo build / in case --type does not satisfy you
--patch=* ) --patch=* )
PATCH_FILES="${1#*=}" PATCH_FILES="${1#*=}"
case $PATCH_FILES in case $PATCH_FILES in