From 396501bbbfc1a49337b812acd66b7a89fc40a0b8 Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Fri, 28 Dec 2018 23:21:44 +0100 Subject: Rename build script to build-submodules and removed docker from the build process. The script was originally named `build-docker-subpackages` and executed docker for every package built. This has now changed so that the user could choose to do a docker or native build. The readme is aldo updated to reflect this change. --- scripts/build-docker-subpackages | 146 ----------------------------------- scripts/build-submodules | 159 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 146 deletions(-) delete mode 100755 scripts/build-docker-subpackages create mode 100755 scripts/build-submodules (limited to 'scripts') diff --git a/scripts/build-docker-subpackages b/scripts/build-docker-subpackages deleted file mode 100755 index 84e5333c..00000000 --- a/scripts/build-docker-subpackages +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -#set -x -if [ ! -d "packages" ]; then - echo "This script needs to be executed inside the top root of vyos-build" - exit 1 -fi - -status_start() { -echo -ne "[ ] $1" -} -status_ok() { -echo -ne "\r[\e[32m OK \e[39m]\n" -} - -status_fail() { -echo -ne "\r[\e[31mFAIL\e[39m]\n" -} - -status_skip() { -echo -ne "\r[SKIP] $1\n" -} - -error_msg() { -echo -ne " $1\n" -} - -echo "Cleaning up buildfiles..." -rm -rf packages/*.deb -rm -rf packages/*.changes -echo "-----------------------------------------------------" -echo "Starting build process for all packages" -echo "" -for PKG in mdns-repeater \ - pmacct \ - udp-broadcast-relay \ - vyatta-bash \ - vyatta-cfg \ - vyatta-cfg-firewall \ - vyatta-cfg-op-pppoe \ - vyatta-cfg-qos \ - vyatta-cfg-quagga \ - vyatta-cfg-system \ - vyatta-cfg-vpn \ - vyatta-cluster \ - vyatta-config-mgmt \ - vyatta-config-migrate \ - vyatta-conntrack \ - vyatta-conntrack-sync \ - vyatta-eventwatch \ - vyatta-iproute \ - vyatta-ipv6-rtradv \ - vyatta-lldp \ - vyatta-nat \ - vyatta-netflow \ - vyatta-op \ - vyatta-op-dhcp-server \ - vyatta-op-firewall \ - vyatta-op-qos \ - vyatta-op-quagga \ - vyatta-op-vpn \ - vyatta-openvpn \ - vyatta-ravpn \ - vyatta-vrrp \ - vyatta-wanloadbalance \ - vyatta-webgui \ - vyatta-webproxy \ - vyatta-wireless \ - vyatta-wirelessmodem \ - vyatta-zone \ - vyos-keepalived \ - vyos-nhrp \ - vyos-pppoe-server \ - vyos-strongswan \ - vyos-world \ - ; do - if [ -d "packages/$PKG/debian" ]; then - status_start "Building package: $PKG" - docker run --rm -it -v $(pwd):/vyos -w /vyos/packages/$PKG \ - --sysctl net.ipv6.conf.lo.disable_ipv6=0 \ - vyos-builder \ - dpkg-buildpackage -uc -us -tc -b >packages/$PKG.buildlog 2>&1 - if [ $? -ne 0 ]; then - status_fail - error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n" - else - status_ok - fi - else - status_skip "No source for: $PKG" - fi -done - -# KERNEL -if [ -f "packages/vyos-kernel/Makefile" ]; then - status_start "Building-package: vyos-kernel" - docker run --rm -it -v $(pwd):/vyos -w /vyos/packages/vyos-kernel \ - --sysctl net.ipv6.conf.lo.disable_ipv6=0 \ - vyos-builder \ - bash -c '../../scripts/build-kernel' >packages/vyos-kernel.buildlog 2>&1 - if [ $? -ne 0 ]; then - status_fail - error_msg "Failed to build package vyos-kernel, look in vyos-kernel.buildlog to examine the fault\n" - else - VERSION=$(grep "^VERSION" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') - PATCHLEVEL=$(grep "^PATCHLEVEL" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') - SUBLEVEL=$(grep "^SUBLEVEL" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') - ARCH=$(dpkg --print-architecture) - sed -i.bak "s/--linux-packages .* \\\/--linux-packages linux-image-$VERSION\.$PATCHLEVEL\.$SUBLEVEL \\\/" scripts/live-build-config - status_ok - fi -else - status_skip "No source for: vyos-kernel" -fi - - - -# WIREGUARD -if [ -d "packages/vyos-wireguard/debian" ]; then - if [ -f "packages/vyos-kernel/Makefile" ]; then - status_start "Building package: vyos-wireguard" - if grep -q "KBUILD_OUTPUT" packages/vyos-kernel/Makefile; then - VERSION=$(grep "^VERSION" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') - PATCHLEVEL=$(grep "^PATCHLEVEL" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') - SUBLEVEL=$(grep "^SUBLEVEL" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') - ARCH=$(dpkg --print-architecture) - echo "src/wireguard.ko /lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL-$ARCH-vyos/extra" > packages/vyos-wireguard/debian/wireguard-modules.install - docker run --rm -it -v $(pwd):/vyos -w /vyos/packages/vyos-wireguard \ - --sysctl net.ipv6.conf.lo.disable_ipv6=0 \ - vyos-builder \ - bash -c 'KERNELDIR=/vyos/packages/vyos-kernel dpkg-buildpackage -uc -us -tc -b' >packages/vyos-wireguard.buildlog 2>&1 - if [ $? -ne 0 ]; then - status_fail - error_msg "Failed to build package vyos-wireguard, look in vyos-wireguard.buildlog to examine the fault\n" - else - status_ok - fi - else - status_fail - error_msg "Failed to build package vyos-wireguard, no kernel source found\n" - fi - else - seeor_msg "Something wrong with the kernel module?" - fi -else - status_skip "No source for: vyos-wireguard" -fi diff --git a/scripts/build-submodules b/scripts/build-submodules new file mode 100755 index 00000000..1981759f --- /dev/null +++ b/scripts/build-submodules @@ -0,0 +1,159 @@ +#!/bin/bash +#set -x +if [ ! -d "packages" ]; then + echo "This script needs to be executed inside the top root of vyos-build" + exit 1 +fi + +if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then + echo "Script for building all subpackages to vyos" + echo "Execute this sctipt from the root of the vyos-build directory" + echo "" + echo "This script could be executed from a Debian Jessie installation with all dependencies" + echo "or from the vyos-builder docker container" + echo "docker instructions" + echo "Build the container:" + echo " docker build -t vyos-builder ." + echo "Compile packages:" + echo " docker run --rm -it -v $(pwd):/vyos -w /vyos --sysctl net.ipv6.conf.lo.disable_ipv6=0 vyos-builder scripts/build-docker-subpaclages" +fi + +status_start() { +echo -ne "[ ] $1" +} +status_ok() { +echo -ne "\r[\e[32m OK \e[39m]\n" +} + +status_fail() { +echo -ne "\r[\e[31mFAIL\e[39m]\n" +} + +status_skip() { +echo -ne "\r[SKIP] $1\n" +} + +error_msg() { +echo -ne " $1\n" +} +ROOTDIR="$(pwd)" +PKGDIR="$(pwd)/packages" + +echo "Cleaning up buildfiles..." +rm -rf $PKGDIR/*.deb +rm -rf $PKGDIR/*.changes +rm -rf $PKGDIR/*.buildlog +echo "-----------------------------------------------------" +echo "Starting build process for all packages" +echo "" +for PKG in mdns-repeater \ + pmacct \ + udp-broadcast-relay \ + vyatta-bash \ + vyatta-cfg \ + vyatta-cfg-firewall \ + vyatta-cfg-op-pppoe \ + vyatta-cfg-qos \ + vyatta-cfg-quagga \ + vyatta-cfg-system \ + vyatta-cfg-vpn \ + vyatta-cluster \ + vyatta-config-mgmt \ + vyatta-config-migrate \ + vyatta-conntrack \ + vyatta-conntrack-sync \ + vyatta-eventwatch \ + vyatta-iproute \ + vyatta-ipv6-rtradv \ + vyatta-lldp \ + vyatta-nat \ + vyatta-netflow \ + vyatta-op \ + vyatta-op-dhcp-server \ + vyatta-op-firewall \ + vyatta-op-qos \ + vyatta-op-quagga \ + vyatta-op-vpn \ + vyatta-openvpn \ + vyatta-ravpn \ + vyatta-vrrp \ + vyatta-wanloadbalance \ + vyatta-webgui \ + vyatta-webproxy \ + vyatta-wireless \ + vyatta-wirelessmodem \ + vyatta-zone \ + vyos-keepalived \ + vyos-nhrp \ + vyos-pppoe-server \ + vyos-strongswan \ + vyos-world \ + ; do + if [ -d "packages/$PKG/debian" ]; then + status_start "Building package: $PKG" + pushd $PKGDIR/$PKG > /dev/null + dpkg-buildpackage -uc -us -tc -b >$PKGDIR/$PKG.buildlog 2>&1 + if [ $? -ne 0 ]; then + status_fail + error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n" + else + status_ok + fi + popd > /dev/null + else + status_skip "No source for: $PKG" + fi +done + +# KERNEL +if [ -f "packages/vyos-kernel/Makefile" ]; then + status_start "Building-package: vyos-kernel" + pushd packages/vyos-kernel > /dev/null + bash -c '../../scripts/build-kernel' >$PKGDIR/vyos-kernel.buildlog 2>&1 + if [ $? -ne 0 ]; then + status_fail + error_msg "Failed to build package vyos-kernel, look in vyos-kernel.buildlog to examine the fault\n" + else + VERSION=$(grep "^VERSION" Makefile | grep -Eo '[0-9]{1,4}') + PATCHLEVEL=$(grep "^PATCHLEVEL" Makefile | grep -Eo '[0-9]{1,4}') + SUBLEVEL=$(grep "^SUBLEVEL" Makefile | grep -Eo '[0-9]{1,4}') + ARCH=$(dpkg --print-architecture) + sed -i.bak "s/--linux-packages .* \\\/--linux-packages linux-image-$VERSION\.$PATCHLEVEL\.$SUBLEVEL \\\/" $ROOTDIR/scripts/live-build-config + status_ok + fi + popd > /dev/null +else + status_skip "No source for: vyos-kernel" +fi + + + +# WIREGUARD +if [ -d "packages/vyos-wireguard/debian" ]; then + if [ -f "packages/vyos-kernel/Makefile" ]; then + status_start "Building package: vyos-wireguard" + if grep -q "KBUILD_OUTPUT" packages/vyos-kernel/Makefile; then + VERSION=$(grep "^VERSION" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + PATCHLEVEL=$(grep "^PATCHLEVEL" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + SUBLEVEL=$(grep "^SUBLEVEL" packages/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + ARCH=$(dpkg --print-architecture) + pushd packages/vyos-wireguard > /dev/null + echo "src/wireguard.ko /lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL-$ARCH-vyos/extra" > debian/wireguard-modules.install + bash -c 'KERNELDIR=/vyos/packages/vyos-kernel dpkg-buildpackage -uc -us -tc -b' >$PKGDIR/vyos-wireguard.buildlog 2>&1 + if [ $? -ne 0 ]; then + status_fail + error_msg "Failed to build package vyos-wireguard, look in vyos-wireguard.buildlog to examine the fault\n" + else + status_ok + fi + popd > /dev/null + else + status_fail + error_msg "Failed to build package vyos-wireguard, no kernel source found\n" + fi + else + seeor_msg "Something wrong with the kernel module?" + fi +else + status_skip "No source for: vyos-wireguard" +fi -- cgit v1.2.3