164 lines
3.3 KiB
Bash
164 lines
3.3 KiB
Bash
sit_fail() {
|
|
local msg="SIT: Fail: $1"
|
|
echo "$msg"
|
|
exit 1
|
|
}
|
|
sit_warn() {
|
|
local msg=$1
|
|
echo "SIT: Warning: $msg"
|
|
}
|
|
sit_info() {
|
|
local msg=$1
|
|
echo "SIT: $msg"
|
|
}
|
|
|
|
|
|
sit_countdown() {
|
|
local tt=$1
|
|
for i in $(seq $tt -1 1); do
|
|
echo -n "$i "
|
|
sleep 1
|
|
done
|
|
echo
|
|
}
|
|
|
|
|
|
unpack() {
|
|
if [ ! -e ${SRC_POOL}/${A} ] ; then
|
|
sit_fail "${SRC_POOL}/${A} doesn't exist"
|
|
fi
|
|
case "${A##*.}" in
|
|
bz2)
|
|
tar xjf ${SRC_POOL}/${A} || sit_fail
|
|
;;
|
|
gz|tgz)
|
|
tar xzf ${SRC_POOL}/${A} || sit_fail
|
|
;;
|
|
xz)
|
|
tar xJf ${SRC_POOL}/${A} || sit_fail
|
|
;;
|
|
*)
|
|
sit_fail "Archive format not recogized"
|
|
;;
|
|
esac
|
|
}
|
|
src_unpack() {
|
|
unpack
|
|
}
|
|
sit_unpack() {
|
|
sit_info "Unpacking sources ..."
|
|
cd ${WORKDIR}
|
|
src_unpack
|
|
}
|
|
|
|
|
|
src_prepare() {
|
|
/bin/true
|
|
}
|
|
sit_prepare() {
|
|
sit_info "Preparing sources"
|
|
cd ${SRCDIR}
|
|
src_prepare || sit_fail "Preparing sources failed"
|
|
}
|
|
|
|
|
|
src_configure() {
|
|
if [ -x ${SRCDIR}/configure ] ; then
|
|
#sit_info "Runnning configure"
|
|
${SRCDIR}/configure --prefix=$PREFIX $CONFIGURE_OPTS
|
|
if [ ! -z $LOGDIR -a -f config.log ] ; then
|
|
cp config.log $LOGDIR
|
|
fi
|
|
elif [ -f ${SRCDIR}/CMakeLists.txt ] ; then
|
|
#sit_info "Running cmake"
|
|
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX $CMAKE_OPTS ${SRCDIR}
|
|
fi
|
|
}
|
|
sit_configure() {
|
|
sit_info "Configuring sources ..."
|
|
cd ${BUILDDIR}
|
|
src_configure || sit_fail "Configure failed"
|
|
}
|
|
|
|
|
|
src_build() {
|
|
make $MAKEOPTS
|
|
}
|
|
sit_build() {
|
|
sit_info "Building sources ..."
|
|
cd ${BUILDDIR}
|
|
src_build || sit_fail "Build failed"
|
|
}
|
|
|
|
|
|
src_pretest() {
|
|
/bin/true
|
|
}
|
|
sit_pretest() {
|
|
sit_info "Running pre installation tests ..."
|
|
cd ${BUILDDIR}
|
|
src_pretest || sit_fail "Pre installation tests failed"
|
|
}
|
|
|
|
|
|
src_install() {
|
|
make install
|
|
}
|
|
sit_install() {
|
|
sit_info "Installing package ..."
|
|
cd ${BUILDDIR}
|
|
src_install || sit_fail "Install failed"
|
|
}
|
|
|
|
|
|
src_posttest() {
|
|
/bin/true
|
|
}
|
|
sit_posttest() {
|
|
sit_info "Running post installation tests ..."
|
|
cd ${BUILDDIR}
|
|
src_posttest || sit_fail "Post installation tests failed"
|
|
}
|
|
|
|
|
|
src_postinst() {
|
|
/bin/true
|
|
}
|
|
|
|
sit_postinst() {
|
|
src_postinst || sit_fail "Post installation failed"
|
|
}
|
|
|
|
|
|
sit_copy_logs() {
|
|
if [ ! -z $LOGDIR ] ; then
|
|
cd $LOGDIR
|
|
bzip2 *.log
|
|
cp $LOGDIR/*.bz2 $PREFIX
|
|
fi
|
|
}
|
|
|
|
src_setperms() {
|
|
chmod -R g+rwX $PREFIX
|
|
chmod -R o+rX $PREFIX
|
|
}
|
|
sit_setperms() {
|
|
sit_info "Setting proper permissions"
|
|
src_setperms || sit_fail "Could not set permissions"
|
|
}
|
|
|
|
sit_sitinfo() {
|
|
local SIT_VERSION="unknown"
|
|
if svnversion $SIT_PATH >/dev/null 2>/dev/null && test "$(svnversion $SIT_PATH)" != "exported" ; then
|
|
SIT_VERSION="svn-r$(svnversion $SIT_PATH)"
|
|
elif cd $SIT_PATH; git svn find-rev r1 >/dev/null 2>&1 ; then
|
|
SIT_VERSION="svn-r$(cd $SIT_PATH; git svn find-rev HEAD)";
|
|
fi
|
|
echo "Invocation: $(ps --pid $$ -o cmd | tail -n 1)"
|
|
echo "Started: $(date)"
|
|
echo "Version: $SIT_VERSION"
|
|
echo "Environment:"
|
|
echo "------------------------------------------------------------------------------"
|
|
env
|
|
echo "------------------------------------------------------------------------------"
|
|
}
|