123456789101112131415161718192021222324252627282930313233343536373839 |
- #!/bin/bash
- set -e
- PROJECT_PATH=$(cd `dirname $0`; pwd)
- APP_NAME="${PROJECT_PATH##*/}"
- VERSION=`cat VERSION`
- make version=$VERSION
- SPEC_FILE=app.spec
- APP_SERVICE=conf/app.service
- SH_APP=sh/app
- TOOLS_ROOT=`pwd`
- BUILD="${TOOLS_ROOT}/build"
- sed -e "s/%APP_NAME%/$APP_NAME/g" ${APP_SERVICE}.in > conf/${APP_NAME}.service
- sed -e "s/%APP_NAME%/$APP_NAME/g" ${SH_APP}.in > ${SH_APP}
- mkdir -p $BUILD/buildroot/{BUILD,RPMS,S{RPMS,PECS,OURCES}}
- rm -f $BUILD/buildroot/SOURCES/*.tgz
- set +e
- tar -zc --warning=no-file-changed -f $BUILD/buildroot/SOURCES/${APP_NAME}-$VERSION.tgz * .[!.]*
- exitcode=$?
- if [ "$exitcode" != "1" ] && [ "$exitcode" != "0" ]; then
- exit $exitcode
- fi
- set -e
- sed -e "s/%VERSION%/$VERSION/g" ${SPEC_FILE}.in > ${SPEC_FILE}
- sed -i "s/%APP_NAME%/$APP_NAME/g" ${SPEC_FILE}
- sed -i "s/%$APP_NAME%/$APP_NAME/g" ${SPEC_FILE}
- rpmbuild -bb ${SPEC_FILE} --define "_topdir $BUILD/buildroot/"
- rm -rf ./dist
- mkdir ./dist
- cp -rf $BUILD/buildroot/RPMS/* ./dist
- rm -rf $BUILD
|