# $Id: smeserver-mock.spec,v 1.2 2018/03/11 05:08:17 jpp Exp $ Summary: smeserver-mock tools for building RPMs %define name smeserver-mock Name: %{name} %define version 1.0 %define release 2 Version: %{version} Release: %{release}%{?dist} License: GPL Group: Networking/Daemons Source: %{name}-%{version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot BuildArchitectures: noarch Requires: e-smith-devtools Requires: mock Requires: python-ctypes Requires: glances Requires: make rpm-build rpm-sign wget Requires: cmake automake libtool Buildrequires: e-smith-devtools # needed for scl Requires: scl-utils scl-utils-build centos-release-scl centos-release-scl-rh Requires: python27-build AutoReqProv: no %changelog * Sun Mar 11 2018 Jean-Philipe Pialasse 1.0-2.sme - update of site-default.cfg via post script [SME: 10537] - removed e-smith-devtools of requirements - added Requires python27-build * Sat Mar 10 2018 Jean-Philipe Pialasse 1.0-1.sme - Initial release with SME iServer mock config files [SME: 10537] - tools added : BogusDateBot.sh change-log clog createBuildDir prepa tagbuild %description Tools for use in building RPMs for the Koozali SME server and gateway. Few tools are also provided to help you with package building. %prep %setup %build %install rm -rf $RPM_BUILD_ROOT (cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) /bin/rm -f %{name}-%{version}-filelist /sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ --file /usr/bin/BogusDateBot.sh '%attr(0755,root,root)' \ --file /usr/bin/change-log '%attr(0755,root,root)' \ --file /usr/bin/clog '%attr(0755,root,root)' \ --file /usr/bin/createBuildDir '%attr(0755,root,root)' \ --file /usr/bin/prepa '%attr(0755,root,root)' \ --file /usr/bin/tagbuild '%attr(0755,root,root)' \ | grep -v /etc/mock/ \ > %{name}-%{version}-filelist %clean rm -rf $RPM_BUILD_ROOT %pre %preun %post # updates sme site defaults main=/etc/mock/site-defaults.cfg tmp=/tmp/site-defaults.cfg gen=/etc/mock/sme-site-defaults.cfg # position of the tags BEGIN_GEN=$(cat $main | grep -n '### KOOZALI SME SERVER BEGIN GENERATED CONTENT' | sed 's/\(.*\):.*/\1/g' ) END_GEN=$(cat $main | grep -n '### KOOZALI SME SERVER END GENERATED CONTENT' | sed 's/\(.*\):.*/\1/g' ) #if tag is absent set first to 0 if [[ "$BEGIN_GEN" -eq "" ]]; then BEGIN_GEN=0; fi if [[ "$END_GEN" -eq "" ]]; then # if second tag is absent just concatenate cat <(head -n $(expr $BEGIN_GEN - 1) $main) $gen >$tmp; else # if both tags are present replace content cat <(head -n $(expr $BEGIN_GEN - 1) $main) $gen <(tail -n +$(expr $END_GEN + 1) $main) >$tmp; fi # mv tmp file to main file mv $tmp $main %postun %files -f %{name}-%{version}-filelist %defattr(-,root,root,-) /etc/mock/* %attr(0755,root,mock)