summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packaging/rpm/openslx.spec26
-rwxr-xr-xtools/installer129
2 files changed, 126 insertions, 29 deletions
diff --git a/packaging/rpm/openslx.spec b/packaging/rpm/openslx.spec
index 893bb877..f2aee04d 100644
--- a/packaging/rpm/openslx.spec
+++ b/packaging/rpm/openslx.spec
@@ -1,17 +1,17 @@
#
-# spec file for OpenSLX (Version 4.0.0)
+# spec file for OpenSLX (Version ###version###)
#
Name: openslx
-Version: 4.0.0
-Release: 0
+Version: ###version###
+Release: ###release###
License: GNU General Public License (GPL)
Group: Productivity/Networking/System
Url: http://openslx.org/
Autoreqprov: on
Requires: perl-DBD-SQLite perl-DBD-mysql
-#PreReq:
-Source: %{name}-%{version}.tar.bz2
+PreReq: perl
+Source: %{name}-v%{version}-%{release}.tar.gz
Summary: Open StateLess Extensions
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl-DBD-SQLite perl-DBD-mysql
@@ -29,27 +29,21 @@ see any difference
Authors:
--------
- Dirk von Suchodoletz, <dvs@OpenSLX.com>, 2002 - 2007
- Michael Janczyk, 2003 - 2007
- Nico Dietrich, 2005 - 2006
- Felix Endres, 2005 - 2007
- Tobias Maier, 2005 - 2006
- Bastian Wissler, 2006 - 2007
- Lars Mueller, <lm@OpenSLX.com>, 2006 - 2007
- Oliver Tappe, <ot@OpenSLX.com>, 2006 - 2007
+###authors###
+
%prep
+
%setup
%build
%install
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
-make install \
- DESTDIR="${RPM_BUILD_ROOT}"
+./tools/installer plain-install SLX_BUILD_PATH="${RPM_BUILD_ROOT}"
%clean
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
-%files -f packaging/rpm/openslx-filelist
+%files -f %{_topdir}/FILES
%defattr(-,root,root)
diff --git a/tools/installer b/tools/installer
index 7aa72b1d..c2327f3b 100755
--- a/tools/installer
+++ b/tools/installer
@@ -18,6 +18,8 @@ DISTRO=$(lsb_release -i| sed 's/^[^:]*:\t//' | tr '[:upper:]' '[:lower:]')
PREPARE_INSTALL_TARGET="./_install/"
+
+
# helper functions:
git_version()
{
@@ -200,22 +202,30 @@ make_install_tarball()
[ "x$COMPRESSION" = "x" ] || \
echo -n " * create OpenSLX install tarball (compressed with $COMPRESSION)"
VERSIONSTRING="openslx-$(git_version)"
- cd $PREPARE_INSTALL_TARGET
- tar cf ../$VERSIONSTRING.tar *
- cd - 2>&1 >/dev/null
- [ "x$COMPRESSION" = "x" ] || $COMPRESSION -f $VERSIONSTRING.tar
+ if [ ! -f $VERSIONSTRING.tar ]; then
+ cd $PREPARE_INSTALL_TARGET
+ tar cf ../$VERSIONSTRING.tar *
+ cd - 2>&1 >/dev/null
+ fi
+ [ "x$COMPRESSION" = "x" ] || $COMPRESSION -k -f $VERSIONSTRING.tar
echo -e " [${LightGreen}ok${NC}]"
}
make_source_tarball()
{
local COMPRESSION=$1
+ local ALTERNATIVE_PREFIX=$2
[ "x$COMPRESSION" = "x" ] && \
echo -n " * create OpenSLX source tarball"
[ "x$COMPRESSION" = "x" ] || \
echo -n " * create OpenSLX source tarball (compressed with $COMPRESSION)"
VERSIONSTRING="openslx-$(git_version)-src"
- git archive --format=tar --prefix=$VERSIONSTRING/ -o $VERSIONSTRING.tar HEAD
+ if [ "x$ALTERNATIVE_PREFIX" = "x" ]; then
+ PREFIX="openslx-$(git_version)-src"
+ else
+ PREFIX=$ALTERNATIVE_PREFIX
+ fi
+ git archive --format=tar --prefix=$PREFIX/ -o $VERSIONSTRING.tar HEAD
[ "x$COMPRESSION" = "x" ] || $COMPRESSION -f $VERSIONSTRING.tar
echo -e " [${LightGreen}ok${NC}]"
}
@@ -393,6 +403,52 @@ build_dpkg_package()
#rm -rf $SLX_BUILD_PATH
}
+build_rpm_package()
+{
+
+ INSTALL_HOME=$(pwd)
+ VERSIONSTRING="openslx-$(git_version)"
+
+ OPENSLX_VERSION=$(git describe | sed -e 's/-.*$//' -e 's/^v//')
+ OPENSLX_REVISION=$(git_version | sed -e 's/[^-]*-//' -e 's/-/_/g')
+
+ rpm_builder=`which rpmbuild`
+ if [ -z "$rpm_builder" ];then
+ echo "You need the program rpmbuild (contained in package ?!?) to build a rpm package"
+ exit
+ fi
+
+ # change into folder where we expect the Makefile:
+ if [ ! -e ./Makefile ]; then
+ echo "There is no makefile in this programs directory (`pwd`)."
+ echo "Please run this script only embedded in the context of an openslx checkout."
+ exit
+ fi
+
+ make_source_tarball gzip "openslx-$OPENSLX_VERSION"
+ make_install_tarball
+
+ export SLX_RPMBUILD_PATH=/tmp/slx-rpm-$$
+ mkdir -p $SLX_RPMBUILD_PATH
+ mkdir -p $SLX_RPMBUILD_PATH/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+
+ cp $VERSIONSTRING-src.tar.gz $SLX_RPMBUILD_PATH/SOURCES/openslx-v$OPENSLX_VERSION-$OPENSLX_REVISION.tar.gz
+
+ tar -tf $VERSIONSTRING.tar > $SLX_RPMBUILD_PATH/FILES
+ sed -i $SLX_RPMBUILD_PATH/FILES -e 's,^,/,'
+
+ #update control file
+ sed -e "s/###version###/$OPENSLX_VERSION/" \
+ -e "s/###release###/$OPENSLX_REVISION/" \
+ -e "/###authors###/r AUTHORS" \
+ -e "/###authors###/d" \
+ packaging/rpm/openslx.spec \
+ > $SLX_RPMBUILD_PATH/SPECS/openslx.spec
+ rpmbuild --nodeps -ba --define "_topdir $SLX_RPMBUILD_PATH" \
+ $SLX_RPMBUILD_PATH/SPECS/openslx.spec
+
+}
+
clean()
{
echo -n " * Cleanup OpenSLX source directory"
@@ -402,14 +458,62 @@ clean()
echo -e " [${LightGreen}ok${NC}]"
}
+cmd_usage()
+{
+ echo "Usage: ..."
+ echo " plain-install"
+ echo " install"
+ echo " build_rpm"
+ echo " build_deb"
+}
+
+cmd_plain_install()
+{
+ echo "running plain install:"
+ do_install
+}
+
+cmd_install()
+{
+ echo "running full install"
+ check_perl
+ check_perl_dep
+ check_perl_db
+ check_helper_apps
+ prepare_install
+ do_install
+}
+
+cmd_build_rpm()
+{
+ echo "creating rpm package"
+ build_rpm_package
+}
+
+cmd_build_dep()
+{
+ echo "creating deb package"
+}
+
+case "$1" in
+ "plain-install")
+ cmd_plain_install
+ ;;
+ "install")
+ cmd_install
+ ;;
+ "build-rpm")
+ cmd_build_rpm
+ ;;
+ "build-dep")
+ cmd_build_dep
+ ;;
+ *)
+ cmd_usage
+ ;;
+esac
-check_perl
-check_perl_dep
-check_perl_db
-check_helper_apps
-prepare_install
-build_dpkg_package
#make_install_tarball
#make_install_tarball gzip
#make_install_tarball bzip2
@@ -418,5 +522,4 @@ build_dpkg_package
#make_source_tarball gzip
#make_source_tarball bzip2
#make_source_tarball lzma
-do_install
-git_version \ No newline at end of file
+#git_version \ No newline at end of file