update build script, add --no-upload to build.sh
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
leafee98 2023-12-13 16:50:09 +08:00
parent 0345418039
commit f6e18a796d
3 changed files with 18 additions and 15 deletions

View file

@ -18,7 +18,7 @@ steps:
--package-arch amd64 --package-arch amd64
--apt-base $APT_BASE --apt-base $APT_BASE
" "
--upload-to-webdav "$WEBDAV_UPLOAD_TARGET" --webdav-url "$WEBDAV_UPLOAD_TARGET"
--webdav-user "$WEBDAV_USER" --webdav-user "$WEBDAV_USER"
--webdav-pass "$WEBDAV_PASS" --webdav-pass "$WEBDAV_PASS"
--package-dir packages/bin --package-dir packages/bin

View file

@ -14,16 +14,17 @@ function msg_warn {
function usage { function usage {
echo "$_PROGRAM_NAME:" echo "$_PROGRAM_NAME:"
echo " --package <dir-name> add a dir to build, can use multi times" echo " --package <dir-name> Add a dir to build, can be used multi times"
echo " --package-dir <dir> all dir in this directory is a package," echo " --package-dir <dir> All dir in this directory is a package,"
echo " can use multi times" echo " can use multi times"
echo " --makedeb-path <path> specify the path of makedeb" echo " --makedeb-path <path> Specify the path of makedeb"
echo " --upload-to-webdav https://webdav_host/path/dir" echo " --no-upload Don't upload built packages to webdav"
echo " upload built file to a webdav server" echo " --webdav-url https://webdav_host/path/dir"
echo " --webdav-user <username> username of webdav server (if required)" echo " Upload built file to a webdav server"
echo " --webdav-pass <password> password of webdav server (if required)" echo " --webdav-user <username> Username of webdav server (if required)"
echo " --webdav-pass <password> Password of webdav server (if required)"
echo ' --package-exists-hook "/path/to/hook --args {}"' echo ' --package-exists-hook "/path/to/hook --args {}"'
echo " this program will run the hook to check" echo " This program will run the hook to check"
echo " if specific file already built, the {} will" echo " if specific file already built, the {} will"
echo " be replaced with the final package name," echo " be replaced with the final package name,"
echo " exit with 0 means package exists" echo " exit with 0 means package exists"
@ -68,7 +69,8 @@ _DELIMITER="================================================================"
_PROGRAM_NAME="$0" _PROGRAM_NAME="$0"
_PACKGES_TO_BUILD=() _PACKGES_TO_BUILD=()
MAKEDEB_PATH="" MAKEDEB_PATH=""
UPLOAD_TO_WEBDAV="" UPLOAD_TO_WEBDAV=1
WEBDAV_URL=""
WEBDAV_USER="" WEBDAV_USER=""
WEBDAV_PASS="" WEBDAV_PASS=""
PACKAGE_DIR=() PACKAGE_DIR=()
@ -80,7 +82,8 @@ while (( "$#" >= 1 )); do
--package) _PACKGES_TO_BUILD+=("$2") ; shift ;; --package) _PACKGES_TO_BUILD+=("$2") ; shift ;;
--package-dir) PACKAGE_DIR+=("$2") ; shift ;; --package-dir) PACKAGE_DIR+=("$2") ; shift ;;
--makedeb-path) MAKEDEB_PATH="$2" ; shift ;; --makedeb-path) MAKEDEB_PATH="$2" ; shift ;;
--upload-to-webdav) UPLOAD_TO_WEBDAV="$2" ; shift ;; --no-upload) UPLOAD_TO_WEBDAV=0 ;;
--webdav-url) WEBDAV_URL="$2" ; shift ;;
--webdav-user) WEBDAV_USER="$2" ; shift ;; --webdav-user) WEBDAV_USER="$2" ; shift ;;
--webdav-pass) WEBDAV_PASS="$2" ; shift ;; --webdav-pass) WEBDAV_PASS="$2" ; shift ;;
--package-exists-hook) --package-exists-hook)
@ -182,9 +185,9 @@ for package in "${_PACKGES_TO_BUILD[@]}" ; do
exit 4 exit 4
fi fi
if [[ -n "${UPLOAD_TO_WEBDAV}" ]] ; then if [[ -n "${WEBDAV_URL}" ]] && (( UPLOAD_TO_WEBDAV )) ; then
msg_info "Uploading $package_name to $UPLOAD_TO_WEBDAV" msg_info "Uploading $package_name to $WEBDAV_URL"
upload_to_webdav "$package_name" "$UPLOAD_TO_WEBDAV" "$WEBDAV_USER" "$WEBDAV_PASS" upload_to_webdav "$package_name" "$WEBDAV_URL" "$WEBDAV_USER" "$WEBDAV_PASS"
fi fi
) || true ) || true

View file

@ -18,7 +18,7 @@ APT_BASE=https://dufs.leafee98.com/apt
--package-dir packages/normal \ --package-dir packages/normal \
-- \ -- \
-f -f
# --upload-to-webdav "$WEBDAV_UPLOAD_TARGET" \ # --webdav-url "$WEBDAV_UPLOAD_TARGET" \
# --webdav-user "$WEBDAV_USER" \ # --webdav-user "$WEBDAV_USER" \
# --webdav-pass "$WEBDAV_PASS" \ # --webdav-pass "$WEBDAV_PASS" \