mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-01-04 02:56:54 +00:00
docker: reindent shell scripts
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
parent
c12ec8557e
commit
04c63c05b5
@ -30,70 +30,70 @@ CDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# Script begin
|
||||
#
|
||||
if [ ! -f .sync_source -o $SYNC_SOURCE -ne 0 ]; then
|
||||
log_info "Syncing FRR source with host..."
|
||||
mkdir -p $FRR_BUILD_DIR >/dev/null 2>&1
|
||||
rsync -a --info=progress2 --chown root:root $FRR_DIR/. $FRR_BUILD_DIR/
|
||||
touch .sync_source
|
||||
log_info "Syncing FRR source with host..."
|
||||
mkdir -p $FRR_BUILD_DIR >/dev/null 2>&1
|
||||
rsync -a --info=progress2 --chown root:root $FRR_DIR/. $FRR_BUILD_DIR/
|
||||
touch .sync_source
|
||||
fi
|
||||
|
||||
log_info "Building FRR..."
|
||||
|
||||
cd $FRR_BUILD_DIR || \
|
||||
log_fatal "failed to find frr directory"
|
||||
log_fatal "failed to find frr directory"
|
||||
|
||||
if [ $CLEAN -ne 0 ]; then
|
||||
make distclean >/dev/null 2>&1
|
||||
rm -f Makefile configure
|
||||
make distclean >/dev/null 2>&1
|
||||
rm -f Makefile configure
|
||||
fi
|
||||
|
||||
if [ ! -f configure ]; then
|
||||
bash bootstrap.sh || \
|
||||
log_fatal "failed to bootstrap configuration"
|
||||
bash bootstrap.sh || \
|
||||
log_fatal "failed to bootstrap configuration"
|
||||
fi
|
||||
|
||||
if [ $DOC -ne 0 ]; then
|
||||
EXTRA_CONFIGURE+=" --enable-doc "
|
||||
EXTRA_CONFIGURE+=" --enable-doc "
|
||||
else
|
||||
EXTRA_CONFIGURE+=" --disable-doc "
|
||||
EXTRA_CONFIGURE+=" --disable-doc "
|
||||
fi
|
||||
|
||||
if [ ! -f Makefile ]; then
|
||||
if [ $SANITIZER -ne 0 ]; then
|
||||
export CC="gcc"
|
||||
export CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer"
|
||||
export LD="gcc"
|
||||
export LDFLAGS="-g -fsanitize=address -ldl"
|
||||
EXTRA_CONFIGURE+=" --enable-shared=no "
|
||||
touch .address_sanitizer
|
||||
else
|
||||
rm -f .address_sanitizer
|
||||
fi
|
||||
if [ $SANITIZER -ne 0 ]; then
|
||||
export CC="gcc"
|
||||
export CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer"
|
||||
export LD="gcc"
|
||||
export LDFLAGS="-g -fsanitize=address -ldl"
|
||||
EXTRA_CONFIGURE+=" --enable-shared=no "
|
||||
touch .address_sanitizer
|
||||
else
|
||||
rm -f .address_sanitizer
|
||||
fi
|
||||
|
||||
bash configure >/dev/null \
|
||||
--enable-multipath=64 \
|
||||
--prefix=/usr \
|
||||
--localstatedir=/var/run/frr \
|
||||
--sbindir=/usr/lib/frr \
|
||||
--sysconfdir=/etc/frr \
|
||||
$EXTRA_CONFIGURE \
|
||||
--with-pkg-extra-version=-topotests \
|
||||
|| log_fatal "failed to configure the sources"
|
||||
bash configure >/dev/null \
|
||||
--enable-multipath=64 \
|
||||
--prefix=/usr \
|
||||
--localstatedir=/var/run/frr \
|
||||
--sbindir=/usr/lib/frr \
|
||||
--sysconfdir=/etc/frr \
|
||||
$EXTRA_CONFIGURE \
|
||||
--with-pkg-extra-version=-topotests \
|
||||
|| log_fatal "failed to configure the sources"
|
||||
fi
|
||||
|
||||
# if '.address_sanitizer' file exists it means we are using address sanitizer.
|
||||
if [ -f .address_sanitizer ]; then
|
||||
make -C lib CFLAGS="-g -O2" LDFLAGS="-g" clippy
|
||||
make -C lib CFLAGS="-g -O2" LDFLAGS="-g" clippy
|
||||
fi
|
||||
|
||||
if [ $VERBOSE -ne 0 ]; then
|
||||
make -j$(cpu_count) || \
|
||||
log_fatal "failed to build the sources"
|
||||
make -j$(cpu_count) || \
|
||||
log_fatal "failed to build the sources"
|
||||
else
|
||||
make -j$(cpu_count) >/dev/null || \
|
||||
log_fatal "failed to build the sources"
|
||||
make -j$(cpu_count) >/dev/null || \
|
||||
log_fatal "failed to build the sources"
|
||||
fi
|
||||
|
||||
make install >/dev/null || \
|
||||
log_fatal "failed to install frr"
|
||||
log_fatal "failed to install frr"
|
||||
|
||||
exit 0
|
||||
|
||||
@ -31,19 +31,19 @@ CDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
#
|
||||
|
||||
OLD_IMAGE_SHA=$( \
|
||||
docker images | \
|
||||
egrep "^topotests" | \
|
||||
sed -r "s/( )+/ /g" | \
|
||||
cut -d " " -f 3 \
|
||||
docker images | \
|
||||
egrep "^topotests" | \
|
||||
sed -r "s/( )+/ /g" | \
|
||||
cut -d " " -f 3 \
|
||||
)
|
||||
|
||||
docker build --force-rm --pull --compress -t topotests . || \
|
||||
log_fatal "failed to generate topotest docker image"
|
||||
log_fatal "failed to generate topotest docker image"
|
||||
|
||||
if [ ! -z "$OLD_IMAGE_SHA" ]; then
|
||||
log_info "Removing old topotest image"
|
||||
docker rmi $OLD_IMAGE_SHA || \
|
||||
log_warning "failed to remove old image"
|
||||
log_info "Removing old topotest image"
|
||||
docker rmi $OLD_IMAGE_SHA || \
|
||||
log_warning "failed to remove old image"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@ -34,11 +34,11 @@ log_info "Configuring OpenvSwitch...."
|
||||
# Configure OpenvSwitch so we are able to run mininet
|
||||
mkdir -p /var/run/openvswitch
|
||||
ovsdb-tool create /etc/openvswitch/conf.db \
|
||||
/usr/share/openvswitch/vswitch.ovsschema
|
||||
/usr/share/openvswitch/vswitch.ovsschema
|
||||
ovsdb-server /etc/openvswitch/conf.db \
|
||||
--remote=punix:/var/run/openvswitch/db.sock \
|
||||
--remote=ptcp:6640 --pidfile=ovsdb-server.pid >/dev/null 2>/dev/null & \
|
||||
disown
|
||||
--remote=punix:/var/run/openvswitch/db.sock \
|
||||
--remote=ptcp:6640 --pidfile=ovsdb-server.pid >/dev/null 2>/dev/null & \
|
||||
disown
|
||||
ovs-vswitchd >/dev/null 2>/dev/null & disown
|
||||
|
||||
sleep 2
|
||||
@ -46,22 +46,22 @@ sleep 2
|
||||
ovs-vsctl --no-wait -- init
|
||||
ovs_version=$(ovs-vsctl -V | grep ovs-vsctl | awk '{print $4}')
|
||||
ovs_db_version=$(\
|
||||
ovsdb-tool schema-version /usr/share/openvswitch/vswitch.ovsschema)
|
||||
ovsdb-tool schema-version /usr/share/openvswitch/vswitch.ovsschema)
|
||||
ovs-vsctl --no-wait -- set Open_vSwitch . db-version="${ovs_db_version}"
|
||||
ovs-vsctl --no-wait -- set Open_vSwitch . ovs-version="${ovs_version}"
|
||||
ovs-vsctl --no-wait -- set Open_vSwitch . system-type="docker-ovs"
|
||||
ovs-vsctl --no-wait -- set Open_vSwitch . system-version="0.1"
|
||||
ovs-vsctl --no-wait -- \
|
||||
set Open_vSwitch . external-ids:system-id=`cat /proc/sys/kernel/random/uuid`
|
||||
set Open_vSwitch . external-ids:system-id=`cat /proc/sys/kernel/random/uuid`
|
||||
ovs-vsctl --no-wait -- set-manager ptcp:6640
|
||||
ovs-appctl -t ovsdb-server \
|
||||
ovsdb-server/add-remote db:Open_vSwitch,Open_vSwitch,manager_options
|
||||
ovsdb-server/add-remote db:Open_vSwitch,Open_vSwitch,manager_options
|
||||
|
||||
# Build FRR
|
||||
env \
|
||||
CLEAN=1 \
|
||||
VERBOSE=0 \
|
||||
bash /opt/topotests/compile_frr.sh
|
||||
CLEAN=1 \
|
||||
VERBOSE=0 \
|
||||
bash /opt/topotests/compile_frr.sh
|
||||
|
||||
log_info "Setting permissions on /tmp so we can generate logs"
|
||||
chmod -v 1777 /tmp
|
||||
|
||||
@ -33,38 +33,38 @@ TOPOTESTS_DIR=/root/topotests
|
||||
[ -z $SYNC_SOURCE ] && SYNC_SOURCE=0
|
||||
|
||||
log_info() {
|
||||
local msg=$1
|
||||
local msg=$1
|
||||
|
||||
echo -e "=> $msg"
|
||||
echo -e "=> $msg"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
local msg=$1
|
||||
local msg=$1
|
||||
|
||||
echo -e "E: $msg" 2>&1
|
||||
echo -e "E: $msg" 2>&1
|
||||
}
|
||||
|
||||
log_warning() {
|
||||
local msg=$1
|
||||
local msg=$1
|
||||
|
||||
echo -e "W: $msg" 2>&1
|
||||
echo -e "W: $msg" 2>&1
|
||||
}
|
||||
|
||||
log_fatal() {
|
||||
local msg=$1
|
||||
local msg=$1
|
||||
|
||||
echo -e "F: $msg" 2>&1
|
||||
echo -e "F: $msg" 2>&1
|
||||
|
||||
exit 1
|
||||
exit 1
|
||||
}
|
||||
|
||||
cpu_count() {
|
||||
local cpu_count
|
||||
local cpu_count
|
||||
|
||||
cpu_count=$(cat /proc/cpuinfo | grep -w processor | wc -l)
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -n $cpu_count
|
||||
else
|
||||
echo -n 2
|
||||
fi
|
||||
cpu_count=$(cat /proc/cpuinfo | grep -w processor | wc -l)
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -n $cpu_count
|
||||
else
|
||||
echo -n 2
|
||||
fi
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user