sit/functions.sh
2024-03-28 02:43:55 +01:00

115 lines
1.9 KiB
Bash

sit_fail() {
msg=$0
echo "$msg"
exit 1
}
sit_info() {
msg=$0
echo $msg
}
sit_countdown() {
local tt=$1
for i in $(seq $tt); 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 xfjv ${SRC_POOL}/${A} || sit_fail
;;
gz|tgz)
tar xfzv ${SRC_POOL}/${A} || sit_fail
;;
xz)
tar xfJv ${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 || sit_fail "Unpacking failed"
}
src_configure() {
${SRCDIR}/configure --prefix=$PREFIX $CONFIGURE_OPTS
cp config.log $LOGDIR
}
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() {
cd $LOGDIR
bzip2 *.log
cp $LOGDIR/*.bz2 $PREFIX
}
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"
}