From 91d3272f94fcb7a8bded9d2583b8f922c2b207e6 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Thu, 2 Sep 2010 17:53:37 +0200 Subject: first steps for new makefile --- tools/installer | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 tools/installer (limited to 'tools/installer') diff --git a/tools/installer b/tools/installer new file mode 100755 index 00000000..33e8683d --- /dev/null +++ b/tools/installer @@ -0,0 +1,68 @@ +#!/bin/bash + +. tools/inc/colors + +DISTRO=$(lsb_release -i| sed 's/^[^:]*:\t//' | tr '[:upper:]' '[:lower:]') + + +# helper functions: +git_version() +{ + GITVERSION=`git describe` + GITMODIFIED=`(git status | grep "modified:\|added:\|deleted:" -q) && echo "-M"` + echo $GITVERSION$GITMODIFIED +} + +perl_dep_check() +{ + echo -n " * checking perl dependencies" + PERL_MODULES=$(cat tools/inc/perl.modules.base) + [ -e .perl_modules_missing ] && rm .perl_modules_missing + [ -e .perl_deps_guess ] && rm .perl_deps_guess + for pm in $PERL_MODULES; do + perl -e "use $pm" 2>>/dev/null || echo $pm >> .perl_modules_missing; + done + if [ -e .perl_modules_missing ]; then + echo -e " [${LightRed}failed${NC}]" + echo " Following perl modules are required and could not be found on your system:" + for pm in $(cat .perl_modules_missing); do + echo -n " $pm" + if [ -e tools/inc/perl.modules.$DISTRO ]; then + GUESS_INSTALL=$(cat tools/inc/perl.modules.$DISTRO|grep $pm| awk '{print $2}') + if [ ! -z $GUESS_INSTALL ]; then + echo " ($GUESS_INSTALL)" + echo "$GUESS_INSTALL" >> .perl_deps_guess + else + echo "" + fi + else + echo "" + fi + done + if [ -e .perl_deps_guess ]; then + echo " To install the missing dependencies run:" + echo -n " apt-get install" + for d in $(cat .perl_deps_guess | sort -u); do + echo -n " $d" + done + echo "" + exit 1 + fi + else + echo -e " [${LightGreen}done${NC}]" + fi +} + +make_tarball() +{ + echo -n " * create openslx tarball" + VERSIONSTRING="openslx-$(git_version)" + rm -rf $VERSIONSTRING.tar $VERSIONSTRING.tar.* + git archive --format=tar --prefix=$VERSIONSTRING/ -o $VERSIONSTRING.tar HEAD + bzip2 $VERSIONSTRING.tar + echo -e " [${LightGreen}done${NC}]" +} + +perl_dep_check +make_tarball +git_version \ No newline at end of file -- cgit v1.2.3-55-g7522