Kaydet (Commit) 0a31e2a4 authored tarafından root's avatar root

posthooks added

üst ee4f5b72
......@@ -12,4 +12,7 @@ err(){
info(){
echo -e "\033[34;1m$*\033[;0m"
}
fail_message() {
err "$@"
exit 1
}
#!/bin/bash
import_source(){
if [ -f "$1" ] || [ "$#" == "0" ] ; then
source <(cat $1)
elif echo "$1" | grep "^.*://" &>/dev/null ; then
source <(curl $1)
else
err "Source not detected or not supported."
exit 1
fi
}
#!/bin/bash
run_function(){
fnc="$1"
if fn_exists "_$fnc" ; then
cd $WORKDIR
msg ">>> Running $fnc function"
_$fnc || fail_message "Failed to run $fnc function."
fi
}
#!/bin/bash
[ "$PKGS" == "" ] && PKGS=$name
for package in ${PKGS[@]} ; do
export INSTALLDIR=$BUILDDIR/$package/install
find -L $INSTALLDIR -type l | xargs echo "Broken:"
done
#!/bin/bash
[ "$PKGS" == "" ] && PKGS=$name
for package in ${PKGS[@]} ; do
export INSTALLDIR=$BUILDDIR/$package/install
find $INSTALLDIR -type f | grep "*.la" | while read line ; do
msg "Removed: $line"
rm -f $line
done
done
#!/bin/bash
if which optipng &>/dev/null ; then
[ "$PKGS" == "" ] && PKGS=$name
for package in ${PKGS[@]} ; do
export INSTALLDIR=$BUILDDIR/$package/install
find $INSTALLDIR -type f | grep "*.png" | xargs optipng -o7
done
fi
#!/bin/bash
[ "$PKGS" == "" ] && PKGS=$name
for package in ${PKGS[@]} ; do
export INSTALLDIR=$BUILDDIR/$package/install
find $INSTALLDIR -type f | grep "*.so$" | while read line ; do
if [ -f $line ] ; then
msg "Library detected: $(basename "$line")"
chmod +x $line
fi
done
done
#!/bin/bash
$(env | cut -f 1 -d '=' | grep -v "TARGET" | grep -v "HOST" | grep -v "DISTRO" | sed "s/^/unset /")
export UNIBUILDRC="$HOME/.unibuildrc"
$(env | cut -f 1 -d '=' | grep -v "TARGET" | grep -v "UNIBUILDRC" | grep -v "HOST" | grep -v "DISTRO" | sed "s/^/unset /")
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export USER=unibuild
export HOME=$(mktemp -d)
export SHELL=/bin/bash
declare -r unibuild_api_version=3
declare -r unibuild_api_version=4
declare -r inittime=$(date +%s%3N)
[ -f $HOME/.unibuildrc ] && source $HOME/.unibuildrc
[ -f "$UNIBUILDRC" ] && source "$UNIBUILDRC"
[ "$MODDIR" == "" ] && export MODDIR=/usr/lib/unibuild/modules
set -e
for api in $(ls $MODDIR/../api | sort) ; do
......@@ -15,18 +16,7 @@ done
for mod in $(ls $MODDIR) ; do
source $MODDIR/$mod
done
if [ -f "$1" ] || [ "$#" == "0" ] ; then
source <(cat $1)
elif echo "$1" | grep "^.*://" &>/dev/null ; then
source <(curl $1)
else
err "Source not detected or not supported."
exit 1
fi
fail_message() {
err "$@"
exit 1
}
import_source "$1"
source $MODDIR/../target/$TARGET
source $MODDIR/../host/$HOST
......@@ -47,27 +37,17 @@ msg ">>> Running hooks"
for hook in $(ls $MODDIR/../hooks | sort) ; do
source $MODDIR/../hooks/$hook
done
if fn_exists "_setup" ; then
cd $WORKDIR
msg ">>> Running setup function"
_setup || fail_message "Failed to run setup function."
fi
run_function setup
declare -r setuptime=$(date +%s%3N)
if fn_exists "_build" ; then
cd $WORKDIR
msg ">>> Running build function"
_build || fail_message "Failed to run build function."
fi
run_function build
declare -r buildtime=$(date +%s%3N)
if fn_exists "_check" ; then
cd $WORKDIR
msg ">>> Running check function"
_build || warn "Failed to run check function."
fi
run_function check
declare -r buildchecktime=$(date +%s%3N)
[ "$PKGS" == "" ] && PKGS=$name
for package in ${PKGS[@]} ; do
export PKGDIR=$BUILDDIR/$package/package
......@@ -80,6 +60,11 @@ for package in ${PKGS[@]} ; do
_install || fail_message "Failed to run install function for $package"
fi
done
msg ">>> Running post hooks"
export INSTALLDIR=$BUILDDIR/$package/install
for hook in $(ls $MODDIR/../posthooks | sort) ; do
source $MODDIR/../posthooks/$hook
done
declare -r installtime=$(date +%s%3N)
for package in ${PKGS[@]} ; do
export name=$package
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment