blob: 30eda9f05c932472b868ae8ec21d2d5592350d52 (
plain) (
tree)
|
|
#!/bin/bash
. tools/inc/colors
DISTRO=$(lsb_release -i| sed 's/^[^:]*:\t//' | tr '[:upper:]' '[:lower:]')
[ -z $USR_BIN_PATH ] && USR_BIN_PATH=/usr/bin
[ -z $SLX_CONFIG_PATH ] && SLX_CONFIG_PATH=/etc/opt/openslx
[ -z $SLX_BASE_PATH ] && SLX_BASE_PATH=/opt/openslx
[ -z $SLX_PRIVATE_PATH ] && SLX_PRIVATE_PATH=/var/opt/openslx
[ -z $SLX_PUBLIC_PATH ] && SLX_PUBLIC_PATH=/srv/openslx
[ -z $SLX_TEMP_PATH ] && SLX_TEMP_PATH=/tmp
[ -z $SLX_INSTALL_LOG ] && SLX_INSTALL_LOG=install.log
# 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_source_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_source_tarball
git_version
|