diff options
author | Sebastian Schmelzer | 2010-09-14 17:10:35 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2010-09-14 17:10:35 +0200 |
commit | 3cf2ac3cf56468eccaf4cf70a17c15b33185ca21 (patch) | |
tree | 01406e5a2d6e5d82d0cd573f448cd2462af7a350 /tools | |
parent | update installer (diff) | |
download | core-3cf2ac3cf56468eccaf4cf70a17c15b33185ca21.tar.gz core-3cf2ac3cf56468eccaf4cf70a17c15b33185ca21.tar.xz core-3cf2ac3cf56468eccaf4cf70a17c15b33185ca21.zip |
rpm working
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/installer | 86 |
1 files changed, 59 insertions, 27 deletions
diff --git a/tools/installer b/tools/installer index 415f720a..80a380ad 100755 --- a/tools/installer +++ b/tools/installer @@ -202,6 +202,7 @@ prepare_install() make_install_tarball() { local COMPRESSION=$1 + local ALTERNATIVE_PREFIX=$2 [ "x$COMPRESSION" = "x" ] && \ echo -n " * create OpenSLX install tarball" [ "x$COMPRESSION" = "x" ] || \ @@ -209,10 +210,19 @@ make_install_tarball() VERSIONSTRING="openslx-$(git_version)" if [ ! -f $VERSIONSTRING.tar ]; then cd $PREPARE_INSTALL_TARGET - tar cf ../$VERSIONSTRING.tar * + if [ "x$ALTERNATIVE_PREFIX" = "x" ]; then + OPT="" + else + OPT=" --transform \"s,^,/$ALTERNATIVE_PREFIX/,S\" " + fi + #HACK .. otherwise tar doesn't like parameters.. + CMD="tar $OPT -c -f ../$VERSIONSTRING.tar *" + sh -c "$CMD" cd - 2>&1 >/dev/null fi - [ "x$COMPRESSION" = "x" ] || $COMPRESSION -k -f $VERSIONSTRING.tar + COMPRESSION_KEEP_ORIG="-k" + [ "x$COMPRESSION" = "xgzip" ] && COMPRESSION_KEEP_ORIG="" + [ "x$COMPRESSION" = "x" ] || $COMPRESSION -f $COMPRESSION_KEEP_ORIG $VERSIONSTRING.tar echo -e " [${LightGreen}ok${NC}]" } @@ -367,45 +377,49 @@ build_dpkg_package() echo "Please run this script only embedded in the context of an openslx checkout." exit fi + + echo -n " * Building DEB Package(s)" - export SLX_BUILD_PATH=/tmp/slx$$ - mkdir -p $SLX_BUILD_PATH + export SLX_DEPBUILD_PATH=/tmp/slx-dep-$$ + mkdir -p $SLX_DEPBUILD_PATH INSTALL_HOME=$(pwd) VERSIONSTRING="openslx-$(git_version)" - cd $SLX_BUILD_PATH + cd $SLX_DEPBUILD_PATH tar xf $INSTALL_HOME/$VERSIONSTRING.tar cd $INSTALL_HOME #Create Temporary working directory - mkdir -p $SLX_BUILD_PATH/DEBIAN - cp packaging/dpkg/default_files/control $SLX_BUILD_PATH/DEBIAN/ - cp packaging/dpkg/default_files/pre* $SLX_BUILD_PATH/DEBIAN/ - cp packaging/dpkg/default_files/post* $SLX_BUILD_PATH/DEBIAN/ + mkdir -p $SLX_DEPBUILD_PATH/DEBIAN + cp packaging/dpkg/default_files/control $SLX_DEPBUILD_PATH/DEBIAN/ + cp packaging/dpkg/default_files/pre* $SLX_DEPBUILD_PATH/DEBIAN/ + cp packaging/dpkg/default_files/post* $SLX_DEPBUILD_PATH/DEBIAN/ OPENSLX_VERSION=$(git describe) sed -i -e "4r./packaging/dpkg/debianpaths" \ - $SLX_BUILD_PATH/DEBIAN/postinst + $SLX_DEPBUILD_PATH/DEBIAN/postinst #update control file sed -e "s/##version##/$OPENSLX_VERSION/" \ -e "s/##size##/$(du -s $SLX_BUILD_PATH | awk '{print $1}')/" \ - -i $SLX_BUILD_PATH/DEBIAN/control + -i $SLX_DEPBUILD_PATH/DEBIAN/control #Set permissions - find $SLX_BUILD_PATH -type d|xargs chmod 755 + find $SLX_DEPBUILD_PATH -type d|xargs chmod 755 #Create the package - dpkg-deb --build $SLX_BUILD_PATH > /dev/null + dpkg-deb --build $SLX_DEPBUILD_PATH > /dev/null cd packaging/dpkg - mv $SLX_BUILD_PATH.deb openslx_$OPENSLX_VERSION.deb - echo "Written 'openslx_$OPENSLX_VERSION.deb':" - ls -lh openslx_$OPENSLX_VERSION.deb + + echo -e " [${LightGreen}ok${NC}]" + + mkdir -p $INSTALL_HOME/pkgs/ + sh -c "find $SLX_DEPBUILD_PATH/ -iname \"*.deb\" -exec cp {} $INSTALL_HOME/pkgs/ \;" cd $INSTALL_HOME - #rm -rf $SLX_BUILD_PATH + rm -rf $SLX_DEPBUILD_PATH } build_rpm_package() @@ -429,18 +443,22 @@ build_rpm_package() 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} + + #make_source_tarball gzip "openslx-$OPENSLX_VERSION" + #make_install_tarball + #tar -tf $VERSIONSTRING.tar > $SLX_RPMBUILD_PATH/FILES + #sed -i $SLX_RPMBUILD_PATH/FILES -e 's,^,/,' + + [ -f $VERSIONSTRING.tar ] && rm $VERSIONSTRING.tar + make_install_tarball gzip "openslx-$OPENSLX_VERSION" - cp $VERSIONSTRING-src.tar.gz $SLX_RPMBUILD_PATH/SOURCES/openslx-v$OPENSLX_VERSION-$OPENSLX_REVISION.tar.gz + mv $VERSIONSTRING.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,^,/,' + echo -n " * Building RPM Package(s)" #update control file sed -e "s/###version###/$OPENSLX_VERSION/" \ @@ -449,8 +467,21 @@ build_rpm_package() -e "/###authors###/d" \ packaging/rpm/openslx.spec \ > $SLX_RPMBUILD_PATH/SPECS/openslx.spec + [ "x$ARCH" = "x" ] || ARCH="--target=$ARCH" rpmbuild --nodeps -ba --define "_topdir $SLX_RPMBUILD_PATH" \ - $SLX_RPMBUILD_PATH/SPECS/openslx.spec + $SLX_RPMBUILD_PATH/SPECS/openslx.spec >>${SLX_INSTALL_LOG} 2>&1 + + if [ "$(ls -1 $SLX_RPMBUILD_PATH/RPMS)" = "x86_64" ]; then + rpmbuild --target="i386" --nodeps -ba --define "_topdir $SLX_RPMBUILD_PATH" \ + $SLX_RPMBUILD_PATH/SPECS/openslx.spec >>${SLX_INSTALL_LOG} 2>&1 + fi + + echo -e " [${LightGreen}ok${NC}]" + + mkdir -p $INSTALL_HOME/pkgs/ + echo "find $SLX_RPMBUILD_PATH/RPMS/ -iname *.rpm -exec cp {} $INSTALL_HOME/pkgs/ \;" + sh -c "find $SLX_RPMBUILD_PATH/RPMS/ -iname \"*.rpm\" -exec cp {} $INSTALL_HOME/pkgs/ \;" + rm -rf $SLX_RPMBUILD_PATH } @@ -492,13 +523,14 @@ cmd_install() cmd_build_rpm() { - echo "creating rpm package" + echo "creating rpm package(s)" build_rpm_package } cmd_build_dep() { echo "creating deb package" + build_dpkg_package } @@ -510,7 +542,7 @@ case "$1" in cmd_install ;; "build-rpm") - cmd_build_rpm + cmd_build_rpm ;; "build-dep") cmd_build_dep |