summaryrefslogtreecommitdiffstats
path: root/tools/installer
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-02 17:53:37 +0200
committerSebastian Schmelzer2010-09-02 17:53:37 +0200
commit91d3272f94fcb7a8bded9d2583b8f922c2b207e6 (patch)
treed96a524bc0f695ff4987bc6130420ebddb5bb287 /tools/installer
parentchange dir structure (diff)
downloadcore-91d3272f94fcb7a8bded9d2583b8f922c2b207e6.tar.gz
core-91d3272f94fcb7a8bded9d2583b8f922c2b207e6.tar.xz
core-91d3272f94fcb7a8bded9d2583b8f922c2b207e6.zip
first steps for new makefile
Diffstat (limited to 'tools/installer')
-rwxr-xr-xtools/installer68
1 files changed, 68 insertions, 0 deletions
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