summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-03-31 17:41:19 +0200
committerDaniil Baturin <daniil@baturin.org>2019-03-31 17:41:19 +0200
commit7e2a2e37e72e649b5eb42362e0469101c7ce19cc (patch)
tree636944e4ba7bcb13bd18bc3f70391faab8c3ebcc
parent819bb96bd26c1495d6fef2e6477bb96cf147ec22 (diff)
parentdda8ec6f3a46b2dfe9f627c620b7fb57c25d70dc (diff)
downloadvyos-build-7e2a2e37e72e649b5eb42362e0469101c7ce19cc.tar.gz
vyos-build-7e2a2e37e72e649b5eb42362e0469101c7ce19cc.zip
Merge branch 'current' into crux
Conflicts: data/kernel_version scripts/build-config scripts/defaults.py scripts/live-build-config
-rw-r--r--.gitmodules23
-rw-r--r--data/defaults.json16
-rw-r--r--data/kernel_version1
-rw-r--r--data/live-build-config/includes.chroot/etc/modules-load.d/br-netfilter.conf3
-rw-r--r--data/live-build-config/includes.chroot/etc/skel/.bashrc119
-rw-r--r--data/live-build-config/includes.chroot/etc/skel/.profile22
-rw-r--r--data/package-lists/vyos-x86.list.chroot1
-rw-r--r--docker/Dockerfile161
-rw-r--r--docker/no--check-valid-until1
-rw-r--r--docker/sources.list3
m---------packages/hvinfo0
m---------packages/ipaddrcheck0
m---------packages/libyang0
m---------packages/lldpd0
m---------packages/pdns-recursor0
m---------packages/vyatta-webgui0
-rwxr-xr-xscripts/build-GCE-image12
-rwxr-xr-xscripts/build-config55
-rwxr-xr-xscripts/build-flavour2
-rwxr-xr-xscripts/build-submodules83
-rw-r--r--scripts/defaults.py16
-rwxr-xr-xscripts/live-build-config25
22 files changed, 410 insertions, 133 deletions
diff --git a/.gitmodules b/.gitmodules
index 22bb87d5..c470fb3b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -82,10 +82,6 @@
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
@@ -236,4 +232,21 @@
[submodule "packages/igmpproxy"]
path = packages/igmpproxy
url = https://github.com/vyos/igmpproxy.git
- branch = current \ No newline at end of file
+ branch = current
+[submodule "packages/hvinfo"]
+ path = packages/hvinfo
+ url = https://github.com/dmbaturin/hvinfo.git
+ branch = master
+[submodule "packages/libyang"]
+ path = packages/libyang
+ url = https://github.com/opensourcerouting/libyang.git
+ branch = debian
+[submodule "packages/ipaddrcheck"]
+ path = packages/ipaddrcheck
+ url = https://github.com/vyos/ipaddrcheck.git
+[submodule "packages/lldpd"]
+ path = packages/lldpd
+ url = https://github.com/vincentbernat/lldpd.git
+[submodule "packages/pdns-recursor"]
+ path = packages/pdns-recursor
+ url = https://salsa.debian.org/dns-team/pdns-recursor.git
diff --git a/data/defaults.json b/data/defaults.json
new file mode 100644
index 00000000..36ec598b
--- /dev/null
+++ b/data/defaults.json
@@ -0,0 +1,16 @@
+{
+ "architecture": "amd64",
+ "debian_mirror": "http://deb.debian.org/debian",
+ "debian_security_mirror": "http://deb.debian.org/debian-security",
+ "debian_distribution": "jessie",
+ "vyos_mirror": "http://dev.packages.vyos.net/repositories/current",
+ "vyos_branch": "current",
+ "kernel_version": "4.19.28",
+ "kernel_flavor": "amd64-vyos",
+ "additional_repositories": [
+ "deb http://repo.saltstack.com/apt/debian/8/amd64/2017.7 jessie main",
+ "deb http://repo.powerdns.com/debian jessie-rec-41 main",
+ "deb http://archive.debian.org/debian/ jessie-backports main"
+ ],
+ "custom_packages": []
+}
diff --git a/data/kernel_version b/data/kernel_version
deleted file mode 100644
index cef3eaf2..00000000
--- a/data/kernel_version
+++ /dev/null
@@ -1 +0,0 @@
-4.19.28
diff --git a/data/live-build-config/includes.chroot/etc/modules-load.d/br-netfilter.conf b/data/live-build-config/includes.chroot/etc/modules-load.d/br-netfilter.conf
new file mode 100644
index 00000000..ed668e43
--- /dev/null
+++ b/data/live-build-config/includes.chroot/etc/modules-load.d/br-netfilter.conf
@@ -0,0 +1,3 @@
+# Load br-netfilter.ko at boot
+br_netfilter
+
diff --git a/data/live-build-config/includes.chroot/etc/skel/.bashrc b/data/live-build-config/includes.chroot/etc/skel/.bashrc
new file mode 100644
index 00000000..06443378
--- /dev/null
+++ b/data/live-build-config/includes.chroot/etc/skel/.bashrc
@@ -0,0 +1,119 @@
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+
+# If not running interactively, don't do anything
+case $- in
+ *i*) ;;
+ *) return;;
+esac
+
+# don't put duplicate lines or lines starting with space in the history.
+# See bash(1) for more options
+HISTCONTROL=ignoreboth
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=1000
+HISTFILESIZE=2000
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# If set, the pattern "**" used in a pathname expansion context will
+# match all files and zero or more directories and subdirectories.
+#shopt -s globstar
+
+# make less more friendly for non-text input files, see lesspipe(1)
+#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
+ debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# set a fancy prompt (non-color, unless we know we "want" color)
+case "$TERM" in
+ xterm-color) color_prompt=yes;;
+esac
+
+# uncomment for a colored prompt, if the terminal has the capability; turned
+# off by default to not distract the user: the focus in a terminal window
+# should be on the output of commands, not on the prompt
+#force_color_prompt=yes
+
+if [ -n "$force_color_prompt" ]; then
+ if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
+ # We have color support; assume it's compliant with Ecma-48
+ # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
+ # a case would tend to support setf rather than setaf.)
+ color_prompt=yes
+ else
+ color_prompt=
+ fi
+fi
+
+if [ "$color_prompt" = yes ]; then
+ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\H\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+else
+ PS1='${debian_chroot:+($debian_chroot)}\u@\H:\w\$ '
+fi
+unset color_prompt force_color_prompt
+
+# If this is an xterm set the title to user@host:dir
+case "$TERM" in
+xterm*|rxvt*)
+ PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\H: \w\a\]$PS1"
+ ;;
+*)
+ ;;
+esac
+
+# enable color support of ls and also add handy aliases
+if [ -x /usr/bin/dircolors ]; then
+ test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+ alias ls='ls --color=auto'
+ #alias dir='dir --color=auto'
+ #alias vdir='vdir --color=auto'
+
+ #alias grep='grep --color=auto'
+ #alias fgrep='fgrep --color=auto'
+ #alias egrep='egrep --color=auto'
+fi
+
+# colored GCC warnings and errors
+#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
+
+# some more ls aliases
+#alias ll='ls -l'
+#alias la='ls -A'
+#alias l='ls -CF'
+
+# Alias definitions.
+# You may want to put all your additions into a separate file like
+# ~/.bash_aliases, instead of adding them here directly.
+# See /usr/share/doc/bash-doc/examples in the bash-doc package.
+
+if [ -f ~/.bash_aliases ]; then
+ . ~/.bash_aliases
+fi
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+if ! shopt -oq posix; then
+ if [ -f /usr/share/bash-completion/bash_completion ]; then
+ . /usr/share/bash-completion/bash_completion
+ elif [ -f /etc/bash_completion ]; then
+ . /etc/bash_completion
+ fi
+fi
+OPAMROOT='/opt/opam'; export OPAMROOT;
+OPAM_SWITCH_PREFIX='/opt/opam/4.07.0'; export OPAM_SWITCH_PREFIX;
+CAML_LD_LIBRARY_PATH='/opt/opam/4.07.0/lib/stublibs:/opt/opam/4.07.0/lib/ocaml/stublibs:/opt/opam/4.07.0/lib/ocaml'; export CAML_LD_LIBRARY_PATH;
+OCAML_TOPLEVEL_PATH='/opt/opam/4.07.0/lib/toplevel'; export OCAML_TOPLEVEL_PATH;
+MANPATH=':/opt/opam/4.07.0/man'; export MANPATH;
+PATH='/opt/opam/4.07.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'; export PATH;
diff --git a/data/live-build-config/includes.chroot/etc/skel/.profile b/data/live-build-config/includes.chroot/etc/skel/.profile
new file mode 100644
index 00000000..c9db4591
--- /dev/null
+++ b/data/live-build-config/includes.chroot/etc/skel/.profile
@@ -0,0 +1,22 @@
+# ~/.profile: executed by the command interpreter for login shells.
+# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
+# exists.
+# see /usr/share/doc/bash/examples/startup-files for examples.
+# the files are located in the bash-doc package.
+
+# the default umask is set in /etc/profile; for setting the umask
+# for ssh logins, install and configure the libpam-umask package.
+#umask 022
+
+# if running bash
+if [ -n "$BASH_VERSION" ]; then
+ # include .bashrc if it exists
+ if [ -f "$HOME/.bashrc" ]; then
+ . "$HOME/.bashrc"
+ fi
+fi
+
+# set PATH so it includes user's private bin if it exists
+if [ -d "$HOME/bin" ] ; then
+ PATH="$HOME/bin:$PATH"
+fi
diff --git a/data/package-lists/vyos-x86.list.chroot b/data/package-lists/vyos-x86.list.chroot
index 5bb0dbd7..6f5d7624 100644
--- a/data/package-lists/vyos-x86.list.chroot
+++ b/data/package-lists/vyos-x86.list.chroot
@@ -1,6 +1,5 @@
grub2
grub-pc
-open-vm-tools
qemu-guest-agent
hyperv-daemons
vyos-xe-guest-utilities
diff --git a/docker/Dockerfile b/docker/Dockerfile
index bca48ff8..46df8e4c 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,10 +1,29 @@
-# Must be run with --privileged flag
-# Recommended to run the container with a volume mapped
+# Copyright (C) 2018 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
# in order to easy exprort images built to "external" world
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Must be run with --privileged flag, recommended to run the container with a
+# volume mapped in order to easy export images
+
FROM debian:jessie
+LABEL authors="VyOS Maintainers <maintainers@vyos.io>"
ENV DEBIAN_FRONTEND noninteractive
+COPY sources.list /etc/apt/sources.list
+COPY no--check-valid-until /etc/apt/apt.conf.d/
+
# Standard shell should be bash not dash
RUN echo "dash dash/sh boolean false" | debconf-set-selections && \
dpkg-reconfigure dash
@@ -24,7 +43,6 @@ RUN apt-get update && apt-get install -y \
make \
sudo \
mc \
- live-build \
pbuilder \
devscripts \
python3-pystache \
@@ -56,35 +74,18 @@ RUN apt-get update && apt-get install -y \
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 \
+ python3-sphinx \
+ python3-pystache \
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
+ pkg-config \
+ debhelper
+
+RUN apt-get update && apt-get install -y -t jessie-backports \
+ python3-git \
+ python3-pip \
+ gosu
# Package needed for mdns-repeater
RUN apt-get update && apt-get install -y -t jessie-backports \
@@ -97,7 +98,8 @@ RUN apt-get update &&apt-get install -y \
# Packages needed for vyatta-iproute
RUN apt-get update && apt-get install -y \
libatm1-dev \
- libdb-dev
+ libdb-dev \
+ iptables-dev
# Packages needed for vyatta-webgui
RUN apt-get update && apt-get install -y \
@@ -115,13 +117,6 @@ RUN apt-get update && apt-get install -y \
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
@@ -136,11 +131,12 @@ RUN apt-get update && apt-get install -y \
cmake \
liblua5.1-dev
-# Prerequisites for building FRR from source
+# Prerequisites for building rtrlib
# 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
+ libssh-dev \
+ libssl-dev
RUN export RTRLIB_COMMIT="v0.6.3" && \
git clone https://github.com/rtrlib/rtrlib.git && \
@@ -161,26 +157,15 @@ RUN export LIBYANG_COMMIT="179da47f2e8de" && \
cmake .. && make build-deb && \
dpkg -i debs/*.deb
-# Packages needed for frr
+# Packages needed to build frr itself
RUN apt-get update && apt-get install -y \
- libreadline-dev \
- texinfo \
- pkg-config \
- imagemagick \
- groff \
- hardening-wrapper \
- gawk \
chrpath \
- libjson0 \
- libjson0-dev \
- python-ipaddr \
+ install-info \
+ libjson-c-dev \
+ libpython3-dev \
python3-dev \
python3-pytest \
- install-info \
- libc-ares-dev \
- libc-ares2 \
- libzmq3 \
- libzmq3-dev
+ texinfo
# Packages needed for conntrack-tools
RUN apt-get update && apt-get install -y \
@@ -224,16 +209,20 @@ RUN eval $(opam env --root=/opt/opam --set-root) && opam install -y \
# 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
+ opam pin add vyconf https://github.com/vyos/vyconf.git#51d79a3f -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 && \
+ git clone https://github.com/vyos/libvyosconfig.git && \
+ cd libvyosconfig && git checkout 9a80a5d3 && \
dpkg-buildpackage -uc -us -tc -b && \
dpkg -i ../libvyosconfig0_*_amd64.deb
+# Packages needed for hvinfo
+RUN apt-get update && apt-get install -y \
+ gnat \
+ gprbuild
+
# Packages needed for vyos-1x
RUN apt-get update && apt-get install -y \
whois
@@ -242,6 +231,57 @@ RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y \
golang
+# Packages needed for ipaddrcheck
+RUN apt-get update && apt-get install -y \
+ check
+# As there is no Debian Jessie/Stretch package for libcidr available but this
+# is required for ipaddrcheck we have to build it from source
+RUN git clone https://github.com/wikimedia/analytics-libcidr.git && \
+ cd analytics-libcidr && \
+ git checkout 026c611d90a1 && \
+ dpkg-buildpackage -uc -us -tc -b && \
+ dpkg -i ../libcidr*.deb
+
+# Packages needed for lldpd
+RUN apt-get update && apt-get install -y \
+ libbsd-dev \
+ libevent-dev
+
+# Packages needed for vyatta-quagga
+RUN apt-get update && apt-get install -y \
+ libpam-dev \
+ libcap-dev \
+ libsnmp-dev \
+ gawk
+
+# Packages needed for vyos-strongswan
+RUN apt-get update && apt-get install -y \
+ libkrb5-dev \
+ libssl-dev \
+ libxml2-dev \
+ systemd \
+ libcurl4-openssl-dev \
+ libgcrypt20-dev \
+ libgmp3-dev \
+ libldap2-dev \
+ libsqlite3-dev
+
+# Packages needed for vyos-opennhrp
+RUN apt-get update && apt-get install -y \
+ libc-ares-dev
+
+# Packages needed for ddclient
+RUN apt-get update && apt-get install -y \
+ xmlto
+
+# 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/*
+
# 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 && \
@@ -263,5 +303,8 @@ RUN sed "s/^%sudo.*/%sudo\tALL=(ALL) NOPASSWD:ALL/g" -i /etc/sudoers && \
# Ensure sure all users have access to our OCAM installation
RUN echo "$(opam env --root=/opt/opam --set-root)" >> /etc/skel/.bashrc
+# Cleanup
+RUN rm -rf /tmp/*
+
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
diff --git a/docker/no--check-valid-until b/docker/no--check-valid-until
new file mode 100644
index 00000000..27ed79f3
--- /dev/null
+++ b/docker/no--check-valid-until
@@ -0,0 +1 @@
+Acquire::Check-Valid-Until "0";
diff --git a/docker/sources.list b/docker/sources.list
new file mode 100644
index 00000000..9d0fa506
--- /dev/null
+++ b/docker/sources.list
@@ -0,0 +1,3 @@
+deb http://deb.debian.org/debian/ jessie main
+deb http://deb.debian.org/debian-security/ jessie/updates main
+deb http://archive.debian.org/debian/ jessie-backports main
diff --git a/packages/hvinfo b/packages/hvinfo
new file mode 160000
+Subproject 6d15dff8eb5418a23035d18078f367bc799b702
diff --git a/packages/ipaddrcheck b/packages/ipaddrcheck
new file mode 160000
+Subproject 8f0d655cc68995a0ef88dc905dc62db2af23ec9
diff --git a/packages/libyang b/packages/libyang
new file mode 160000
+Subproject 179da47f2e8def1907372408a9df97a0dcbc134
diff --git a/packages/lldpd b/packages/lldpd
new file mode 160000
+Subproject adbb26bc0a49d083472d24762255ff48bd001e4
diff --git a/packages/pdns-recursor b/packages/pdns-recursor
new file mode 160000
+Subproject 28af51a3942875f0896fab2ea5945ded4a19197
diff --git a/packages/vyatta-webgui b/packages/vyatta-webgui
deleted file mode 160000
-Subproject 30133ba0fd68b0c3726127f195e1058c427fe58
diff --git a/scripts/build-GCE-image b/scripts/build-GCE-image
index 7684bd43..9e2bcaf5 100755
--- a/scripts/build-GCE-image
+++ b/scripts/build-GCE-image
@@ -127,6 +127,10 @@ cat > ${MOUNT_DIR}/boot/grub/grub.cfg << EOF
set timeout=5
set default=0
+serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1
+terminal_input serial
+terminal_output serial
+
menuentry "VyOS $version (Serial console)" {
linux /boot/"$version"/vmlinuz boot=live vyos-union=/boot/"$version" console=tty0 console=ttyS0,38400n8d earlyprintk=ttyS0,38400 consoleblank=0 systemd.show_status=true
initrd /boot/"$version"/initrd.img
@@ -147,7 +151,9 @@ grub-install --boot-directory ${MOUNT_DIR}/boot --force --no-floppy --skip-fs-p
###################
### HOOK SCRIPT ###
###################
-fstrim ${MOUNT_DIR}
-sync
-tar -Sczf ${OUTPUTGZ} ${OUTPUT}
+fstrim ${MOUNT_DIR}
+umount ${MOUNT_DIR} && {
+ tar -Sczf ${OUTPUTGZ} ${OUTPUT}
+ mount /dev/mapper/${LOOP_DEVICE} ${MOUNT_DIR}
+}
diff --git a/scripts/build-config b/scripts/build-config
index 80b28c61..d35bc66e 100755
--- a/scripts/build-config
+++ b/scripts/build-config
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018, VyOS maintainers and contributors
+# Copyright (C) 2019, VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -49,19 +49,28 @@ def get_validator(optdict, name):
return None
+# Load the build flavor file
+build_flavor = os.getenv('VYOS_BUILD_FLAVOR')
+if build_flavor is None:
+ build_flavor = defaults.DEFAULT_BUILD_FLAVOR
+try:
+ with open(build_flavor, 'r') as f:
+ build_defaults = json.load(f)
+except Exception as e:
+ print("Failed to open the build flavor file {0}: {1}".format(build_flavor, e))
+ sys.exit(1)
+
+
# Options dict format:
# '$option_name_without_leading_dashes': { ('$help_string', $default_value_generator_thunk, $value_checker_thunk) }
options = {
- 'architecture': ('Image target architecture (amd64 or i586 or armhf)', lambda: 'amd64', lambda x: x in ['amd64', 'i586', 'armhf']),
+ 'architecture': ('Image target architecture (amd64 or i386 or armhf)', lambda: build_defaults['architecture'], lambda x: x in ['amd64', 'i386', 'armhf']),
'build-by': ('Builder identifier (e.g. jrandomhacker@example.net)', get_default_build_by, None),
- 'debian-mirror': ('Debian repository mirror for ISO build', lambda: defaults.DEBIAN_MIRROR, None),
- 'debian-security-mirror': ('Debian security updated mirror', lambda: defaults.DEBIAN_SECURITY_MIRROR, None),
- 'pbuilder-debian-mirror': ('Debian repository mirror for pbuilder env bootstrap', lambda: defaults.DEBIAN_MIRROR, None),
- 'salt-mirror': ('Salt package mirror', lambda: defaults.SALT_MIRROR, None),
- 'vyos-mirror': ('VyOS package mirror', lambda: defaults.VYOS_MIRROR, None),
- 'pdns-mirror': ('PowerDNS package mirror', lambda: defaults.PDNS_MIRROR, None),
+ 'debian-mirror': ('Debian repository mirror for ISO build', lambda: build_defaults['debian_mirror'], None),
+ 'debian-security-mirror': ('Debian security updated mirror', lambda: build_defaults['debian_security_mirror'], None),
+ 'pbuilder-debian-mirror': ('Debian repository mirror for pbuilder env bootstrap', lambda: build_defaults['debian_mirror'], None),
+ 'vyos-mirror': ('VyOS package mirror', lambda: build_defaults["vyos_mirror"], None),
'build-type': ('Build type, release or development', lambda: 'development', lambda x: x in ['release', 'development']),
- 'custom-packages': ('Custom packages to install from repositories', lambda: '', None),
'version': ('Version number (release builds only)', None, None)
}
@@ -80,6 +89,7 @@ parser.add_argument('--debug', help="Enable debug output", action='store_true')
# Custom APT entry and APT key options can be used multiple times
parser.add_argument('--custom-apt-entry', help="Custom APT entry", action='append')
parser.add_argument('--custom-apt-key', help="Custom APT key file", action='append')
+parser.add_argument('--custom-package', help="Custom package to install from repositories", action='append')
args = vars(parser.parse_args())
@@ -95,8 +105,8 @@ for k, v in args.items():
# Some fixup for mirror settings.
# The idea is: if --debian-mirror is specified but --pbuilder-debian-mirror is not,
# use the --debian-mirror value for both lb and pbuilder bootstrap
-if (args['debian_mirror'] != defaults.DEBIAN_MIRROR) and \
- (args['pbuilder_debian_mirror'] == defaults.DEBIAN_MIRROR):
+if (args['debian_mirror'] != build_defaults["debian_mirror"]) and \
+ (args['pbuilder_debian_mirror'] == build_defaults["debian_mirror"]):
args['pbuilder_debian_mirror'] = args['debian_mirror']
# Version can only be set for release builds,
@@ -109,16 +119,19 @@ if args['build_type'] == 'development':
# Populate some defaults that are not configurable,
# but that are handy to have in the options hash
-args['distribution'] = defaults.DEBIAN_DISTRIBUTION
+args['distribution'] = build_defaults["debian_distribution"]
args['build_dir'] = os.path.join(os.getcwd(), defaults.BUILD_DIR)
args['pbuilder_config'] = defaults.PBUILDER_CONFIG
-args['vyos_branch'] = defaults.VYOS_BRANCH
+args['vyos_branch'] = build_defaults["vyos_branch"]
+
+# Add custom packages from build defaults
+if not args['custom_package']:
+ args['custom_package'] = []
+args['custom_package'] = args['custom_package'] + build_defaults['custom_packages']
-# Convert a whitespace-separated string of custom packages to a list
-if args['custom_packages']:
- args['custom_packages'] = re.split(r'\s+', args['custom_packages'])
-else:
- args['custom_packages'] = []
+if not args['custom_apt_entry']:
+ args['custom_apt_entry'] = []
+args['custom_apt_entry'] = args['custom_apt_entry'] + build_defaults['additional_repositories']
# Check the build environment and dependencies
@@ -126,10 +139,8 @@ env_check_retval = os.system("scripts/check-build-env")
if env_check_retval > 0:
print("Build environment check failed, fix the issues and retry")
-# Get the kernel version from data/kernel_version
-with open("data/kernel_version") as f:
- kernel_version = f.read().strip()
- args['kernel_version'] = kernel_version
+args['kernel_version'] = build_defaults['kernel_version']
+args['kernel_flavor'] = build_defaults['kernel_flavor']
# Save to file
diff --git a/scripts/build-flavour b/scripts/build-flavour
index c14f5735..5e76672b 100755
--- a/scripts/build-flavour
+++ b/scripts/build-flavour
@@ -27,7 +27,7 @@ if [ $BUILD_TYPE = "development" ]; then
fi
# Install grub-pc if it's an x86 build
-if [ $BUILD_ARCH = 'amd64' -o $BUILD_ARCH = 'i686' ]; then
+if [ $BUILD_ARCH = 'amd64' -o $BUILD_ARCH = 'i386' ]; then
cp data/package-lists/vyos-x86.list.chroot build/config/package-lists/
fi
diff --git a/scripts/build-submodules b/scripts/build-submodules
index 0d11c059..fc8fdf83 100755
--- a/scripts/build-submodules
+++ b/scripts/build-submodules
@@ -24,6 +24,7 @@ print_help() {
}
BUILDLIST=""
+VERBOSE=0
while test $# -gt 0
do
@@ -70,10 +71,32 @@ status_skip() {
error_msg() {
echo -ne " $1\n"
}
+
+verbose_msg() {
+ if [ $VERBOSE -ne 0 ]; then
+ echo "Current Environment:"
+ env
+
+ if [ ! -z "$1" ]; then
+ echo "Logfile:"
+ cat $1
+ fi
+ fi
+}
+
ROOTDIR="$(pwd)"
PKGDIR="$ROOTDIR/packages"
SCRIPTDIR="$ROOTDIR/scripts"
+# Source OPAM environment if not already set
+if [ -z "$OPAMROOT" ]; then
+ if [ -x "$(command -v opam)" ]; then
+ eval $(opam env --root=/opt/opam --set-root)
+ else
+ echo "WARNING: 'opam' not installed, can't build VyConf and libvyosconfig"
+ fi
+fi
+
package_in_buildlist() {
# Return true if buildlist is not set
if [ -z "$BUILDLIST" ]; then
@@ -104,6 +127,7 @@ build_package() {
) >>$PKGDIR/$PKG.buildlog 2>&1
if [ $? -ne 0 ]; then
status_fail
+ verbose_msg "$PKGDIR/$PKG.buildlog"
error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n"
return 2
fi
@@ -128,9 +152,7 @@ initialize_packages() {
) >>$PKGDIR/init-packages.buildlog 2>&1
if [ $? -ne 0 ]; then
status_fail
- if [ $VERBOSE -eq 1 ]; then
- cat $PKGDIR/init-packages.buildlog
- fi
+ verbose_msg "$PKGDIR/init-packages.buildlog"
error_msg "Failed to update all package, look in init-packages.buildlog to examine the fault\n"
return 1
fi
@@ -140,6 +162,44 @@ if [ $INIT_PACKAGES ]; then
initialize_packages
fi
+build_libyang() {
+ PKG=libyang
+ 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 checkout 179da47f2e8de
+
+ git clean -dxf
+ git reset --hard
+
+ mkdir build
+ cd build
+
+ cmake ..
+ make build-deb
+
+ cp debs/* $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_libyang
+
build_frr() {
PKG=frr
COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD)
@@ -198,7 +258,10 @@ for PKG in mdns-repeater \
eventwatchd \
ddclient \
rtrlib \
+ hvinfo \
igmpproxy \
+ ipaddrcheck \
+ lldpd \
libvyosconfig \
vyatta-bash \
vyatta-biosdevname \
@@ -241,6 +304,7 @@ for PKG in mdns-repeater \
vyos-opennhrp \
vyos-salt-minion \
vyos-strongswan \
+ vyos-vmwaretools-scripts \
vyos-world \
vyos-1x \
; do
@@ -270,9 +334,7 @@ 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
+ verbose_msg "$PKGDIR/vyos-kernel.buildlog"
error_msg "Failed to build package vyos-kernel, look in vyos-kernel.buildlog to examine the fault\n"
return 1
fi
@@ -281,7 +343,6 @@ build_kernel() {
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
@@ -329,9 +390,7 @@ build_wireguard() {
) >>$PKGDIR/vyos-wireguard.buildlog 2>&1
if [ $? -ne 0 ]; then
status_fail
- if [ $VERBOSE -eq 1 ]; then
- cat $PKGDIR/vyos-wireguard.buildlog
- fi
+ verbose_msg "$PKGDIR/vyos-wireguard.buildlog"
error_msg "Failed to build package vyos-wireguard, look in vyos-wireguard.buildlog to examine the fault\n"
return 2
fi
@@ -380,9 +439,7 @@ build_accel-ppp() {
) >>$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
+ verbose_msg "$PKGDIR/vyos-accel-ppp.buildlog"
error_msg "Failed to build package vyos-accel-ppp, look in vyos-accel-ppp.buildlog to examine the fault\n"
return 1
fi
diff --git a/scripts/defaults.py b/scripts/defaults.py
index 0b64bf19..11c5ef97 100644
--- a/scripts/defaults.py
+++ b/scripts/defaults.py
@@ -21,27 +21,17 @@ import os
BUILD_DIR = 'build'
BUILD_CONFIG = os.path.join(BUILD_DIR, 'build-config.json')
-# The default mirror was chosen entirely at random
-DEBIAN_MIRROR = 'http://ftp.nl.debian.org/debian'
-DEBIAN_SECURITY_MIRROR = 'http://ftp.nl.debian.org/debian-security'
-
-DEBIAN_DISTRIBUTION = 'jessie'
-
-SALT_MIRROR = 'http://repo.saltstack.com/apt/debian/8/amd64/2017.7'
-PDNS_MIRROR = 'http://repo.powerdns.com/debian'
-
PBUILDER_CONFIG = os.path.join(BUILD_DIR, 'pbuilderrc')
PBUILDER_DIR = os.path.join(BUILD_DIR, 'pbuilder')
LB_CONFIG_DIR = os.path.join(BUILD_DIR, 'config')
CHROOT_INCLUDES_DIR = os.path.join(LB_CONFIG_DIR, 'includes.chroot')
-VYOS_MIRROR = 'http://dev.packages.vyos.net/repositories/crux'
-
-VYOS_BRANCH = 'crux'
-
ARCHIVES_DIR = 'config/archives/'
VYOS_REPO_FILE = 'config/archives/vyos.list.chroot'
CUSTOM_REPO_FILE = 'config/archives/custom.list.chroot'
CUSTOM_PACKAGE_LIST_FILE = 'config/package-lists/custom.list.chroot'
+
+DEFAULT_BUILD_FLAVOR = 'data/defaults.json'
+
diff --git a/scripts/live-build-config b/scripts/live-build-config
index dbfc157f..9b7c2d67 100755
--- a/scripts/live-build-config
+++ b/scripts/live-build-config
@@ -36,12 +36,12 @@ lb_config_tmpl = """
lb config noauto \
--architectures {{architecture}} \
--bootappend-live "boot=live components hostname=vyos username=live nopersistence noautologin nonetworking union=overlay" \
- --linux-flavours {{architecture}}-vyos \
+ --linux-flavours {{kernel_flavor}} \
--linux-packages linux-image-{{kernel_version}} \
--bootloader syslinux,grub-efi \
--binary-images iso-hybrid \
--debian-installer false \
- --distribution jessie \
+ --distribution {{distribution}} \
--iso-application "VyOS" \
--iso-publisher "{{build_by}}" \
--iso-volume "VyOS" \
@@ -54,9 +54,9 @@ lb config noauto \
--archive-areas "main contrib non-free" \
--firmware-chroot false \
--firmware-binary false \
- --updates true \
+ --updates false \
--security true \
- --backports true \
+ --apt-options "--yes -oAcquire::Check-Valid-Until=false" \
--apt-indices false
"${@}"
"""
@@ -69,24 +69,18 @@ debug = build_config['debug']
# Add the additional repositories to package lists
print("Setting up additional APT entries")
vyos_repo_entry = "deb {0}/vyos {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch'])
-#vyos_debian_repo_entry = "deb {0}/debian {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch'])
-salt_repo_entry = "deb {0} {1} main\n".format(build_config['salt_mirror'], build_config['distribution'])
-pdns_repo_entry = "deb {0} {1}-rec-41 main\n".format(build_config['pdns_mirror'], build_config['distribution'])
+vyos_debian_repo_entry = "deb {0}/debian {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch'])
apt_file = os.path.join(build_config['build_dir'], defaults.VYOS_REPO_FILE)
if debug:
print("Adding these entries to {0}:".format(apt_file))
print("\t", vyos_repo_entry)
-# print("\t", vyos_debian_repo_entry)
- print("\t", salt_repo_entry)
- print("\t", pdns_repo_entry)
+ print("\t", vyos_debian_repo_entry)
with open(apt_file, 'w') as f:
f.write(vyos_repo_entry)
-# f.write(vyos_debian_repo_entry)
- f.write(salt_repo_entry)
- f.write(pdns_repo_entry)
+ f.write(vyos_debian_repo_entry)
# Add custom APT entries
if build_config['custom_apt_entry']:
@@ -97,6 +91,7 @@ if build_config['custom_apt_entry']:
print(entries)
with open(custom_apt_file, 'w') as f:
f.write(entries)
+ f.write("\n")
# Add custom APT keys
if build_config['custom_apt_key']:
@@ -106,9 +101,9 @@ if build_config['custom_apt_key']:
shutil.copy(k, os.path.join(key_dir, dst_name))
# Add custom packages
-if build_config['custom_packages']:
+if build_config['custom_package']:
package_list_file = os.path.join(build_config['build_dir'], defaults.CUSTOM_PACKAGE_LIST_FILE)
- packages = "\n".join(build_config['custom_packages'])
+ packages = "\n".join(build_config['custom_package'])
with open (package_list_file, 'w') as f:
f.write(packages)