itwatch.itwess/builder/builder.sh
2012-01-26 00:47:36 +01:00

68 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#
#
# enabled debug
# set -x
#####################
# Main
####################
builder_main() {
# read config
call_entry_point builder_read_config_pre
builder_read_config
call_entry_point builder_read_config_post
# Check if the package is still build
if [ -z "$OPSI_REPOS_FORCE_UPLOAD" ] && [ -f ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} ] ; then
echo "ERROR: package ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} already generated"
exit 1
fi
# download and process dist files
call_entry_point builder_download_dist_files_pre
builder_download_dist_files
call_entry_point builder_download_dist_files_post
# Start building
call_entry_point builder_package_pre
builder_package
call_entry_point builder_package_post
# Upload to repos
call_entry_point builder_upload_pre
builder_upload
call_entry_point builder_upload_post
# git commit
call_entry_point builder_commit_pre
builder_commit
call_entry_point builder_commit_post
}
# get the 'real' directory this program stored in (resolve symbolic links)
PRG=$(readlink -f $0)
BASEDIR=`dirname "$PRG"`
BASEDIR=`cd "$BASEDIR" && pwd`
# read libraries
. $BASEDIR/builder-lib.sh
# check product directory
PRODUCT_DIR=$1
test -d $PRODUCT_DIR
builder_check_error "no opsi product directory specified: $PRODUCT_DIR"
# source additional, product dependent methods
if [ -f "$PRODUCT_DIR/build-extension.sh" ] ; then
. "$PRODUCT_DIR/build-extension.sh"
fi
# call main
builder_main
# exit
exit 0