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

View File

@ -15,8 +15,10 @@ builder_main() {
call_entry_point builder_read_config_post call_entry_point builder_read_config_post
# Check if the package is still build # Check if the package is still build
test ! -f ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} if [ -z "$OPSI_REPOS_FORCE_UPLOAD" ] && [ -f ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} ] ; then
builder_check_error "package ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} already generated" echo "ERROR: package ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} already generated"
exit 1
fi
# download and process dist files # download and process dist files
call_entry_point builder_download_dist_files_pre call_entry_point builder_download_dist_files_pre
@ -44,16 +46,15 @@ PRG=$(readlink -f $0)
BASEDIR=`dirname "$PRG"` BASEDIR=`dirname "$PRG"`
BASEDIR=`cd "$BASEDIR" && pwd` BASEDIR=`cd "$BASEDIR" && pwd`
# read private build configuration # read libraries
. $BUILD_LOCAL_CFG
. $BASEDIR/builder-lib.sh . $BASEDIR/builder-lib.sh
# get target directory # check product directory
PRODUCT_DIR=$1 PRODUCT_DIR=$1
test -d $PRODUCT_DIR test -d $PRODUCT_DIR
builder_check_error "no opsi product directory specified: $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 if [ -f "$PRODUCT_DIR/build-extension.sh" ] ; then
. "$PRODUCT_DIR/build-extension.sh" . "$PRODUCT_DIR/build-extension.sh"
fi fi