This commit is contained in:
Daniel Schwager 2012-01-26 00:47:36 +01:00
parent 0705766184
commit ecf2ccb6b6
3 changed files with 39 additions and 31 deletions

View File

@ -10,12 +10,20 @@
yum install ImageMagick
yum install git
# define your local, private, individual, not-project dependent build setup
export BUILD_LOCAL_CFG=/home/dschwager/work/itwatch/build_local.cfg
# Define your local, private, individual, not-project dependent build setup
# in the file ~/.builder.cfg OR by using the environment variable BUILD_LOCAL_CFG
# pointing the the configuration.
# export BUILD_LOCAL_CFG=/home/dschwager/work/itwatch/build_local.cfg
# If no files are availble, the default values will be use.
# Start build
./build.sh
builder.sh <path-to-the-project>
builder.sh /home/dschwager/work/itwatch
# Force downloading vendor files
DIST_FORCE_DOWNLOAD=1 builder.sh /home/dschwager/work/itwatch
# Force upload independent of existing OPSI-Package in repository
OPSI_REPOS_FORCE_UPLOAD=1 builder.sh /home/dschwager/work/itwatch
# Force downloading vendor files
DIST_FORCE_DOWNLOAD=1 ./build.sh

View File

@ -16,31 +16,31 @@ call_entry_point() {
# Read config
####################
# read private build configuration
#test -f "$BUILD_LOCAL_CFG" && . $BUILD_LOCAL_CFG
builder_read_config() {
# Check temp dir
test -d ${TMP_DIR}
builder_check_error "temp directory not available: $TMP_DIR"
# Source product release configuration
test -f ${PRODUCT_DIR}/release.cfg
builder_check_error "can't read release configuration: ${PRODUCT_DIR}/release.cfg"
. $PRODUCT_DIR/release.cfg
test -f ${PRODUCT_DIR}/product.cfg
builder_check_error "can't read release configuration: ${PRODUCT_DIR}/product.cfg"
. $PRODUCT_DIR/product.cfg
# Source product build configuration
test -f ${PRODUCT_DIR}/build.cfg
builder_check_error "can't read release configuration: ${PRODUCT_DIR}/build.cfg"
. $PRODUCT_DIR/build.cfg
# set default build configuration and source the user dependent file
. $BASEDIR/build-default.cfg
# Source local build configuration (must be done AFTER sourcing the release.cfg)
test -f "$BUILD_LOCAL_CFG"
builder_check_error "can't read local buld configuration: $BUILD_LOCAL_CFG"
echo "Using local build configuration: $BUILD_LOCAL_CFG"
. $BUILD_LOCAL_CFG
test -f $HOME/.builder.cfg && . $HOME/.builder.cfg && echo "Loaded builder configuration: $HOME/.builder.cfg"
test -f "$BUILD_LOCAL_CFG" && . $BUILD_LOCAL_CFG && echo "Loaded builder configuration: $BUILD_LOCAL_CFG"
# Check variables
if [ -z ${OPSI_REPOS_BASE_DIR} ] || [ ! -d ${OPSI_REPOS_BASE_DIR} ] ; then
echo "configuration error: OPSI_REPOS_BASE_DIR is empty or does not exist: $OPSI_REPOS_BASE_DIR"
echo "configuration error: OPSI_REPOS_BASE_DIR directory does not exist: $OPSI_REPOS_BASE_DIR"
exit 2
fi
@ -67,8 +67,8 @@ builder_download_dist_files() {
fi
# check existence of CRC file
if [ ! -e ${basename}.sha1sum ] ; then
echo "You need to create the checksums with: sha1sum ${DIST_CACHE_DIR}/${basename} > ${basename}.sha1sum"
if [ ! -e ${PRODUCT_DIR}/${basename}.sha1sum ] ; then
echo "You need to create the checksums with: sha1sum ${DIST_CACHE_DIR}/${basename} > ${PRODUCT_DIR}/${basename}.sha1sum"
exit 1
fi
@ -92,7 +92,7 @@ builder_download_dist_files() {
if [ $? == 0 ] ; then
# testing the checksum of the downloaded files
SHA1SUM=`cat ${basename}.sha1sum | cut -d " " -f1`
SHA1SUM=`cat ${PRODUCT_DIR}/${basename}.sha1sum | cut -d " " -f1`
CHECKSUM=`sha1sum ${DIST_CACHE_DIR}/$basename | cut -d " " -f1`
if [ "$CHECKSUM" == "$SHA1SUM" ] ; then
downloaded=1
@ -125,13 +125,13 @@ builder_package() {
# Copy files and convert text files to dos format
mkdir $OUT/$PN
cp -Rv OPSI CLIENT_DATA $OUT/$PN
cp -Rv ${PRODUCT_DIR}/OPSI ${PRODUCT_DIR}/CLIENT_DATA $OUT/$PN
find $OUT/$PN/CLIENT_DATA -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep "text/plain" && dos2unix $0' REP
# copy binaries
for f1 in $FILE1 $FILE2 ; do
basename=`echo $f1 | cut -d ";" -f1`
echo cp ${DIST_CACHE_DIR}/$basename $OUT/$PN/CLIENT_DATA
cp ${DIST_CACHE_DIR}/$basename $OUT/$PN/CLIENT_DATA
done
# converting icon file
@ -146,7 +146,7 @@ builder_package() {
sed -e "s!X86FILE!$X86FILE!g" -i $OUT/$PN/CLIENT_DATA/setup32.ins
# Create changelog based on git - if available
if test -d ".git"; then
if test -d "${PRODUCT_DIR}/.git"; then
git log --date-order --date=short | \
sed -e '/^commit.*$/d' | \
awk '/^Author/ {sub(/\\$/,""); getline t; print $0 t; next}; 1' | \
@ -158,7 +158,6 @@ builder_package() {
fi
# building package
echo tempdir: $TMP_DIR
pushd ${TMP_DIR}
rm -f ${PN}_${VERSION}-${RELEASE}.opsi
opsi-makeproductfile -v $OUT/$PN

View File

@ -15,9 +15,11 @@ builder_main() {
call_entry_point builder_read_config_post
# Check if the package is still build
test ! -f ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN}
builder_check_error "package ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} already generated"
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
@ -44,16 +46,15 @@ PRG=$(readlink -f $0)
BASEDIR=`dirname "$PRG"`
BASEDIR=`cd "$BASEDIR" && pwd`
# read private build configuration
. $BUILD_LOCAL_CFG
# read libraries
. $BASEDIR/builder-lib.sh
# get target directory
# 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