itwatch.itwess/builder/builder.sh

68 lines
1.5 KiB
Bash
Raw Normal View History

2012-01-25 23:09:39 +01:00
#!/bin/bash
2012-01-25 23:23:38 +01:00
#
#
# enabled debug
# set -x
2012-01-25 23:09:39 +01:00
#####################
# Main
####################
2012-01-25 23:23:38 +01:00
builder_main() {
2012-01-25 23:09:39 +01:00
# 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
2012-01-26 00:47:36 +01:00
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
2012-01-25 23:09:39 +01:00
# 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
}
2012-01-25 23:23:38 +01:00
# get the 'real' directory this program stored in (resolve symbolic links)
PRG=$(readlink -f $0)
BASEDIR=`dirname "$PRG"`
BASEDIR=`cd "$BASEDIR" && pwd`
2012-01-25 23:09:39 +01:00
2012-01-26 00:47:36 +01:00
# read libraries
2012-01-25 23:23:38 +01:00
. $BASEDIR/builder-lib.sh
2012-01-25 23:09:39 +01:00
2012-01-26 00:47:36 +01:00
# check product directory
2012-01-25 23:09:39 +01:00
PRODUCT_DIR=$1
2012-01-25 23:23:38 +01:00
test -d $PRODUCT_DIR
builder_check_error "no opsi product directory specified: $PRODUCT_DIR"
2012-01-26 00:47:36 +01:00
# source additional, product dependent methods
2012-01-25 23:23:38 +01:00
if [ -f "$PRODUCT_DIR/build-extension.sh" ] ; then
2012-01-25 23:09:39 +01:00
. "$PRODUCT_DIR/build-extension.sh"
fi
2012-01-25 23:23:38 +01:00
# call main
2012-01-25 23:09:39 +01:00
builder_main
2012-01-25 23:23:38 +01:00
# exit
2012-01-25 23:09:39 +01:00
exit 0