blob: 33e8683de7cc5d986fa1af34d7cdd74c4868c3ce (
plain) (
tree)
|
|
#!/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
|