Skip to content

Commit

Permalink
Add simple RPM building
Browse files Browse the repository at this point in the history
  • Loading branch information
lammel committed Mar 29, 2016
1 parent 9f981e5 commit af01cd2
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
29 changes: 28 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -31,4 +57,5 @@ fi

echo "Building packages for version $VERSION of peersync"
build_debian $TARGETDIR
build_rpm

41 changes: 41 additions & 0 deletions package/RPM/peersync.spec
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit af01cd2

Please sign in to comment.