sit_fail() { msg="Fail: $1" echo "$msg" exit 1 } sit_info() { msg=$1 echo $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() { ${SRCDIR}/configure --prefix=$PREFIX $CONFIGURE_OPTS if [ ! -z $LOGDIR -a -f config.log ] ; then cp config.log $LOGDIR 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_posttest() { /bin/true } sit_posttest() { sit_info "Running post installation tests ..." cd ${BUILDDIR} src_posttest || sit_fail "Post installation tests failed" } src_install() { make install } sit_install() { sit_info "Installing package ..." cd ${BUILDDIR} src_install || sit_fail "Install 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)" != "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)"; else SIT_VERSION="unknown" fi echo "Invocation: $(ps --pid $$ -o cmd | tail -n 1)" echo "Started: $(date)" echo "Version: $SIT_VERSION" echo "Environment:" echo "------------------------------------------------------------------------------" env echo "------------------------------------------------------------------------------" }