diff --git a/build.sh b/build.sh index 6565a03..f9ddbb6 100755 --- a/build.sh +++ b/build.sh @@ -11,7 +11,11 @@ fi build_debian() { TARGET=$1 - BUILDDIR=/tmp/peersync.$$ + echo "" + echo "#========================" + echo "# Building Debian package" + echo "#========================" + BUILDDIR=/tmp/peersync.dpkg.$$ mkdir $BUILDDIR mkdir -p $BUILDDIR/usr/bin mkdir -p $BUILDDIR/etc @@ -23,6 +27,28 @@ build_debian() { sed -i "s/%VERSION%/$VERSION/" $BUILDDIR/DEBIAN/control fakeroot dpkg-deb -v --build $BUILDDIR dist + rm -rf $BUILDDIR +} + +build_rpm() { + echo "" + echo "#=====================" + echo "# Building RPM package" + echo "#=====================" + BUILDDIR=/tmp/peersync.rpm.$$ + BUILDSPEC=/tmp/peersync.$VERSION.spec + mkdir $BUILDDIR + mkdir -p $BUILDDIR/usr/bin + mkdir -p $BUILDDIR/etc + + cp $PEERSYNC_SCRIPT $BUILDDIR/usr/bin/peersync + cp etc/peersync.conf $BUILDDIR/etc/ + cp etc/peersync.files $BUILDDIR/etc/ + cp package/RPM/peersync.spec /tmp/peersync.$VERSION.spec + + sed "s/%VERSION%/$VERSION/" package/RPM/peersync.spec > $BUILDSPEC + rpmbuild -v -ba --buildroot $BUILDDIR $BUILDSPEC + rm -rf $BUILDDIR } if [ ! -d $TARGET ]; then @@ -31,4 +57,5 @@ fi echo "Building packages for version $VERSION of peersync" build_debian $TARGETDIR +build_rpm diff --git a/package/RPM/peersync.spec b/package/RPM/peersync.spec new file mode 100644 index 0000000..f6d98c4 --- /dev/null +++ b/package/RPM/peersync.spec @@ -0,0 +1,41 @@ +Summary: A simple rsync based peer cluster sync helper +Name: peersync +Version: 0.9.0 +# Version: 0.9.0 +Release: 1 +Group: System/Base +License: GPL +Vendor: NeoTel Telefonservice GmbH & Co KG +# Source: %{name}.tar.gz +BuildArch: noarch +BuildRoot: /var/tmp/%{name}-buildroot + +%description +Peersync is a rsync based peer synchronization tool + +# %prep +# %setup -q + +%build +# env + +%install +# mkdir -p $RPM_BUILD_ROOT/usr/bin +# mkdir -p $RPM_BUILD_ROOT/etc + +# install -m 755 peersync.sh $RPM_BUILD_ROOT/usr/bin/peersync +# install -m 755 etc/peersync.conf $RPM_BUILD_ROOT/etc/peersync.conf +# install -m 755 etc/peersync.files $RPM_BUILD_ROOT/etc/peersync.files + +%clean +# if( [ $RPM_BUILD_ROOT != '/' ] ); then rm -rf $RPM_BUILD_ROOT; fi; + +%files +%defattr(-,root,root) +/usr/bin/peersync +%config(noreplace) +/etc/peersync.conf +/etc/peersync.files + +%post +