diff options
32 files changed, 887 insertions, 305 deletions
@@ -3,3 +3,4 @@ build/* packer_build/* packer_cache/* key/* +packages/*.buildlog diff --git a/.gitmodules b/.gitmodules index a6c4072e..22bb87d5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,144 +1,239 @@ [submodule "packages/vyatta-bash"] path = packages/vyatta-bash url = https://github.com/vyos/vyatta-bash.git + branch = current [submodule "packages/vyatta-cfg"] path = packages/vyatta-cfg url = https://github.com/vyos/vyatta-cfg.git + branch = current [submodule "packages/vyatta-op"] path = packages/vyatta-op url = https://github.com/vyos/vyatta-op.git + branch = current [submodule "packages/vyatta-cfg-system"] path = packages/vyatta-cfg-system url = https://github.com/vyos/vyatta-cfg-system.git + branch = current [submodule "packages/vyatta-cfg-firewall"] path = packages/vyatta-cfg-firewall url = https://github.com/vyos/vyatta-cfg-firewall.git + branch = current [submodule "packages/vyatta-op-firewall"] path = packages/vyatta-op-firewall url = https://github.com/vyos/vyatta-op-firewall.git + branch = current [submodule "packages/vyatta-cfg-vpn"] path = packages/vyatta-cfg-vpn url = https://github.com/vyos/vyatta-cfg-vpn.git + branch = current [submodule "packages/vyatta-op-vpn"] path = packages/vyatta-op-vpn url = https://github.com/vyos/vyatta-op-vpn.git + branch = current [submodule "packages/vyatta-cfg-qos"] path = packages/vyatta-cfg-qos url = https://github.com/vyos/vyatta-cfg-qos.git + branch = current [submodule "packages/vyatta-op-qos"] path = packages/vyatta-op-qos url = https://github.com/vyos/vyatta-op-qos.git + branch = current [submodule "packages/vyatta-cfg-op-pppoe"] path = packages/vyatta-cfg-op-pppoe url = https://github.com/vyos/vyatta-cfg-op-pppoe.git + branch = current [submodule "packages/vyatta-openvpn"] path = packages/vyatta-openvpn url = https://github.com/vyos/vyatta-openvpn.git + branch = current [submodule "packages/vyatta-conntrack"] path = packages/vyatta-conntrack url = https://github.com/vyos/vyatta-conntrack.git + branch = current [submodule "packages/vyatta-conntrack-sync"] path = packages/vyatta-conntrack-sync url = https://github.com/vyos/vyatta-conntrack-sync.git + branch = current [submodule "packages/vyatta-nat"] path = packages/vyatta-nat url = https://github.com/vyos/vyatta-nat.git + branch = current [submodule "packages/vyatta-config-mgmt"] path = packages/vyatta-config-mgmt url = https://github.com/vyos/vyatta-config-mgmt.git + branch = current [submodule "packages/vyatta-config-migrate"] path = packages/vyatta-config-migrate url = https://github.com/vyos/vyatta-config-migrate.git + branch = current [submodule "packages/vyatta-zone"] path = packages/vyatta-zone url = https://github.com/vyos/vyatta-zone.git + branch = current [submodule "packages/vyatta-cluster"] path = packages/vyatta-cluster url = https://github.com/vyos/vyatta-cluster.git -[submodule "packages/vyatta-vrrp"] - path = packages/vyatta-vrrp - url = https://github.com/vyos/vyatta-vrrp.git + branch = current [submodule "packages/vyatta-eventwatch"] path = packages/vyatta-eventwatch url = https://github.com/vyos/vyatta-eventwatch.git + branch = current [submodule "packages/vyatta-webproxy"] path = packages/vyatta-webproxy url = https://github.com/vyos/vyatta-webproxy.git + branch = current [submodule "packages/vyatta-webgui"] path = packages/vyatta-webgui url = https://github.com/vyos/vyatta-webgui.git + branch = current [submodule "packages/vyatta-cfg-quagga"] path = packages/vyatta-cfg-quagga url = https://github.com/vyos/vyatta-cfg-quagga.git + branch = current [submodule "packages/vyatta-op-quagga"] path = packages/vyatta-op-quagga url = https://github.com/vyos/vyatta-op-quagga.git + branch = current [submodule "packages/vyatta-op-dhcp-server"] path = packages/vyatta-op-dhcp-server url = https://github.com/vyos/vyatta-op-dhcp-server.git + branch = current [submodule "packages/vyatta-wireless"] path = packages/vyatta-wireless url = https://github.com/vyos/vyatta-wireless.git + branch = current [submodule "packages/vyatta-wirelessmodem"] path = packages/vyatta-wirelessmodem url = https://github.com/vyos/vyatta-wirelessmodem.git + branch = current [submodule "packages/vyatta-wanloadbalance"] path = packages/vyatta-wanloadbalance url = https://github.com/vyos/vyatta-wanloadbalance.git + branch = current [submodule "packages/vyatta-netflow"] path = packages/vyatta-netflow url = https://github.com/vyos/vyatta-netflow.git + branch = current [submodule "packages/vyatta-lldp"] path = packages/vyatta-lldp url = https://github.com/vyos/vyatta-lldp.git + branch = current [submodule "packages/vyatta-ipv6-rtradv"] path = packages/vyatta-ipv6-rtradv url = https://github.com/vyos/vyatta-ipv6-rtradv.git + branch = current [submodule "packages/vyatta-ravpn"] path = packages/vyatta-ravpn url = https://github.com/vyos/vyatta-ravpn.git -[submodule "packages/vyos-pppoe-server"] - path = packages/vyos-pppoe-server - url = https://github.com/vyos/vyos-pppoe-server.git + branch = current [submodule "packages/vyos-nhrp"] path = packages/vyos-nhrp url = https://github.com/vyos/vyos-nhrp.git + branch = current [submodule "packages/vyatta-util"] path = packages/vyatta-util url = https://github.com/vyos/vyatta-util.git + branch = current [submodule "packages/vyos-world"] path = packages/vyos-world url = https://github.com/vyos/vyos-world.git + branch = current [submodule "packages/vyos-kernel"] path = packages/vyos-kernel url = https://github.com/vyos/vyos-kernel.git + branch = linux-vyos-4.19.y [submodule "packages/vyos-1x"] path = packages/vyos-1x url = https://github.com/vyos/vyos-1x.git + branch = current [submodule "packages/mdns-repeater"] path = packages/mdns-repeater url = https://github.com/vyos/mdns-repeater.git + branch = current [submodule "packages/udp-broadcast-relay"] path = packages/udp-broadcast-relay url = https://github.com/vyos/udp-broadcast-relay.git + branch = current [submodule "packages/vyos-keepalived"] path = packages/vyos-keepalived url = https://github.com/vyos/vyos-keepalived.git + branch = current [submodule "packages/vyatta-iproute"] path = packages/vyatta-iproute url = https://github.com/vyos/vyatta-iproute.git + branch = iproute2-vyos-4.18.y [submodule "packages/vyatta-quagga"] path = packages/vyatta-quagga url = https://github.com/vyos/vyatta-quagga.git + branch = current [submodule "packages/vyos-wireguard"] path = packages/vyos-wireguard - url = https://github.com/vyos/vyos-wireguard + url = https://github.com/vyos/vyos-wireguard.git + branch = current [submodule "packages/pmacct"] path = packages/pmacct - url = https://github.com/vyos/pmacct + url = https://github.com/vyos/pmacct.git + branch = current [submodule "packages/vyos-strongswan"] path = packages/vyos-strongswan - url = https://github.com/vyos/vyos-strongswan -[submodule "packages/vyos-frr"] - path = packages/vyos-frr - url = https://github.com/vyos/vyos-frr.git + url = https://github.com/vyos/vyos-strongswan.git + branch = current +[submodule "packages/vyos-accel-ppp"] + path = packages/vyos-accel-ppp + url = https://github.com/vyos/vyos-accel-ppp.git + branch = current +[submodule "packages/frr"] + path = packages/frr + url = https://github.com/FRRouting/frr.git + branch = master +[submodule "packages/conntrack-tools"] + path = packages/conntrack-tools + url = https://github.com/vyos/conntrack-tools.git + branch = current +[submodule "packages/eventwatchd"] + path = packages/eventwatchd + url = https://github.com/vyos/eventwatchd.git + branch = current +[submodule "packages/ddclient"] + path = packages/ddclient + url = https://github.com/vyos/ddclient.git + branch = current +[submodule "packages/vyatta-biosdevname"] + path = packages/vyatta-biosdevname + url = https://github.com/vyos/vyatta-biosdevname.git + branch = current +[submodule "packages/vyos-opennhrp"] + path = packages/vyos-opennhrp + url = https://github.com/vyos/vyos-opennhrp.git + branch = current +[submodule "packages/vyos-salt-minion"] + path = packages/vyos-salt-minion + url = https://github.com/vyos/vyos-salt-minion.git + branch = current +[submodule "packages/rtrlib"] + path = packages/rtrlib + url = https://github.com/rtrlib/rtrlib.git +[submodule "packages/libvyosconfig"] + path = packages/libvyosconfig + url = https://github.com/vyos/libvyosconfig.git + branch = master +[submodule "packages/vyos-vmwaretools-scripts"] + path = packages/vyos-vmwaretools-scripts + url = https://github.com/vyos/vyos-vmwaretools-scripts.git + branch = current +[submodule "packages/vyconf"] + path = packages/vyconf + url = https://github.com/vyos/vyconf.git + branch = master +[submodule "packages/vyos-netplug"] + path = packages/vyos-netplug + url = https://github.com/vyos/vyos-netplug.git + branch = current +[submodule "packages/vyos-xe-guest-utilities"] + path = packages/vyos-xe-guest-utilities + url = http://github.com/vyos/vyos-xe-guest-utilities.git + branch = current +[submodule "packages/igmpproxy"] + path = packages/igmpproxy + url = https://github.com/vyos/igmpproxy.git + branch = current
\ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index b8ec8149..00000000 --- a/Dockerfile +++ /dev/null @@ -1,147 +0,0 @@ -# Must be run with --privileged flag -# Recommended to run the container with a volume mapped -# in order to easy exprort images built to "external" world -FROM debian:jessie - -RUN echo 'deb http://ftp.debian.org/debian jessie-backports main' | tee -a /etc/apt/sources.list &&\ - apt-get update &&\ - apt-get install -y \ - vim \ - git \ - make \ - sudo \ - locales \ - live-build \ - pbuilder \ - devscripts \ - python3-pystache \ - squashfs-tools \ - autoconf \ - dpkg-dev \ - syslinux \ - genisoimage \ - lsb-release \ - fakechroot \ - kernel-package \ - libtool \ - libglib2.0-dev \ - libboost-filesystem-dev \ - libapt-pkg-dev \ - flex \ - bison \ - libperl-dev \ - libnfnetlink-dev \ - python3-git \ - parted \ - kpartx \ - jq \ - qemu-system-x86 \ - qemu-utils \ - quilt \ - python3-lxml \ - python3-setuptools \ - python3-nose \ - python3-coverage - -# Packages needed for building vyos-strongswan -RUN apt-get install -y -t jessie-backports \ - debhelper &&\ - apt-get install -y \ - dh-apparmor \ - gperf \ - iptables-dev \ - libcap-dev \ - libgcrypt20-dev \ - libgmp3-dev \ - libldap2-dev \ - libpam0g-dev \ - libsystemd-dev \ - libgmp-dev \ - iptables \ - xl2tpd \ - libcurl4-openssl-dev \ - libcurl4-openssl-dev \ - libkrb5-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - pkg-config - -# Package needed for mdns-repeater -RUN apt-get install -y -t jessie-backports \ - dh-systemd - -# Packages needed for vyatta-bash -RUN apt-get install -y \ - libncurses5-dev \ - locales - -# Packages needed for vyatta-cfg -RUN apt-get install -y \ - libboost-filesystem-dev - -# Packages needed for vyatta-iproute -RUN apt-get install -y \ - libatm1-dev \ - libdb-dev - -# Packages needed for vyatta-webgui -RUN apt-get install -y \ - libexpat1-dev \ - subversion - -# Packages needed for pmacct -RUN apt-get install -y \ - libpcap-dev \ - libpq-dev \ - libmysqlclient-dev \ - libgeoip-dev \ - librabbitmq-dev \ - libjansson-dev \ - librdkafka-dev \ - libnetfilter-log-dev - -# Packages needed for vyos-keepalived -RUN apt-get install -y \ - libnl-3-dev \ - libnl-genl-3-dev \ - libpopt-dev \ - libsnmp-dev - -# Pavkages needed for wireguard -RUN apt-get install -y \ - libmnl-dev - -# Packages needed for kernel -RuN apt-get install -y \ - libelf-dev - -# Update live-build -RUN echo 'deb http://ftp.debian.org/debian stretch main' | tee -a /etc/apt/sources.list.d/stretch.list &&\ - apt-get update &&\ - apt-get install -y -t stretch live-build &&\ - rm -f /etc/apt/sources.list.d/stretch.list &&\ - apt-get update &&\ - rm -rf /var/lib/apt/lists/* - -# Standard shell should be bash not dash -RUN echo "dash dash/sh boolean false" | debconf-set-selections && \ - DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash - -RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen -ENV LANG en_US.utf8 - -# Install packer -RUN export LATEST="$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | \ - jq -r -M '.current_version')"; \ - echo "url https://releases.hashicorp.com/packer/"$LATEST"/packer_"$LATEST"_linux_amd64.zip" |\ - curl -K- | gzip -d > /usr/bin/packer && \ - chmod +x /usr/bin/packer - -# Create vyos_bld user account and enable sudo -RUN useradd -ms /bin/bash -u 1006 --gid users vyos_bld && \ - usermod -aG sudo vyos_bld && \ - echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers - -USER vyos_bld -WORKDIR /home/vyos_bld diff --git a/Jenkinsfile b/Jenkinsfile index d46fdcbf..4bc64b26 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,29 +21,61 @@ pipeline { dockerfile { filename 'Dockerfile' label 'jessie-amd64' - args '--privileged' + dir 'docker' + args '--privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 -e GOSU_UID=1006 -e GOSU_GID=1006' } } stages { - stage('Configure') { + stage('Submodule Init') { steps { - sh './configure --build-by="autobuild@vyos.net" --debian-mirror="http://ftp.us.debian.org/debian/"' + sh ''' + git submodule update --init --recursive --remote + ''' } } + stage('Build Packages') { + steps { + sh ''' + #!/bin/sh + scripts/build-submodules --verbose + ''' + } + } + stage('Build ISO') { steps { - sh 'sudo make iso' + sh ''' + #!/bin/sh + + # we do not want to fetch VyOS packages from the mirror, + # we rather prefer all build by ourself! + sed -i '/vyos_repo_entry/d' scripts/live-build-config + + # Configure the ISO + ./configure --build-by="autobuild@vyos.net" --debian-mirror="http://ftp.us.debian.org/debian/" + + # Debug to see which Debian packages we have so far + ls -al packages/*.deb + + # Finally build our ISO + sudo make iso + ''' } } } post { - always { + cleanup { echo 'One way or another, I have finished' - // change build dir file permissions so wen can cleanup as regular - // user (jenkins) afterwards - sh 'sudo chmod -R 777 .' + // the 'build' directory got elevated permissions during the build + // cdjust permissions so it can be cleaned up by the regular user + sh ''' + #!/bin/bash + if [ -d build ]; then + sudo chmod -R 777 build/ + fi + ''' deleteDir() /* cleanup our workspace */ } } @@ -3,9 +3,9 @@ VyOS toplevel build # Important! -This repository is for building the VyOS version 1.2.0 and above. -For VyOS 1.1.x, use the build-iso repository. +This repository is for building the VyOS versions 1.2.x and above. +For VyOS 1.1, use the [build-iso](https://github.com/vyos/build-iso) repository. # What is VyOS @@ -40,7 +40,7 @@ There are several directories with their own purpose: build/ Used for temporary files used for the build and for build artifacts scripts/ Scripts that are used for the build process - data/ Data required for buildng the ISO (such as boot splash) + data/ Data required for building the ISO (such as boot splash) tools/ Scripts that are used for maintainer's tasks automation and other purposes, but not during ISO build process @@ -48,12 +48,14 @@ There are several directories with their own purpose: ## Prerequisites -To build a VyOS 1.2.0 image, you need Debian 8 "Jessie" environment (with jessie-backports repository). +To build a VyOS 1.2.0 image, you need Debian 8 "Jessie" environment (with +jessie-backports repository). -If you do not have a Debian Jessie machine, you may create a chroot environment with the -[debootstrap](https://wiki.debian.org/Debootstrap) tool. +If you do not have a Debian Jessie machine, you may create a chroot environment +with the [debootstrap](https://wiki.debian.org/Debootstrap) tool. -For example, on another version of Debian or another Debian-based distro, these commands will work: +For example, on another version of Debian or another Debian-based distro, these +commands will work: ```bash $ sudo apt-get install debootstrap @@ -64,8 +66,9 @@ $ echo "deb http://deb.debian.org/debian jessie-backports main" >> /etc/apt/sour $ apt-get update ``` -If you are working on a Debian Jessie machine, no special preparation is needed, you only -need to enable jessie-backports and install build dependencies. +If you are working on a Debian Jessie machine, no special preparation is needed, +you only need to enable jessie-backports and install build dependencies. An +up-to-date dependency list can be found in our [Dockerfile](docker/Dockerfile). Several packages are required for building the ISO: * `python3` @@ -79,9 +82,11 @@ package build scripts will tell you. ## Building the ISO image inside a docker container -Using our `Dockerfile` you can create your own Docker container that can be used -to build a VyOS ISO image. The `Dockerfile` contains some of the most used -packages needed to build a VyOS ISO, a qemu image, and several of the submodules. +Using our [Dockerfile](docker/Dockerfile) you create your own Docker container +that is used to build a VyOS ISO image or other required VyOS packages. The +[Dockerfile](docker/Dockerfile) contains some of the most used packages needed +to build a VyOS ISO, a qemu image, and several of the submodules. Please note +that this is not complete and only gives you a brief overview! ``` squashfs-tools # Required for squashfs file system @@ -114,70 +119,73 @@ python3-lxml # Optional, for building vyos-1x python3-setuptools # Optional, for building vyos-1x python3-nose # Optional, for building vyos-1x python3-coverage # Optional, for building vyos-1x +... ``` -To build the docker image: -``` -docker build -t vyos-builder $PATH_TO_Dockerfile -``` +To build the docker image ensure you have a working [Docker](https://www.docker.com) +environment and then run the following commands: -### Linux - -To run the docker image: -``` -docker run -it --privileged -v /HOST_PATH_OF_VYOS_BUILD_REPO:/vyos -w="/vyos" vyos-builder bash +```bash +$ docker build -t vyos-builder docker ``` -This will drop you into a bash shell with this vyos-build repo mounted at /vyos. -Then follow the instructions bellow to build the VyOS iso and qemu image. +Run the newly built container: +```bash +$ docker run --rm -it --privileged -v $(pwd):/vyos -w /vyos vyos-builder bash +``` -### MacOS and Windows +This will drop you into a bash shell with this vyos-build repo mounted at +`/vyos`. Then follow the instructions bellow to build the VyOS ISO and QEMU +image. -To run the docker image: -``` -docker run -dt --privileged -v /HOST_PATH/images:/vyos --name=vyos_node_builder vyos-builder bash +```bash +vyos_bld@948a2be7c52c:/vyos$ uname -a +Linux 948a2be7c52c 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) x86_64 GNU/Linux ``` -NOTE: +**NOTE:** * Docker container must be run with `--privileged` flag * We recommended to run the container with a volume mapped in order to easy export built VyOS ISO images to the "external" world +* UNIX ownership is automatically inherited from your host directory but can be + altered by specifying the following environment variables when running the + container: `-e GOSU_UID=$(id -u)` and/or `-e GOSU_GID=$(id -g)` -To connect to the docker image once is running: -``` -docker exec -it vyos_node_builder bash -``` - -After the docker container is running you can git clone the vyos-build repository -inside the container and follow up the bellow instructions in order to build the -VyOS ISO image +After the Docker container is running you can follow up the instructions below in +order to build the VyOS ISO image. ## Building subpackages inside Docker + Prior to building packages you need to checkout and update the submodules you want to compile + ```bash -git submodule update --init packages/PACKAGENAME -cd packages/PACKAGENAME -git checkout BRANCH +$ git submodule update --init packages/PACKAGENAME +$ cd packages/PACKAGENAME +$ git checkout BRANCH ``` + `PACKAGENAME` is the name of the package you want to compile -`BRANCH` is for Crux(1.2) `crux`, for latest rolling use `current` +`BRANCH` is `crux` for VyOS 1.2.x, latest rolling releases use `current` +Fetching all submodules at once and update them to the recent remote branches +`HEAD` is done by calling: -### Pulling all packages -Use this with caution, only run this on a unmodified newly cloned repository ```bash -for dir in packages/*; do - git submodule update --init $dir - pushd $dir - git checkout current - popd -done +$ git submodule update --init --recursive +$ git submodule update --remote ``` + ### Building packages -The script `./scripts/build-submodules` is created to automate the process of building packages, execute it in the root of `vyos-build` to start compilation on all supported packages that are checked out. -The easiest way to compile is with the `vyos-builder` docker container, it includes all dependencies for compiling supported packages. +The [scripts/build-submodules](scripts/build-submodules) script is used to +automate the process of building (in the future) all VyOS related packages that +are not part of the upstream Debian version. Execute it in the root of the +`vyos-build` directory to start compilation on all supported packages that are +checked out. + +The easiest way to compile is with the above mentioned [Docker](docker/Dockerfile) +container, it includes all dependencies for compiling supported packages. ```bash $ docker run --rm -it -v $(pwd):/vyos -w /vyos \ @@ -186,37 +194,52 @@ $ docker run --rm -it -v $(pwd):/vyos -w /vyos \ ./scripts/build-submodules ``` -NOTE: Prior to executing this script you need to create/build the `vyos-builder` container and checkout all packages you want to compile. +**NOTE:** `--sysctl net.ipv6.conf.lo.disable_ipv6=0` is required to build the +`vyos-strongswan` package + +**NOTE:** Prior to executing this script you need to create or build the Docker +container and checkout all packages you want to compile. + +### Building a single package + +The script above runs all package build inside the Docker container, this is also +possible to do by hand using: + +Executed from the root of `vyos-build` -### Building one package -the script above runs all package build inside a docker container, this is also possible to do by hand using: -Executed from the root directory of vyos-build ```bash $ docker run --rm -it -v $(pwd):/vyos -w /vyos/packages/PACKAGENAME \ --sysctl net.ipv6.conf.lo.disable_ipv6=0 \ vyos-builder \ dpkg-buildpackage -uc -us -tc -b ``` -NOTE: `--sysctl net.ipv6.conf.lo.disable_ipv6=0` is only needed when building vyos-strongswan and can be ignored on other packages -NOTE: Prior to executing this you need to checkout and update the submodules you want to recompile -NOTE: vyos-strongswan will only compile on a linux system, running on osx or windows migth result in a unittest lockup. (it never exits) -Packages that are known to not build using this procedure: +**NOTE:** `--sysctl net.ipv6.conf.lo.disable_ipv6=0` is only needed when +building `vyos-strongswan` and can be ignored on other packages. + +**NOTE:** Prior to executing this you need to checkout and update the submodules +you want to recompile! + +**NOTE:** `vyos-strongswan` will only compile on a Linux system, running on macOS +or Windows might result in a unittest deadlock (it never exits). + +Packages that are known to not build using this procedure (as of now): + ``` vyatta-util - Not needed anymore -vyatta-quagga - Not needed anymore +vyatta-quagga - Not needed anymore vyos-1x - Unmet build dependencies: whois libvyosconfig0 -vyos-frr - Alott of requirements, scary stuff... +vyos-frr - A lot of requirements, scary stuff... vyos-kernel - Need special build instructions vyos-wireguard - Needs special build instructions ``` - ## Building the ISO image Before you can build an image, you need to configure your build. To build an image, use the following commands: + ```bash $ ./configure $ make iso @@ -230,6 +253,7 @@ with `--help` ### QEMU Run following command after building the ISO image. + ```bash $ make qemu ``` @@ -237,6 +261,7 @@ $ make qemu ### VMware Run following command after building the QEMU image. + ```bash $ make vmware ``` @@ -248,7 +273,7 @@ $ make vmware The default branch that contains the most recent VyOS code is called `current` rather than `master`. We know it's confusing, but it's not easy to fix. In a nutshell, the code we inherited from Vyatta Core had its `master` branch so out -of sync with everything it was beyong any repair. Vyatta developers used to create +of sync with everything it was beyond any repair. Vyatta developers used to create a new branch not when a release is ready for code freeze, but rather before starting to work on a new release. This is hard to change in existing code, so this is just the way it is, for now. @@ -262,8 +287,6 @@ In packages that originate from VyOS the master branch is kept in sync with last legacy package is gone, we will switch to using the `master` branch and retire `current`. -For branch naming we use chemical elements: -* hydrogen -* helium -* lithium +For branch naming we switched to use constellations: +* `crux` * ... diff --git a/data/live-build-config/hooks/live/08-sysconf.chroot b/data/live-build-config/hooks/live/08-sysconf.chroot index 8d1616c0..d403d04b 100755 --- a/data/live-build-config/hooks/live/08-sysconf.chroot +++ b/data/live-build-config/hooks/live/08-sysconf.chroot @@ -38,6 +38,10 @@ update_sysctl_conf net.ipv4.ip_forward 1 \ # "enable ipv6 forwarding" update_sysctl_conf net.core.rmem_max 223232 \ "maximize netlink buffers" +update_sysctl_conf net.ipv4.conf.all.send_redirects 0 \ + "disable IPv4 ICMP redirects" +update_sysctl_conf net.ipv4.conf.default.send_redirects 0 \ + "disable IPv4 ICMP redirects" # Local Variables: # mode: shell-script diff --git a/data/package-lists/vyos-dev.list.chroot b/data/package-lists/vyos-dev.list.chroot index b2bf0cfe..63e7cc2c 100644 --- a/data/package-lists/vyos-dev.list.chroot +++ b/data/package-lists/vyos-dev.list.chroot @@ -2,3 +2,4 @@ gdb strace aptitude apt-rdepends +linux-perf diff --git a/data/package-lists/vyos-x86.list.chroot b/data/package-lists/vyos-x86.list.chroot index a852e5fb..5bb0dbd7 100644 --- a/data/package-lists/vyos-x86.list.chroot +++ b/data/package-lists/vyos-x86.list.chroot @@ -3,3 +3,5 @@ grub-pc open-vm-tools qemu-guest-agent hyperv-daemons +vyos-xe-guest-utilities +vyos-netplug diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..bca48ff8 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,267 @@ +# Must be run with --privileged flag +# Recommended to run the container with a volume mapped +# in order to easy exprort images built to "external" world +FROM debian:jessie + +ENV DEBIAN_FRONTEND noninteractive + +# Standard shell should be bash not dash +RUN echo "dash dash/sh boolean false" | debconf-set-selections && \ + dpkg-reconfigure dash + +RUN apt-get update && apt-get install -y \ + dialog \ + apt-utils \ + locales + +RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen +ENV LANG en_US.utf8 + +RUN apt-get update && apt-get install -y \ + vim \ + git \ + curl \ + make \ + sudo \ + mc \ + live-build \ + pbuilder \ + devscripts \ + python3-pystache \ + squashfs-tools \ + autoconf \ + automake \ + dpkg-dev \ + syslinux \ + genisoimage \ + lsb-release \ + fakechroot \ + kernel-package \ + libtool \ + libglib2.0-dev \ + libboost-filesystem-dev \ + libapt-pkg-dev \ + libncurses5-dev \ + flex \ + bison \ + libperl-dev \ + libnfnetlink-dev \ + parted \ + kpartx \ + jq \ + qemu-system-x86 \ + qemu-utils \ + quilt \ + python3-lxml \ + python3-setuptools \ + python3-nose \ + python3-coverage \ + python3-sphinx + +# Add Debian jessie-backports support +RUN echo 'deb http://ftp.debian.org/debian jessie-backports main' | tee -a /etc/apt/sources.list && \ + apt-get update && apt-get install -y -t jessie-backports \ + python3-git \ + gosu + +# Packages needed for building vyos-strongswan +RUN apt-get update && apt-get install -y -t jessie-backports debhelper && \ + apt-get install -y \ + dh-apparmor \ + gperf \ + iptables-dev \ + libcap-dev \ + libgcrypt20-dev \ + libgmp3-dev \ + libldap2-dev \ + libpam0g-dev \ + libsystemd-dev \ + libgmp-dev \ + iptables \ + xl2tpd \ + libcurl4-openssl-dev \ + libkrb5-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + pkg-config + +# Package needed for mdns-repeater +RUN apt-get update && apt-get install -y -t jessie-backports \ + dh-systemd + +# Packages needed for vyatta-cfg +RUN apt-get update &&apt-get install -y \ + libboost-filesystem-dev + +# Packages needed for vyatta-iproute +RUN apt-get update && apt-get install -y \ + libatm1-dev \ + libdb-dev + +# Packages needed for vyatta-webgui +RUN apt-get update && apt-get install -y \ + libexpat1-dev \ + subversion + +# Packages needed for pmacct +RUN apt-get update && apt-get install -y \ + libpcap-dev \ + libpq-dev \ + default-libmysqlclient-dev \ + libgeoip-dev \ + librabbitmq-dev \ + libjansson-dev \ + librdkafka-dev \ + libnetfilter-log-dev + +# Packages needed for vyos-keepalived +RUN apt-get update && apt-get install -y \ + libnl-3-dev \ + libnl-genl-3-dev \ + libpopt-dev \ + libsnmp-dev + +# Pavkages needed for wireguard +RUN apt-get update && apt-get install -y \ + libmnl-dev + +# Packages needed for kernel +RUN apt-get update && apt-get install -y \ + libelf-dev + +# Packages needed for vyos-accel-ppp +RUN apt-get update && apt-get install -y \ + cdbs \ + cmake \ + liblua5.1-dev + +# Prerequisites for building FRR from source +# see http://docs.frrouting.org/projects/dev-guide/en/latest/building-frr-for-debian8.html +RUN apt-get update && apt-get install -y \ + doxygen \ + libssh-dev + +RUN export RTRLIB_COMMIT="v0.6.3" && \ + git clone https://github.com/rtrlib/rtrlib.git && \ + cd rtrlib && git checkout $RTRLIB_COMMIT && \ + dpkg-buildpackage -uc -us -tc -b && dpkg -i ../*.deb + +# Prerequisites for building FRR from source +# see http://docs.frrouting.org/projects/dev-guide/en/latest/building-frr-for-debian8.html +# +RUN apt-get update && apt-get install -y -t jessie-backports \ + swig \ + libcmocka-dev \ + libcmocka0 + +RUN export LIBYANG_COMMIT="179da47f2e8de" && \ + git clone https://github.com/opensourcerouting/libyang.git && \ + cd libyang && git checkout $LIBYANG_COMMIT && mkdir build && cd build && \ + cmake .. && make build-deb && \ + dpkg -i debs/*.deb + +# Packages needed for frr +RUN apt-get update && apt-get install -y \ + libreadline-dev \ + texinfo \ + pkg-config \ + imagemagick \ + groff \ + hardening-wrapper \ + gawk \ + chrpath \ + libjson0 \ + libjson0-dev \ + python-ipaddr \ + python3-dev \ + python3-pytest \ + install-info \ + libc-ares-dev \ + libc-ares2 \ + libzmq3 \ + libzmq3-dev + +# Packages needed for conntrack-tools +RUN apt-get update && apt-get install -y \ + libnetfilter-conntrack-dev \ + libnetfilter-cthelper0-dev \ + libnetfilter-cttimeout-dev \ + libnetfilter-queue-dev + +# Packages needed for libvyosconfig && VyConf +RUN apt-get update && apt-get install -y \ + libffi-dev + +# Packages needed for libvyosconfig +RUN curl https://raw.githubusercontent.com/ocaml/opam/2.0.2/shell/install.sh --output /tmp/opam_install.sh && \ + sed -i 's/read BINDIR/BINDIR=""/' /tmp/opam_install.sh && sh /tmp/opam_install.sh && \ + opam init --root=/opt/opam --comp=4.07.0 --disable-sandboxing + +RUN eval $(opam env --root=/opt/opam --set-root) && \ + opam install -y \ + oasis + +RUN eval $(opam env --root=/opt/opam --set-root) && opam install -y \ + fileutils \ + lwt \ + lwt_ppx \ + lwt_log \ + ocplib-endian \ + ounit \ + pcre \ + ppx_deriving_yojson \ + sha \ + toml \ + xml-light \ + batteries \ + ocaml-protoc \ + ctypes-foreign \ + menhir + +RUN eval $(opam env --root=/opt/opam --set-root) && opam install -y \ + ctypes + +# Build VyConf which is required to build libvyosconfig +RUN eval $(opam env --root=/opt/opam --set-root) && \ + opam pin add vyconf https://github.com/vyos/vyconf.git#v0.1 -y + +# Build libvyosconfig +RUN eval $(opam env --root=/opt/opam --set-root) && \ + git clone https://github.com/vyos/libvyosconfig && \ + cd libvyosconfig && \ + git checkout v0.0.4 && \ + dpkg-buildpackage -uc -us -tc -b && \ + dpkg -i ../libvyosconfig0_*_amd64.deb + +# Packages needed for vyos-1x +RUN apt-get update && apt-get install -y \ + whois + +# Packages needed for vyos-xe-guest-utilities +RUN apt-get update && apt-get install -y \ + golang + +# Update live-build +RUN echo 'deb http://ftp.debian.org/debian stretch main' | tee -a /etc/apt/sources.list.d/stretch.list && \ + apt-get update && apt-get install -y -t stretch live-build && \ + rm -f /etc/apt/sources.list.d/stretch.list && \ + apt-get update && \ + rm -rf /var/lib/apt/lists/* + +# Install packer +RUN export LATEST="$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | \ + jq -r -M '.current_version')"; \ + echo "url https://releases.hashicorp.com/packer/"$LATEST"/packer_"$LATEST"_linux_amd64.zip" |\ + curl -K- | gzip -d > /usr/bin/packer && \ + chmod +x /usr/bin/packer + +# Allow password-less 'sudo' for all users in group 'sudo' +RUN sed "s/^%sudo.*/%sudo\tALL=(ALL) NOPASSWD:ALL/g" -i /etc/sudoers && \ + chmod a+s /usr/sbin/useradd /usr/sbin/groupadd /usr/sbin/gosu /usr/sbin/usermod + +# Ensure sure all users have access to our OCAM installation +RUN echo "$(opam env --root=/opt/opam --set-root)" >> /etc/skel/.bashrc + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 00000000..8db41103 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +USER_NAME="vyos_bld" +NEW_UID=$(stat -c "%u" .) +NEW_GID=$(stat -c "%g" .) + +# Change effective UID to the one specified via "-e GOSU_UID=`id -u $USER`" +if [ -n "$GOSU_UID" ]; then + NEW_UID=$GOSU_UID +fi + +# Change effective UID to the one specified via "-e GOSU_GID=`id -g $USER`" +if [ -n "$GOSU_GID" ]; then + NEW_GID=$GOSU_GID +fi + +# Notify user about selected UID/GID +echo "Current UID/GID: $NEW_UID/$NEW_GID" + +# Create UNIX group on the fly if it does not exist +if ! grep -q $NEW_GID /etc/group; then + groupadd --gid $NEW_GID $USER_NAME +fi + +useradd --shell /bin/bash --uid $NEW_UID --gid $NEW_GID --non-unique --create-home $USER_NAME +usermod --append --groups sudo $USER_NAME +sudo chown $NEW_UID:$NEW_GID /home/$USER_NAME +export HOME=/home/$USER_NAME + +# Execute process +exec /usr/sbin/gosu $USER_NAME "$@" diff --git a/docs/README.md b/docs/README.md index 60c86100..c0de03e0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,6 @@ A brief documentation about VyOS can be found at https://github.com/vyos-documentation or rendered at https://vyos.readthedocs.org -Another landing sport would be the old Wiki at http://wiki.vyos.net. +Another landing spot would be the old Wiki at http://wiki.vyos.net. Build instructions for a 1U DIY VyOS bare metal router is [here](1u-diy-atom-c3000/README.md) diff --git a/packages/conntrack-tools b/packages/conntrack-tools new file mode 160000 +Subproject 77cf2ae1cfc281ab11d3fa5ddc73c11bcb60ccd diff --git a/packages/ddclient b/packages/ddclient new file mode 160000 +Subproject 869a613c81245678f1261034ff941fc047c2c15 diff --git a/packages/eventwatchd b/packages/eventwatchd new file mode 160000 +Subproject c3d8ae7352f3e9c65b0f05dda245d144252574c diff --git a/packages/frr b/packages/frr new file mode 160000 +Subproject c72622322df02e02cb9b6d01379052c1ddda2b5 diff --git a/packages/igmpproxy b/packages/igmpproxy new file mode 160000 +Subproject 1f87c675725bff8f380bf7364c3961ee5a5a9e4 diff --git a/packages/libvyosconfig b/packages/libvyosconfig new file mode 160000 +Subproject e75e4ae638c49e512a3013d1806e59a67978c5f diff --git a/packages/rtrlib b/packages/rtrlib new file mode 160000 +Subproject db2d254d75b835abb169f2f9e4a8cfbe74a3c36 diff --git a/packages/vyatta-biosdevname b/packages/vyatta-biosdevname new file mode 160000 +Subproject 28ccb143a09e8a1fb8363757c9a82c3e732a552 diff --git a/packages/vyatta-vrrp b/packages/vyatta-vrrp deleted file mode 160000 -Subproject c6411d8c4c1a11f0305ddee2824d7081cd2654a diff --git a/packages/vyconf b/packages/vyconf new file mode 160000 +Subproject 1ebea2e6914e5d2c4f07654bdbd489aa2c1ce16 diff --git a/packages/vyos-accel-ppp b/packages/vyos-accel-ppp new file mode 160000 +Subproject df95d6b78be568cbce40fe7b2632dfb9697d207 diff --git a/packages/vyos-frr b/packages/vyos-frr deleted file mode 160000 -Subproject 6ba5fb8036f9155a3f724d43513e89ab8f07e8d diff --git a/packages/vyos-netplug b/packages/vyos-netplug new file mode 160000 +Subproject 2aa80a57a1ee2dfa8955b520d3aaec754315866 diff --git a/packages/vyos-opennhrp b/packages/vyos-opennhrp new file mode 160000 +Subproject 41f0852dd0b8d4900a1a743334d88afe490ee58 diff --git a/packages/vyos-pppoe-server b/packages/vyos-pppoe-server deleted file mode 160000 -Subproject 566709144fb119d32cc029615cff2e688a8a755 diff --git a/packages/vyos-salt-minion b/packages/vyos-salt-minion new file mode 160000 +Subproject c64e526a98d4ea8ee3a300bf36cd4348cd46a56 diff --git a/packages/vyos-strongswan b/packages/vyos-strongswan -Subproject 5f1a6880eb6ac98deb48b915bc574c2a5260831 +Subproject 0d4aee5440ebef1042bb8d9e65ee3dc127257df diff --git a/packages/vyos-vmwaretools-scripts b/packages/vyos-vmwaretools-scripts new file mode 160000 +Subproject b41f886f59997f28a19e541e6a40b9d39ac43f6 diff --git a/packages/vyos-xe-guest-utilities b/packages/vyos-xe-guest-utilities new file mode 160000 +Subproject a31c092661c65e177967535e8c53dc5b7a04b5c diff --git a/scripts/build-kernel b/scripts/build-kernel new file mode 100755 index 00000000..e58d2d5a --- /dev/null +++ b/scripts/build-kernel @@ -0,0 +1,36 @@ +#!/bin/bash +if [ ! -f "Makefile" ]; then + echo "Makefile missing, This script needs to be executed inside the vyos-kernel package directory" + exit 1 +fi + +if grep -Fxq "KBUILD_OUTPUT" Makefile; then + echo "Wrong Makefile?, This script needs to be executed inside the vyos-kernel package directory" + exit 1 +fi + + +# newer Kernel versions come with a "# SPDX-License-Identifier: GPL-2.0" identifier +# as the first line in the file - use compatible approach with grep rather then sed +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) + +case "$ARCH" in + amd64) + make x86_64_vyos_defconfig + TARGETS="kernel_headers kernel_image" + # the following targets are not supported for Linux Kernels > 4.14 as + # they have been removed from the Makefile (commits 18afab8c1d3c2 & + # 22cba31bae9dc). + if [ ${PATCHLEVEL} -lt 14 ]; then + TARGETS+=" kernel_manual kernel_doc" + fi + CONCURRENCY_LEVEL=4 LOCALVERSION="" make-kpkg --rootcmd fakeroot --initrd --append_to_version -amd64-vyos --revision=$VERSION.$PATCHLEVEL.$SUBLEVEL-1+vyos1+current1 -j$(cat /proc/cpuinfo | grep processor | wc -l) ${TARGETS} + ;; + + armhf) + make armhf_vyos_defconfig + ;; +esac diff --git a/scripts/build-submodules b/scripts/build-submodules index c4b24a15..0d11c059 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -1,55 +1,207 @@ -#!/bin/bash -#set -x +#!/bin/bash + 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 +print_help() { 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 "or from the vyos-builder docker container." + echo "" echo "Build the container:" - echo " docker build -t vyos-builder ." + 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 + echo " docker run --rm -it -v $(pwd):/vyos -w /vyos --sysctl net.ipv6.conf.lo.disable_ipv6=0 vyos-builder scripts/build-submodules" + echo "" + echo "Parameters:" + echo " --init-packages - Initiate all subpackages before building" + echo " --verbose - Enable verbose output" + echo " --build-[packagename] - build only selected packages" +} + +BUILDLIST="" + +while test $# -gt 0 +do + case "$1" in + -h|-?|--help) + print_help + exit 0 + ;; + --init-packages) + INIT_PACKAGES=1 + ;; + --verbose) + VERBOSE=1 + ;; + --build-*) + VAL=$(sed s/^--build-//g <<< $1) + BUILDLIST="$BUILDLIST $VAL" + ;; + *) + (>&2 echo "Error: Argument $1 is not valid") + echo "" + print_help + exit 1 + ;; + esac + shift +done status_start() { -echo -ne "[ ] $1" + echo -ne "[ ] $1" } status_ok() { -echo -ne "\r[\e[32m OK \e[39m]\n" + echo -ne "\r[\e[32m OK \e[39m]\n" } status_fail() { -echo -ne "\r[\e[31mFAIL\e[39m]\n" + echo -ne "\r[\e[31mFAIL\e[39m]\n" } status_skip() { -echo -ne "\r[SKIP] $1\n" + echo -ne "\r[SKIP] $1\033[K\n" } error_msg() { -echo -ne " $1\n" + echo -ne " $1\n" } ROOTDIR="$(pwd)" -PKGDIR="$(pwd)/packages" +PKGDIR="$ROOTDIR/packages" +SCRIPTDIR="$ROOTDIR/scripts" + +package_in_buildlist() { + # Return true if buildlist is not set + if [ -z "$BUILDLIST" ]; then + return 0 + fi + + if [[ $BUILDLIST =~ (^|[[:space:]])$1($|[[:space:]]) ]]; then + return 0 + fi + + return 1 +} + +build_package() { + PKG=$1 + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) + if ! package_in_buildlist $1; then + return 0 + fi + status_start "Building package: $PKG Commit id: $COMMITID" + if [ ! -d "$PKGDIR/$PKG/debian" ]; then + status_skip "No source for: $PKG" + return 1 + fi + ( set -e; set -x + cd $PKGDIR/$PKG + dpkg-buildpackage -uc -us -tc -b -j$(cat /proc/cpuinfo | grep processor | wc -l) + ) >>$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" + return 2 + fi + status_ok +} echo "Cleaning up buildfiles..." rm -rf $PKGDIR/*.deb rm -rf $PKGDIR/*.changes rm -rf $PKGDIR/*.buildlog +COMMITID=$(cd $PKGDIR; git rev-parse --short=10 HEAD) echo "-----------------------------------------------------" echo "Starting build process for all packages" -echo "" +echo "vyos-build Commit ID: $COMMITID" + +initialize_packages() { + status_start "Initializing packages" + ( + set -x + git submodule update --init --recursive + git submodule update --remote + ) >>$PKGDIR/init-packages.buildlog 2>&1 + if [ $? -ne 0 ]; then + status_fail + if [ $VERBOSE -eq 1 ]; then + cat $PKGDIR/init-packages.buildlog + fi + error_msg "Failed to update all package, look in init-packages.buildlog to examine the fault\n" + return 1 + fi + status_ok +} +if [ $INIT_PACKAGES ]; then + initialize_packages +fi + +build_frr() { + PKG=frr + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) + if ! package_in_buildlist $1; then + return 0 + fi + status_start "Building package: $PKG Commit id: $COMMITID" + if [ ! -f "$PKGDIR/$PKG/README.md" ]; then + status_skip "No source for: $PKG" + return 1 + fi + + ( set -e; set -x + cd $PKGDIR/$PKG + git clean -dxf + git reset --hard + + # Run bootstrap.sh and make a dist tarball + # http://docs.frrouting.org/projects/dev-guide/en/latest/packaging-debian.html + ./bootstrap.sh + ./configure --with-pkg-extra-version=-vyos + make dist + + # Create backports debian sources + mv debianpkg debian + make -f debian/rules backports + + # Create a new directory to build the package and populate with package source. + mkdir frrpkg + cd frrpkg + tar xf ../frr_*.orig.tar.gz + cd frr* + source /etc/os-release + tar xf ../../frr_*${ID}${VERSION_ID}*.debian.tar.xz + + # Build Debian Package + debuild --no-lintian --set-envvar=WANT_SNMP=1 --set-envvar=WANT_RPKI=1 \ + --set-envvar=WANT_CUMULUS_MODE=0 -b -uc -us \ + -j$(cat /proc/cpuinfo | grep processor | wc -l) + + mv ../frr_*.deb $PKGDIR + ) >>$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" + return 2 + fi + status_ok +} +build_frr + for PKG in mdns-repeater \ pmacct \ udp-broadcast-relay \ + conntrack-tools \ + eventwatchd \ + ddclient \ + rtrlib \ + igmpproxy \ + libvyosconfig \ vyatta-bash \ + vyatta-biosdevname \ vyatta-cfg \ vyatta-cfg-firewall \ vyatta-cfg-op-pppoe \ @@ -76,84 +228,168 @@ for PKG in mdns-repeater \ vyatta-op-vpn \ vyatta-openvpn \ vyatta-ravpn \ - vyatta-vrrp \ vyatta-wanloadbalance \ vyatta-webgui \ vyatta-webproxy \ vyatta-wireless \ vyatta-wirelessmodem \ vyatta-zone \ + vyos-xe-guest-utilities \ vyos-keepalived \ + vyos-netplug \ vyos-nhrp \ - vyos-pppoe-server \ + vyos-opennhrp \ + vyos-salt-minion \ vyos-strongswan \ vyos-world \ + vyos-1x \ ; 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" + build_package "$PKG" + ERRCODE=$? + if [ "$ERRCODE" -ne "0" ]; then + exit $ERRCODE 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 +build_kernel() { + PKG="vyos-kernel" + if ! package_in_buildlist "vyos-kernel"; then + return 0 + fi + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) + status_start "Building-package: vyos-kernel Commit ID:$COMMITID" + if [ ! -f "$PKGDIR/vyos-kernel/Makefile" ]; then + status_skip "No source for: vyos-kernel" + return 0 + fi + + ( set -e; set -x + cd $PKGDIR/vyos-kernel > /dev/null + bash -c "$SCRIPTDIR/build-kernel" + ) >>$PKGDIR/vyos-kernel.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail + if [ $VERBOSE -eq 1 ]; then + cat $PKGDIR/vyos-kernel.buildlog + fi 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) - echo "$VERSION.$PATCHLEVEL.$SUBLEVEL" > $ROOTDIR/data/kernel_version - status_ok - fi - popd > /dev/null -else - status_skip "No source for: vyos-kernel" -fi + return 1 + fi + VERSION=$(grep "^VERSION" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + PATCHLEVEL=$(grep "^PATCHLEVEL" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + SUBLEVEL=$(grep "^SUBLEVEL" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + ARCH=$(dpkg --print-architecture) + echo "$VERSION.$PATCHLEVEL.$SUBLEVEL" > $ROOTDIR/data/kernel_version + status_ok +} +build_kernel +ERRCODE=$? +if [ "$ERRCODE" -ne "0" ]; then + exit $ERRCODE +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?" +build_wireguard() { + PKG="vyos-wireguard" + if ! package_in_buildlist "vyos-wireguard"; then + return 0 fi -else + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) + status_start "Building package: vyos-wireguard Commit ID:$COMMITID" + + if [ ! -d "$PKGDIR/vyos-wireguard/debian" ]; then status_skip "No source for: vyos-wireguard" + return 0 + fi + + if [ ! -f "$PKGDIR/vyos-kernel/Makefile" ]; then + status_fail + error_msg "No Makefile found in kernel package" + return 1 + fi + + if ! grep -q "KBUILD_OUTPUT" $PKGDIR/vyos-kernel/Makefile; then + status_fail + error_msg "Failed to build package vyos-wireguard, no kernel source found\n" + return 1 + fi + + VERSION=$(grep "^VERSION" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + PATCHLEVEL=$(grep "^PATCHLEVEL" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + SUBLEVEL=$(grep "^SUBLEVEL" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + ARCH=$(dpkg --print-architecture) + # Collect kernel information + ( set -e; set -x + cd $PKGDIR/vyos-wireguard + echo "src/wireguard.ko /lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL-$ARCH-vyos/extra" | tee debian/wireguard-modules.install + KERNELDIR=$PKGDIR/vyos-kernel dpkg-buildpackage -uc -us -tc -b -j$(cat /proc/cpuinfo | grep processor | wc -l) + ) >>$PKGDIR/vyos-wireguard.buildlog 2>&1 + if [ $? -ne 0 ]; then + status_fail + if [ $VERBOSE -eq 1 ]; then + cat $PKGDIR/vyos-wireguard.buildlog + fi + error_msg "Failed to build package vyos-wireguard, look in vyos-wireguard.buildlog to examine the fault\n" + return 2 + fi + status_ok +} +build_wireguard +ERRCODE=$? +if [ "$ERRCODE" -ne "0" ]; then + exit $ERRCODE +fi + +# ACCEL-PPP +build_accel-ppp() { + PKG="vyos-accel-ppp" + if ! package_in_buildlist "accel-ppp"; then + return 0 + fi + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) + status_start "Building package: vyos-accel-ppp Commit ID: $COMMITID" + if [ ! -d "$PKGDIR/vyos-accel-ppp/debian" ]; then + status_skip "No source for: vyos-accel-ppp" + return 0 + fi + + if [ ! -f "$PKGDIR/vyos-kernel/Makefile" ]; then + status_fail + error_msg "No Makefile found in kernel package" + return 1 + fi + + if ! grep -q "KBUILD_OUTPUT" $PKGDIR/vyos-kernel/Makefile; then + status_fail + error_msg "Failed to build package vyos-accel-ppp, no kernel source found\n" + fi + # Collect kernel information + VERSION=$(grep "^VERSION" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + PATCHLEVEL=$(grep "^PATCHLEVEL" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + SUBLEVEL=$(grep "^SUBLEVEL" $PKGDIR/vyos-kernel/Makefile | grep -Eo '[0-9]{1,4}') + ARCH=$(dpkg --print-architecture) + + ( set -e; set -x + cd $PKGDIR/vyos-accel-ppp + echo "lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL-$ARCH-vyos/extra/*.ko" | tee debian/vyos-accel-ppp-ipoe-kmod.install + sed -i "s#[0-9].[0-9][0-9].[0-9]-amd64-vyos#$VERSION.$PATCHLEVEL.$SUBLEVEL-$ARCH-vyos#g" debian/rules + KERNELDIR=$PKGDIR/vyos-kernel dpkg-buildpackage -uc -us -tc -b -j$(cat /proc/cpuinfo | grep processor | wc -l) + ) >>$PKGDIR/vyos-accel-ppp.buildlog 2>&1 + if [ $? -ne 0 ]; then + status_fail + if [ $VERBOSE -eq 1 ]; then + cat $PKGDIR/vyos-accel-ppp.buildlog + fi + error_msg "Failed to build package vyos-accel-ppp, look in vyos-accel-ppp.buildlog to examine the fault\n" + return 1 + fi + status_ok +} +build_accel-ppp +ERRCODE=$? +if [ "$ERRCODE" -ne "0" ]; then + exit $ERRCODE fi |