diff options
Diffstat (limited to 'build')
| -rwxr-xr-x | build | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -23,8 +23,9 @@ usage() { echo -e "Usage:" echo -e " $ build --list-platforms" echo -e " $ build --list-actions <platform>" - echo -e " $ build [-b/--web-branch <web_branch>] <platform> <action>" + echo -e " $ build [-k/--keep-artifacts] [-b/--web-branch <web_branch>] <platform> <action>" echo -e "" + echo -e "The 'keep-artifacts' option preserves build artifacts, e.g. Docker images for system package builds." echo -e "The web_branch defaults to the same branch name as the current main branch." echo -e "To build all platforms, use 'all'." echo -e "To perform all build actions, use 'all'." @@ -67,6 +68,14 @@ if [[ $1 == '--list-actions' ]]; then exit 0 fi +# Parse keep-artifacts option +if [[ $1 == '-k' || $1 == '--keep-artifacts' ]]; then + keep_artifacts="y" + shift 1 +else + keep_artifacts="n" +fi + # Parse branch option if [[ $1 == '-b' || $1 == '--web-branch' ]]; then web_branch="$2" @@ -193,6 +202,13 @@ for target_platform in ${platform[@]}; do echo -e "> Processing platform ${target_platform}" date_start=$( date +%s ) pushd ${target_platform} + cleanup() { + echo -e ">> Processing action clean" + if [[ -f clean.sh && -x clean.sh ]]; then + ./clean.sh ${keep_artifacts} + fi + } + trap cleanup EXIT INT for target_action in ${action[@]}; do echo -e ">> Processing action ${target_action}" if [[ -f ${target_action}.sh && -x ${target_action}.sh ]]; then @@ -204,12 +220,8 @@ for target_platform in ${platform[@]}; do target_dir="../../../jellyfin-build/${target_platform}" mkdir -p ${target_dir} mv pkg-dist/* ${target_dir}/ - - echo -e ">> Processing action clean" - if [[ -f clean.sh && -x clean.sh ]]; then - ./clean.sh - fi fi + cleanup date_end=$( date +%s ) echo -e "> Completed platform ${target_platform} in $( expr ${date_end} - ${date_start} ) seconds." popd |
