Move execute wrappers to function.sh file
This commit is contained in:
committed by
Tobias Brunner
parent
9574bf7a5e
commit
b86866579a
@@ -13,31 +13,6 @@ DIR=`dirname $0`
|
|||||||
[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found"
|
[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found"
|
||||||
. $DIR/../testing.conf
|
. $DIR/../testing.conf
|
||||||
|
|
||||||
# execute command
|
|
||||||
# $1 - command to execute
|
|
||||||
# $2 - whether or not to log command exit status
|
|
||||||
# (0 -> disable exit status logging)
|
|
||||||
execute()
|
|
||||||
{
|
|
||||||
cmd=${1}
|
|
||||||
echo $cmd >>$LOGFILE
|
|
||||||
$cmd >>$LOGFILE 2>&1
|
|
||||||
status=$?
|
|
||||||
[ "$2" != 0 ] && log_status $status
|
|
||||||
if [ $status != 0 ]; then
|
|
||||||
echo "! command $cmd failed, exiting (status $status)"
|
|
||||||
echo "! check why here $LOGFILE"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# execute command in chroot
|
|
||||||
# $1 - command to execute
|
|
||||||
execute_chroot()
|
|
||||||
{
|
|
||||||
execute "chroot $LOOPDIR $@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# additional packages
|
# additional packages
|
||||||
EXTRAS=build-essential,gperf,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc,openssl,vim,sqlite3,conntrack,gdb,cmake,libxerces-c2-dev,libltdl-dev,liblog4cxx10-dev,libboost-thread-dev,libboost-system-dev,git-core
|
EXTRAS=build-essential,gperf,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc,openssl,vim,sqlite3,conntrack,gdb,cmake,libxerces-c2-dev,libltdl-dev,liblog4cxx10-dev,libboost-thread-dev,libboost-system-dev,git-core
|
||||||
SERVICES="isc-dhcp-server apache2 slapd"
|
SERVICES="isc-dhcp-server apache2 slapd"
|
||||||
|
|||||||
@@ -14,10 +14,31 @@
|
|||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
# for more details.
|
# for more details.
|
||||||
|
|
||||||
|
# execute command
|
||||||
|
# $1 - command to execute
|
||||||
|
# $2 - whether or not to log command exit status
|
||||||
|
# (0 -> disable exit status logging)
|
||||||
|
execute()
|
||||||
|
{
|
||||||
|
cmd=${1}
|
||||||
|
echo $cmd >>$LOGFILE 2>&1
|
||||||
|
$cmd >>$LOGFILE 2>&1
|
||||||
|
status=$?
|
||||||
|
[ "$2" != 0 ] && log_status $status
|
||||||
|
if [ $status != 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "! Command $cmd failed, exiting (status $status)"
|
||||||
|
echo "! Check why here $LOGFILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
############################################
|
# execute command in chroot
|
||||||
# output functions
|
# $1 - command to execute
|
||||||
#
|
execute_chroot()
|
||||||
|
{
|
||||||
|
execute "chroot $LOOPDIR $@"
|
||||||
|
}
|
||||||
|
|
||||||
export TERM=xterm
|
export TERM=xterm
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user