summaryrefslogtreecommitdiffstats
path: root/tools/installer
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-14 10:33:05 +0200
committerSebastian Schmelzer2010-09-14 10:33:05 +0200
commit3ac01e190e5631bba65d8511671640858f6c5d48 (patch)
treeecfaaebca1b15cac15138a044aa28206ec9b56a1 /tools/installer
parentdeb creation successfull (diff)
downloadcore-3ac01e190e5631bba65d8511671640858f6c5d48.tar.gz
core-3ac01e190e5631bba65d8511671640858f6c5d48.tar.xz
core-3ac01e190e5631bba65d8511671640858f6c5d48.zip
first steps to rpm pkg builder
Diffstat (limited to 'tools/installer')
-rwxr-xr-xtools/installer129
1 files changed, 116 insertions, 13 deletions
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