From b10711d42e65c1ae604891d33cfd83628ca7aa64 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 27 Jan 2019 13:04:11 +0100 Subject: build-submodules: add libyang --- scripts/build-submodules | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'scripts') diff --git a/scripts/build-submodules b/scripts/build-submodules index 0d11c059..b3ea2c1a 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -140,6 +140,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) -- cgit v1.2.3 From 9210522425e2cd6ed5d9f83ad594e5588671863e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 27 Jan 2019 13:06:16 +0100 Subject: build-submodules: report back package error when build with --verbose --- scripts/build-submodules | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/build-submodules b/scripts/build-submodules index b3ea2c1a..6fd945d1 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -104,6 +104,9 @@ build_package() { ) >>$PKGDIR/$PKG.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail + if [ $VERBOSE -eq 1 ]; then + cat $PKGDIR/$PKG.buildlog + fi error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n" return 2 fi -- cgit v1.2.3 From 000cd8b2d962989e26c847a6337bc1b3a3f1c6a9 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 27 Jan 2019 16:19:19 +0100 Subject: build-submodules: change VERBOSE logic --- scripts/build-submodules | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'scripts') diff --git a/scripts/build-submodules b/scripts/build-submodules index 6fd945d1..79abf59f 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -24,6 +24,7 @@ print_help() { } BUILDLIST="" +VERBOSE=0 while test $# -gt 0 do @@ -70,6 +71,19 @@ 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" @@ -104,9 +118,7 @@ build_package() { ) >>$PKGDIR/$PKG.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE -eq 1 ]; then - cat $PKGDIR/$PKG.buildlog - fi + verbose_msg "$PKGDIR/$PKG.buildlog" error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n" return 2 fi @@ -131,9 +143,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 @@ -311,9 +321,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 @@ -370,9 +378,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 @@ -421,9 +427,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 -- cgit v1.2.3 From 9170ead86561b0d494df5ac464a04d703a61e036 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 27 Jan 2019 18:08:53 +0100 Subject: build-submodules: source OPAM environemnt if not present --- scripts/build-submodules | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/build-submodules b/scripts/build-submodules index 79abf59f..6423a14a 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -88,6 +88,15 @@ 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 -- cgit v1.2.3 From 9df5e15e9939dea7e5ecc944661d0ecb8eb0ccf4 Mon Sep 17 00:00:00 2001 From: Nicholas Humfrey Date: Tue, 29 Jan 2019 23:12:00 +0000 Subject: T1202: Add `hvinfo` to the packages directory (#43) --- .gitmodules | 6 +++++- docker/Dockerfile | 5 +++++ packages/hvinfo | 1 + scripts/build-submodules | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) create mode 160000 packages/hvinfo (limited to 'scripts') diff --git a/.gitmodules b/.gitmodules index 22bb87d5..8be1f363 100644 --- a/.gitmodules +++ b/.gitmodules @@ -236,4 +236,8 @@ [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 diff --git a/docker/Dockerfile b/docker/Dockerfile index bca48ff8..889652f3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -234,6 +234,11 @@ RUN eval $(opam env --root=/opt/opam --set-root) && \ 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 diff --git a/packages/hvinfo b/packages/hvinfo new file mode 160000 index 00000000..6d15dff8 --- /dev/null +++ b/packages/hvinfo @@ -0,0 +1 @@ +Subproject commit 6d15dff8eb5418a23035d18078f367bc799b702c diff --git a/scripts/build-submodules b/scripts/build-submodules index 0d11c059..11d386fd 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -198,6 +198,7 @@ for PKG in mdns-repeater \ eventwatchd \ ddclient \ rtrlib \ + hvinfo \ igmpproxy \ libvyosconfig \ vyatta-bash \ -- cgit v1.2.3 From 9779f9938e1a80736738b2b9021a0db4dd872bfa Mon Sep 17 00:00:00 2001 From: Nicholas Humfrey Date: Wed, 30 Jan 2019 10:04:31 +0000 Subject: T1214: Add `ipaddrcheck` to the packages directory --- .gitmodules | 4 ++++ docker/Dockerfile | 6 ++++++ packages/ipaddrcheck | 1 + scripts/build-submodules | 1 + 4 files changed, 12 insertions(+) create mode 160000 packages/ipaddrcheck (limited to 'scripts') diff --git a/.gitmodules b/.gitmodules index 2257b9f1..dd608357 100644 --- a/.gitmodules +++ b/.gitmodules @@ -245,3 +245,7 @@ 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 + branch = master diff --git a/docker/Dockerfile b/docker/Dockerfile index 13919ede..38dea015 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -234,6 +234,12 @@ RUN eval $(opam env --root=/opt/opam --set-root) && \ dpkg-buildpackage -uc -us -tc -b && \ dpkg -i ../libvyosconfig0_*_amd64.deb +# Packages needed for ipaddrcheck +RUN apt-get update && apt-get install -y \ + libpcre3-dev \ + libcidr-dev \ + check + # Packages needed for hvinfo RUN apt-get update && apt-get install -y \ gnat \ diff --git a/packages/ipaddrcheck b/packages/ipaddrcheck new file mode 160000 index 00000000..8f0d655c --- /dev/null +++ b/packages/ipaddrcheck @@ -0,0 +1 @@ +Subproject commit 8f0d655cc68995a0ef88dc905dc62db2af23ec90 diff --git a/scripts/build-submodules b/scripts/build-submodules index a167b6e0..ae0c1c09 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -260,6 +260,7 @@ for PKG in mdns-repeater \ rtrlib \ hvinfo \ igmpproxy \ + ipaddrcheck \ libvyosconfig \ vyatta-bash \ vyatta-biosdevname \ -- cgit v1.2.3 From b9239d076d220059f2596f1163d785e953652964 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 30 Jan 2019 22:04:09 +0100 Subject: build-submodules: add vyos-vmwaretools-scripts --- scripts/build-submodules | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/build-submodules b/scripts/build-submodules index ae0c1c09..f3ab6cf7 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -303,6 +303,7 @@ for PKG in mdns-repeater \ vyos-opennhrp \ vyos-salt-minion \ vyos-strongswan \ + vyos-vmwaretools-scripts \ vyos-world \ vyos-1x \ ; do -- cgit v1.2.3 From 78d69b0c252ba82da6bd4dbcbe50037052d58668 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 30 Jan 2019 22:04:59 +0100 Subject: Revert "T1214: Add `ipaddrcheck` to the packages directory" libcidr-dev is not available until Debian Buster thus the container can't be build. This reverts commit 9779f9938e1a80736738b2b9021a0db4dd872bfa. --- .gitmodules | 4 ---- docker/Dockerfile | 6 ------ packages/ipaddrcheck | 1 - scripts/build-submodules | 1 - 4 files changed, 12 deletions(-) delete mode 160000 packages/ipaddrcheck (limited to 'scripts') diff --git a/.gitmodules b/.gitmodules index dd608357..2257b9f1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -245,7 +245,3 @@ 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 - branch = master diff --git a/docker/Dockerfile b/docker/Dockerfile index 38dea015..13919ede 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -234,12 +234,6 @@ RUN eval $(opam env --root=/opt/opam --set-root) && \ dpkg-buildpackage -uc -us -tc -b && \ dpkg -i ../libvyosconfig0_*_amd64.deb -# Packages needed for ipaddrcheck -RUN apt-get update && apt-get install -y \ - libpcre3-dev \ - libcidr-dev \ - check - # Packages needed for hvinfo RUN apt-get update && apt-get install -y \ gnat \ diff --git a/packages/ipaddrcheck b/packages/ipaddrcheck deleted file mode 160000 index 8f0d655c..00000000 --- a/packages/ipaddrcheck +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8f0d655cc68995a0ef88dc905dc62db2af23ec90 diff --git a/scripts/build-submodules b/scripts/build-submodules index f3ab6cf7..af992649 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -260,7 +260,6 @@ for PKG in mdns-repeater \ rtrlib \ hvinfo \ igmpproxy \ - ipaddrcheck \ libvyosconfig \ vyatta-bash \ vyatta-biosdevname \ -- cgit v1.2.3 From 5a53953ab8dfa61305c837da6d912a2e8cee9711 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 31 Jan 2019 18:59:09 +0100 Subject: build-submodules: add ipaddrcheck --- .gitmodules | 3 +++ packages/ipaddrcheck | 1 + scripts/build-submodules | 1 + 3 files changed, 5 insertions(+) create mode 160000 packages/ipaddrcheck (limited to 'scripts') diff --git a/.gitmodules b/.gitmodules index 2257b9f1..9d3fcf23 100644 --- a/.gitmodules +++ b/.gitmodules @@ -245,3 +245,6 @@ 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 diff --git a/packages/ipaddrcheck b/packages/ipaddrcheck new file mode 160000 index 00000000..8f0d655c --- /dev/null +++ b/packages/ipaddrcheck @@ -0,0 +1 @@ +Subproject commit 8f0d655cc68995a0ef88dc905dc62db2af23ec90 diff --git a/scripts/build-submodules b/scripts/build-submodules index af992649..f3ab6cf7 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -260,6 +260,7 @@ for PKG in mdns-repeater \ rtrlib \ hvinfo \ igmpproxy \ + ipaddrcheck \ libvyosconfig \ vyatta-bash \ vyatta-biosdevname \ -- cgit v1.2.3 From b008fa4b62242248e5a41c6fa07fa25bcddac138 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 1 Feb 2019 19:43:24 +0100 Subject: Add lldp and pdns-recursor submodules --- .gitmodules | 6 ++++++ packages/lldpd | 1 + packages/pdns-recursor | 1 + scripts/build-submodules | 1 + 4 files changed, 9 insertions(+) create mode 160000 packages/lldpd create mode 160000 packages/pdns-recursor (limited to 'scripts') diff --git a/.gitmodules b/.gitmodules index 9d3fcf23..55e8e1b2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -248,3 +248,9 @@ [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/packages/lldpd b/packages/lldpd new file mode 160000 index 00000000..adbb26bc --- /dev/null +++ b/packages/lldpd @@ -0,0 +1 @@ +Subproject commit adbb26bc0a49d083472d24762255ff48bd001e45 diff --git a/packages/pdns-recursor b/packages/pdns-recursor new file mode 160000 index 00000000..28af51a3 --- /dev/null +++ b/packages/pdns-recursor @@ -0,0 +1 @@ +Subproject commit 28af51a3942875f0896fab2ea5945ded4a191975 diff --git a/scripts/build-submodules b/scripts/build-submodules index f3ab6cf7..e6e9cda3 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -261,6 +261,7 @@ for PKG in mdns-repeater \ hvinfo \ igmpproxy \ ipaddrcheck \ + lldpd \ libvyosconfig \ vyatta-bash \ vyatta-biosdevname \ -- cgit v1.2.3 From 274ebdb02582cc52237c95b1884b1cb24884d6f1 Mon Sep 17 00:00:00 2001 From: Nicholas Humfrey Date: Sat, 2 Feb 2019 15:34:35 +0000 Subject: Changed architecture name for 32-bit x86 to 'i386' This is the official Debian designation for the architecture (And what dpkg --print-architecture returns) https://www.debian.org/releases/stable/i386/ch02s01.html.en --- scripts/build-config | 2 +- scripts/build-flavour | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/build-config b/scripts/build-config index 3b44df77..db870be7 100755 --- a/scripts/build-config +++ b/scripts/build-config @@ -52,7 +52,7 @@ def get_validator(optdict, name): # 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: 'amd64', 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), 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 -- cgit v1.2.3 From f3e356ca7d1bd566a24af7e4616f924daca25edb Mon Sep 17 00:00:00 2001 From: bnjf Date: Wed, 27 Feb 2019 10:48:51 +1100 Subject: Update build-GCE-image (#46) 1. enable serial output for grub 2. sync isn't enough, tar was reliably throwing "changed as we read it" on my build box. umount instead to quiesce. --- scripts/build-GCE-image | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'scripts') 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} +} -- cgit v1.2.3 From 3f7186f69bf9ed30d854fadc8510ccd2e9cff089 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 2 Mar 2019 12:05:50 +0100 Subject: T929: remove debian-firmware packages from build Kernel Firmware BLOBs will be delivered by the new vyos-firmware package --- .../hooks/live/14-firmware-linux-nonfree.chroot | 12 ------------ .../hooks/live/99-cleanup-packages.chroot | 14 -------------- scripts/live-build-config | 3 ++- 3 files changed, 2 insertions(+), 27 deletions(-) delete mode 100755 data/live-build-config/hooks/live/14-firmware-linux-nonfree.chroot delete mode 100755 data/live-build-config/hooks/live/99-cleanup-packages.chroot (limited to 'scripts') diff --git a/data/live-build-config/hooks/live/14-firmware-linux-nonfree.chroot b/data/live-build-config/hooks/live/14-firmware-linux-nonfree.chroot deleted file mode 100755 index 887831cc..00000000 --- a/data/live-build-config/hooks/live/14-firmware-linux-nonfree.chroot +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -cp /etc/apt/sources.list /etc/apt/sources.list.d/non-free.list -sed -i 's/main/non-free/g' /etc/apt/sources.list.d/non-free.list - -if [ -e /etc/apt/sources.list.d/zz-sources.list ] ; then - cp /etc/apt/sources.list /etc/apt/sources.list.d/zz-non-free.list - sed -i 's/main/non-free/g' /etc/apt/sources.list.d/zz-non-free.list -fi - -apt-get update -apt-get -y install firmware-linux-nonfree diff --git a/data/live-build-config/hooks/live/99-cleanup-packages.chroot b/data/live-build-config/hooks/live/99-cleanup-packages.chroot deleted file mode 100755 index 63be7df6..00000000 --- a/data/live-build-config/hooks/live/99-cleanup-packages.chroot +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Clean up packages that were installed for dependencies but are no longer needed -# and packages installed by metapackages that we'll never need - -UNWANTED_PKGS="dahdi-firmware-nonfree \ - firmware-crystalhd firmware-ivtv \ - firmware-samsung" - -for p in $UNWANTED_PKGS; do - apt-get -y remove $p -done - -#apt-get -y autoremove diff --git a/scripts/live-build-config b/scripts/live-build-config index b585049e..ad559559 100755 --- a/scripts/live-build-config +++ b/scripts/live-build-config @@ -52,7 +52,8 @@ lb config noauto \ --mirror-binary {{debian_mirror}} \ --mirror-binary-security {{debian_security_mirror}} \ --archive-areas "main contrib non-free" \ - --firmware-chroot true \ + --firmware-chroot false \ + --firmware-binary false \ --updates true \ --security true \ --backports true \ -- cgit v1.2.3 From 48bcbfff70c0e7629f7ece72f59aec3c67e8efb4 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 18 Mar 2019 16:01:29 +0100 Subject: Add vmware ovf build procedure --- Makefile | 14 +- scripts/build-vmware-image | 172 ++++++++++++++++++--- scripts/template.ovf | 232 ++++++++++++++++++---------- tools/cloud-init/vmware/90_dpkg.cfg | 3 + tools/cloud-init/vmware/config.boot.default | 30 ++++ 5 files changed, 347 insertions(+), 104 deletions(-) create mode 100644 tools/cloud-init/vmware/90_dpkg.cfg create mode 100644 tools/cloud-init/vmware/config.boot.default (limited to 'scripts') diff --git a/Makefile b/Makefile index 17ee4e65..fb5d0e3a 100644 --- a/Makefile +++ b/Makefile @@ -57,10 +57,14 @@ vagrant-libvirt: .PHONY: vmware .ONESHELL: -vmware: +vmware: clean prepare @set -e - @scripts/check-vm-build-env - @scripts/build-vmware-image + @echo "It's not like I'm building this specially for you or anything!" + mkdir -p build/config/includes.chroot/etc/cloud/cloud.cfg.d + cp tools/cloud-init/vmware/90_dpkg.cfg build/config/includes.chroot/etc/cloud/cloud.cfg.d/ + cp -f tools/cloud-init/vmware/config.boot.default build/config/includes.chroot/opt/vyatta/etc/ + cd $(build_dir) + @../scripts/build-vmware-image .PHONY: hyperv .ONESHELL: @@ -140,6 +144,10 @@ clean: rm -f *.raw rm -f *.tar.gz rm -f *.qcow2 + rm -f *.mf + rm -f *.ovf + rm -f *.ova + rm -f *.vmdk .PHONY: purge purge: diff --git a/scripts/build-vmware-image b/scripts/build-vmware-image index 1730d7a3..5ad6615a 100755 --- a/scripts/build-vmware-image +++ b/scripts/build-vmware-image @@ -1,10 +1,8 @@ #!/bin/sh # -# Copyright (C) 2016 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 -# published by the Free Software Foundation. +# 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 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 @@ -16,7 +14,7 @@ # # File: build-vmware-image # Purpose: -# Build VyOS OVA and OVF for VMware. +# Build VyOS image for VMWARE. if [ ! $(which vmdk-convert) ]; then echo "Your system doesn't have vmdk-convert. Please install it from https://github.com/vmware/open-vmdk." @@ -32,32 +30,168 @@ else echo "Your system has ovftool." fi -export PACKER_BUILD_DIR=packer_build +lb bootstrap -DST_DIR=${PACKER_BUILD_DIR}/vmware -mkdir -p ${DST_DIR} +lb chroot +lb installer +lb binary_chroot +lb chroot_devpts install +lb chroot_proc install +lb chroot_selinuxfs install +lb chroot_sysfs install +lb chroot_hosts install +lb chroot_resolv install +lb chroot_hostname install +lb chroot_sysv-rc install +lb chroot_upstart install +lb chroot_apt install-binary +lb chroot_archives chroot install +lb binary_rootfs +lb binary_manifest +lb binary_package-lists +lb binary_linux-image +lb binary_memtest +lb binary_grub +lb binary_grub2 +lb binary_syslinux +lb binary_disk +lb binary_loadlin +lb binary_win32-loader +lb binary_includes +lb binary_hooks +lb binary_checksums -# Convert qcow2 image to VMDK -source_image=${PACKER_BUILD_DIR}/qemu/vyos_qemu_image.img -tmp_vmdk=${DST_DIR}/tmp.vmdk -vmdk=${DST_DIR}/vyos_vmware_image.vmdk -ovf=${DST_DIR}/vyos_vmware_image.ovf -qemu-img convert -f qcow2 ${source_image} -O vmdk -o adapter_type=lsilogic ${tmp_vmdk} -vmdk-convert ${tmp_vmdk} ${vmdk} +# get vyos build version +version=$(cat version) +dateymd=$(date +%Y%m%d) + +###################################### +### Prepare the HDD (format, ext.) ### +###################################### +PARTED=/sbin/parted +OUTPUT=disk.raw +OUTPUTVMDK=VyOS-"$dateymd".vmdk +IMAGE_SIZE=2 +qemu-img create -f raw ${OUTPUT} ${IMAGE_SIZE}G + +${PARTED} -s ${OUTPUT} mktable msdos +${PARTED} -s -a optimal ${OUTPUT} mkpart primary ext4 1Mi 100% +${PARTED} -s ${OUTPUT} set 1 boot on +RESULT_KPARTX=`kpartx -asv ${OUTPUT} 2>&1` + +if echo "${RESULT_KPARTX}" | grep "^add map" ; then + LOOP_DEVICE=$(echo ${RESULT_KPARTX} | cut -d" " -f3) + LOOPRAW_DEVICE=${LOOP_DEVICE%p*} + echo "kpartx mounted using: ${LOOP_DEVICE} via ${LOOPRAW_DEVICE}" +else + echo "It seems kpartx didn't mount the image correctly: exiting." + exit 1 +fi + +cleanup(){ + error=$? + [ ! -d "${MOUNT_DIR}" ] && return + if [ "$error" -gt 0 ]; then + echo + echo "Error $error" + else + echo "Finished." + fi + + set +e + + sync + umount -l ${MOUNT_DIR} + rmdir ${MOUNT_DIR} + + umount devpts-live + umount proc-live + umount sysfs-live + + dmsetup remove --deferred ${LOOP_DEVICE} + losetup -d /dev/${LOOPRAW_DEVICE} + exit $error +} +trap "cleanup" EXIT TERM INT + +mkfs.ext4 /dev/mapper/${LOOP_DEVICE} -L persistence +UUID=$(blkid -o value -s UUID /dev/mapper/${LOOP_DEVICE}) + +# No fsck because of X days without checks +tune2fs -i 0 /dev/mapper/${LOOP_DEVICE} + +MOUNT_DIR=`mktemp -d -t build-debimg.XXXXXX` +mount /dev/mapper/${LOOP_DEVICE} ${MOUNT_DIR} + +######################## +### Setting-up files ### +######################## +mkdir -p ${MOUNT_DIR}/boot/grub +mkdir -p ${MOUNT_DIR}/boot/"$version"/rw + +echo "/ union" > ${MOUNT_DIR}/persistence.conf +cp binary/live/filesystem.squashfs ${MOUNT_DIR}/boot/"$version"/"$version.squashfs" +cp binary/live/initrd.img ${MOUNT_DIR}/boot/"$version"/initrd.img +cp binary/live/vmlinuz ${MOUNT_DIR}/boot/"$version"/vmlinuz + +######################## +### Create grub menu ### +######################## +cat > ${MOUNT_DIR}/boot/grub/grub.cfg << EOF +set timeout=5 +set default=0 + +menuentry "VyOS (KVM console)" { + linux /boot/"$version"/vmlinuz boot=live quiet vyos-union=/boot/"$version" console=ttyS0,9600 console=tty0 systemd.show_status=true + initrd /boot/"$version"/initrd.img +} + +menuentry "Lost password change (KVM console)" { + linux /boot/"$version"/vmlinuz boot=live vyos-union=/boot/"$version" console=ttyS0,9600 console=tty0 systemd.show_status=true init=/opt/vyatta/sbin/standalone_root_pw_reset + initrd /boot/"$version"/initrd.img +} + +menuentry "VyOS $version (Serial console)" { + linux /boot/"$version"/vmlinuz boot=live vyos-union=/boot/"$version" console=tty0 console=ttyS0,9600n8d consoleblank=0 systemd.show_status=true + initrd /boot/"$version"/initrd.img +} + +menuentry "Lost password change $version (Serial console)" { + linux /boot/"$version"/vmlinuz boot=live vyos-union=/boot/"$version" console=tty0 console=ttyS0,9600n8d consoleblank=0 systemd.show_status=true init=/opt/vyatta/sbin/standalone_root_pw_reset + initrd /boot/"$version"/initrd.img +} +EOF + + +############################# +### Setting-up bootloader ### +############################# +grub-install --boot-directory ${MOUNT_DIR}/boot --force --no-floppy --skip-fs-probe /dev/${LOOPRAW_DEVICE} + +################### +### HOOK SCRIPT ### +################### +fstrim ${MOUNT_DIR} +sync + +qemu-img convert -f raw ${OUTPUT} -O vmdk -o adapter_type=lsilogic ${OUTPUTVMDK} +rm ${OUTPUT} + +vmdk=vyos_vmware_image.vmdk +ovf=vyos_vmware_image.ovf +vmdk-convert ${OUTPUTVMDK} ${vmdk} # Generate OVF echo 'Generating OVF file...' vmdk_file_size=$(du --bytes ${vmdk} | cut -f1) vmdk_populated_size=$(vmdk-convert -i ${vmdk} | jq .used) -version=$(cat build/version) -sed scripts/template.ovf \ +sed ../scripts/template.ovf \ -e "s/{{vmdk_file_size}}/${vmdk_file_size}/" \ -e "s/{{vmdk_populated_size}}/${vmdk_populated_size}/" \ -e "s/{{version}}/${version}/" \ > ${ovf} # Generate manifest file -cd ${DST_DIR} openssl sha1 *.vmdk *.ovf > vyos_vmware_image.mf # Convert the OVF to signed OVA... @@ -68,7 +202,9 @@ if [ ! -f ${private_key} ]; then exit 1 fi ovftool --privateKey=${PRIVATE_KEY_PATH} vyos_vmware_image.ovf vyos_vmware_image-signed.ova +#ovftool vyos_vmware_image.ovf vyos_vmware_image-signed.ova # Convert the OVF to signed OVF... echo 'Converting the OVF to signed OVF...' ovftool --privateKey=${PRIVATE_KEY_PATH} vyos_vmware_image.ovf vyos_vmware_image-signed.ovf +#ovftool vyos_vmware_image.ovf vyos_vmware_image-signed.ovf diff --git a/scripts/template.ovf b/scripts/template.ovf index f3624339..b8d3eddc 100644 --- a/scripts/template.ovf +++ b/scripts/template.ovf @@ -1,121 +1,187 @@ - - + + - - Virtual disk information - - + + List of profiles + + + Minimal hardware profile - 1 vCPU, 512 MB RAM + + + + Medium hardware profile - 4 vCPUs, 16 GB RAM + + + + Large hardware profile - 8 vCPUs, 32 GB RAM + + - The list of logical networks - - The VM Network network + List of logical networks used in the package + + Network 1 - + + Supported IP assignment schemes + + + Virtual disk information + + + A virtual machine - vyos - - The kind of installed guest operating system + + VyOS is a Linux-based network operating system that provides software-based network routing, firewall, and VPN functionality. + VyOS + VyOS maintainers and contributors + {{version}} + https://www.vyos.io + https://sentrium.io/ + + Appliance user Settings + + + The password for the appliance 'vyos' account. Passwords must be at least 8 characters in length. + + + + The public ssh key for the appliance 'vyos' account. + + Appliance IPv4 Network Settings + + + The host name for this virtual machine. + + + + The IPv4 address. Leave blank if DHCP is desired. + + + + The IPv4 netmask or prefix for this interface. Leave blank if DHCP is desired. + + + + Default gateway address. Leave blank if DHCP is desired. + + + + The domain name server IP Addresses for this VM (comma separated). Leave blank if DHCP is desired. + + + + NTP servers for this VM (comma separated). Leave blank if DHCP is desired. + + + + VM specific properties + + + + + VyOS + + + Guest Operating System + VyOS - - Virtual hardware requirements + + Virtual Hardware Requirements Virtual Hardware Family 0 - vyos - vmx-09 + vmx-11 - + hertz * 10^6 - Number of Virtual CPUs - 1 virtual CPU(s) - 1 + Number of virtual CPUs + 1 virtual CPU + 1 3 1 - - byte * 2^30 + + hertz * 10^6 + Number of virtual CPUs + 4 virtual CPUs + 1 + 3 + 4 + + + hertz * 10^6 + Number of virtual CPUs + 8 virtual CPUs + 1 + 3 + 8 + + + byte * 2^20 Memory Size - 1GB of memory - 2 + 512 MB of memory + 2 4 - 1 + 512 + + + byte * 2^20 + Memory Size + 16 GB of memory + 2 + 4 + 16384 + + + byte * 2^20 + Memory Size + 32 GB of memory + 2 + 4 + 32768 - 0 - SCSI Controller - scsiController0 - 3 + 0 + SCSI Controller 0 - LSI Logic + 3 lsilogic 6 - - 1 - IDE Controller - ideController1 - 4 - 5 - - - true - serial0 - 5 - 21 - - - - 0 - false - cdrom0 - 6 - 5 - 15 - 0 - disk0 + disk0 ovf:/disk/vmdisk1 - 7 + 4 3 17 - 2 + 1 true - VM Network - VmxNet3 ethernet adapter on "VM Network" - ethernet0 - 8 - VmxNet3 + Network 1 + Ethernet adapter on "Network 1" + 5 + vmxnet3 10 - - - false - video - 9 - 24 + + 0 + IDE Controller 0 + 6 + 5 - + + 0 false - vmci - 10 - vmware.vmci - 1 + CD/DVD Drive 1 + 7 + 6 + 15 - - - - - + - - VyOS is a Linux-based network operating system that provides software-based network routing, firewall, and VPN functionality. - VyOS - VyOS maintainers and contributors - {{version}} - - + diff --git a/tools/cloud-init/vmware/90_dpkg.cfg b/tools/cloud-init/vmware/90_dpkg.cfg new file mode 100644 index 00000000..f9c9cba0 --- /dev/null +++ b/tools/cloud-init/vmware/90_dpkg.cfg @@ -0,0 +1,3 @@ +# to update this file, run dpkg-reconfigure cloud-init +datasource_list: [ OVF ] +disable_vmware_customization: false diff --git a/tools/cloud-init/vmware/config.boot.default b/tools/cloud-init/vmware/config.boot.default new file mode 100644 index 00000000..8b7cdae5 --- /dev/null +++ b/tools/cloud-init/vmware/config.boot.default @@ -0,0 +1,30 @@ +system { + host-name vyos + login { + user vyos { + authentication { + encrypted-password $6$QxPS.uk6mfo$9QBSo8u1FkH16gMyAVhus6fU3LOzvLR9Z9.82m3tiHFAxTtIkhaZSWssSgzt4v4dGAL8rhVQxTg0oAG9/q11h/ + plaintext-password "" + } + level admin + } + } + syslog { + global { + facility all { + level info + } + facility protocols { + level debug + } + } + } + config-management { + commit-revisions 100 + } +} + +interfaces { + loopback lo { + } +} -- cgit v1.2.3 From dec0a52554c8bf8e87a0ac4dba7d7ae357672e6e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 10 Mar 2019 21:03:09 +0100 Subject: [build] Use pdns-recursor binary packages from PowerDNS https://repo.powerdns.com/ provides a package repository for Debian 8 which serves us automatically all security updates instead of rebuilding the package by us. This drops the maintenance of one additional package. --- data/live-build-config/archives/pdns.key.chroot | 30 +++++++++++++++++++++++++ scripts/build-config | 1 + scripts/defaults.py | 1 + scripts/live-build-config | 3 +++ 4 files changed, 35 insertions(+) create mode 100644 data/live-build-config/archives/pdns.key.chroot (limited to 'scripts') diff --git a/data/live-build-config/archives/pdns.key.chroot b/data/live-build-config/archives/pdns.key.chroot new file mode 100644 index 00000000..9f59d9c9 --- /dev/null +++ b/data/live-build-config/archives/pdns.key.chroot @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQINBFV2/GwBEADD4oJuwcLkYZD6R+PM0zKdZ04owicJ9e1nTbBb8OA+92TI0cJY +8XGpjEJBRECOMJi9Gr6p3QxgZX1IQbiB/RJgRN0BYTZJ6BKobJAlSNsZBVH4wt/F +Xg8IFXi8O8XNwrhhTHVLyhZxB5WIqd8Xgdb39t7qcKLLuhdzH+hTWtGNaC3UJ1xz +3KMx79U/U71XRtvloiZF1ef0XUNvDZ/2DdTNWavdJzVeDq+whD0/ThvP0LsJzzCQ +cgfRUljfxtWHOYVqHspfFg03ofDODodzq+yT5ElIQNWL71fRQ5lX8cPAVrX6v3Rs +h2tBsWV3xjMscG36E7nKbgSXWxDInr4Xw056Mx/JO6If8vnCOYOhXcv3fdZ5Lqpr +qr6uniBTcRi1q97JI1+KDoHU6MfJ7I17wU/bTPFgy6Yck4Ropmwd5dvbwRVTdQHx +n08XYEZyNdq8zskbj8MI83jvDdvdd7b95SiBO6X3qIYKebk8rg1CfYFxBIyRd2ll +yt1K0ow4M54woB/68cMy0UB6cA8uOHscRObau3T3UB0ohsEPF7KYAqOKfKP0irV+ +Ys6tR0KI/TeHqrqKhCA9PGOpOmqJaibt5GqFTc3Dp4U19njMmh4eboki8EwS6DNy +4HD76dFz2jkSQ74uB/X+nxuFEVRKS54q4aeg83NL5lnsD8TWdhTui4mURQARAQAB +tDxQb3dlckROUyBSZWxlYXNlIFNpZ25pbmcgS2V5IDxwb3dlcmRucy5zdXBwb3J0 +QHBvd2VyZG5zLmNvbT6JAj4EEwECACgFAlV2/GwCGwMFCQ8JnAAGCwkIBwMCBhUI +AgkKCwQWAgMBAh4BAheAAAoJEBsMYgX9OA+75QYQAJ7a3rZiTmBJkYfDYbZGOcJj +tIgWj5ieyIHjaG1kR3setK1GbYrd7dkeHuWIT8FCO/mQwrKTlxEd+Vj5a79Bpu0D +de1MRi7jTIb/Qrge532Pnk5T7qFjJWfvTWhpSV9XDwHR216aByuHZ9gAJt92hgo5 +eSXHPpwbi+qAdymndUswFBHY0kLNpIYAa2mZcSNbaI/RFNYPOM/aqDMcpQ2s1Rf1 +c8iTPewf04jlNd75M59AAbnpdoFiCKbV+Q8oeUNxRGhHCQgcTaWhT5vdF2pXP1jb +rVykPxN7U5zTu03m/qbUCKg9Pqkhr79a2XNIpcGHhsp58B6dJdBPhXT/tFXnVpY0 +wZHGGlBVhZzC1Qdq58ilyQ2qfIci2sjMoS62lAffemb88CyoQ2UadhNKZTn93Ogo +lmW1txqN7UU7hUBxwdztw+Pgf7V+ADwkPHnSsNLupkZ7QUOl2i1kPwgcnwHLPFoD +bYDteCtqcVVCY5v3OC95jGJ4bqwgIIeQ5kloKY2pRLeNedbCHbGc6rVjX5X0K2zt +F7/dWOklI1Ox4Y+Vv0Ln7u3BvSyl5jWXWzH2V6q3ff7NKVro3keZmgTzcBwJEv/z +p40ds9f2LTKJX4DajyAF2Z+j79obMYwKo0w+Vy36QrO8TlKk+ZU/6vcFfVdEoCtv +d5a03QgyYgMX0WW8Smam +=BY4B +-----END PGP PUBLIC KEY BLOCK----- diff --git a/scripts/build-config b/scripts/build-config index db870be7..ce83f74e 100755 --- a/scripts/build-config +++ b/scripts/build-config @@ -59,6 +59,7 @@ options = { '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), '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) diff --git a/scripts/defaults.py b/scripts/defaults.py index 73a8d459..5f1941c1 100644 --- a/scripts/defaults.py +++ b/scripts/defaults.py @@ -28,6 +28,7 @@ DEBIAN_SECURITY_MIRROR = 'http://deb.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') diff --git a/scripts/live-build-config b/scripts/live-build-config index ad559559..1aea4dc5 100755 --- a/scripts/live-build-config +++ b/scripts/live-build-config @@ -71,6 +71,7 @@ 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']) apt_file = os.path.join(build_config['build_dir'], defaults.VYOS_REPO_FILE) @@ -79,11 +80,13 @@ if debug: print("\t", vyos_repo_entry) print("\t", vyos_debian_repo_entry) print("\t", salt_repo_entry) + print("\t", pdns_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) # Add custom APT entries if build_config['custom_apt_entry']: -- cgit v1.2.3 From 9209f34d4337aa2b848019b0c88297eda9213728 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 25 Mar 2019 00:27:18 +0100 Subject: T1313: add support for reusable build flavor files. --- data/defaults.json | 15 +++++++++++++ data/kernel_version | 1 - scripts/build-config | 56 ++++++++++++++++++++++++++++------------------- scripts/build-submodules | 1 - scripts/defaults.py | 15 ++----------- scripts/live-build-config | 15 +++++-------- 6 files changed, 56 insertions(+), 47 deletions(-) create mode 100644 data/defaults.json delete mode 100644 data/kernel_version (limited to 'scripts') diff --git a/data/defaults.json b/data/defaults.json new file mode 100644 index 00000000..c403c862 --- /dev/null +++ b/data/defaults.json @@ -0,0 +1,15 @@ +{ + "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" + ], + "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/scripts/build-config b/scripts/build-config index ce83f74e..a12ecdc4 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 i386 or armhf)', lambda: 'amd64', lambda x: x in ['amd64', 'i386', '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"] -# 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'] = [] +# Add custom packages from build defaults +if not args['custom_package']: + args['custom_package'] = [] +args['custom_package'] = args['custom_package'] + build_defaults['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 @@ -138,3 +149,4 @@ print("Saving the build config to {0}".format(defaults.BUILD_CONFIG)) with open(defaults.BUILD_CONFIG, 'w') as f: json.dump(args, f, indent=4, sort_keys=True) print("\n", file=f) + diff --git a/scripts/build-submodules b/scripts/build-submodules index e6e9cda3..fc8fdf83 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -343,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 diff --git a/scripts/defaults.py b/scripts/defaults.py index 5f1941c1..5d489e48 100644 --- a/scripts/defaults.py +++ b/scripts/defaults.py @@ -21,27 +21,16 @@ 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://deb.debian.org/debian' -DEBIAN_SECURITY_MIRROR = 'http://deb.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/current' - -VYOS_BRANCH = 'current' - 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 1aea4dc5..f158ba5c 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" \ @@ -70,8 +70,6 @@ debug = build_config['debug'] 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']) apt_file = os.path.join(build_config['build_dir'], defaults.VYOS_REPO_FILE) @@ -79,14 +77,10 @@ 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) 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) # 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) -- cgit v1.2.3 From b2779e8b7969a3648d78e8a055734b81f059634e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 28 Mar 2019 22:50:22 +0100 Subject: live-build: set jessie-backports mirror to archive.debian.org --- data/defaults.json | 1 + scripts/live-build-config | 1 + 2 files changed, 2 insertions(+) (limited to 'scripts') diff --git a/data/defaults.json b/data/defaults.json index c403c862..c27df223 100644 --- a/data/defaults.json +++ b/data/defaults.json @@ -2,6 +2,7 @@ "architecture": "amd64", "debian_mirror": "http://deb.debian.org/debian", "debian_security_mirror": "http://deb.debian.org/debian-security", + "debian_security_mirror": "http://archive.debian.org/debian", "debian_distribution": "jessie", "vyos_mirror": "http://dev.packages.vyos.net/repositories/current", "vyos_branch": "current", diff --git a/scripts/live-build-config b/scripts/live-build-config index f158ba5c..8175eab7 100755 --- a/scripts/live-build-config +++ b/scripts/live-build-config @@ -51,6 +51,7 @@ lb config noauto \ --mirror-chroot-security {{debian_security_mirror}} \ --mirror-binary {{debian_mirror}} \ --mirror-binary-security {{debian_security_mirror}} \ + --mirror-binary-backports {{debian_backports_mirror}} \ --archive-areas "main contrib non-free" \ --firmware-chroot false \ --firmware-binary false \ -- cgit v1.2.3 From 432f35f0edc7f610eceff1a62e431c527a11a3f5 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 28 Mar 2019 22:51:33 +0100 Subject: live-build: final fix for Debian Backports (all good things are three) 166f8735e4e ("live-build: fix copy/paste error") still did not set all required parts for the build script. All good things will be three!!! --- scripts/build-config | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/build-config b/scripts/build-config index a12ecdc4..088dd100 100755 --- a/scripts/build-config +++ b/scripts/build-config @@ -68,6 +68,7 @@ options = { 'build-by': ('Builder identifier (e.g. jrandomhacker@example.net)', get_default_build_by, 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), + 'debian-backports-mirror': ('Debian backports mirror', lambda: build_defaults['debian_backports_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']), -- cgit v1.2.3 From 99527b3e941665290d66bfc21bb30c7a22ee717d Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 31 Mar 2019 11:27:37 +0200 Subject: Revert "live-build: final fix for Debian Backports (all good things are three)" This reverts commit 432f35f0edc7f610eceff1a62e431c527a11a3f5. --- scripts/build-config | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/build-config b/scripts/build-config index 088dd100..a12ecdc4 100755 --- a/scripts/build-config +++ b/scripts/build-config @@ -68,7 +68,6 @@ options = { 'build-by': ('Builder identifier (e.g. jrandomhacker@example.net)', get_default_build_by, 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), - 'debian-backports-mirror': ('Debian backports mirror', lambda: build_defaults['debian_backports_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']), -- cgit v1.2.3 From c88f1a9bd2afab5e93a6b3fc719131eb7e4009c3 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 31 Mar 2019 11:28:06 +0200 Subject: Revert "live-build: set jessie-backports mirror to archive.debian.org" This reverts commit b2779e8b7969a3648d78e8a055734b81f059634e. --- data/defaults.json | 1 - scripts/live-build-config | 1 - 2 files changed, 2 deletions(-) (limited to 'scripts') diff --git a/data/defaults.json b/data/defaults.json index c27df223..c403c862 100644 --- a/data/defaults.json +++ b/data/defaults.json @@ -2,7 +2,6 @@ "architecture": "amd64", "debian_mirror": "http://deb.debian.org/debian", "debian_security_mirror": "http://deb.debian.org/debian-security", - "debian_security_mirror": "http://archive.debian.org/debian", "debian_distribution": "jessie", "vyos_mirror": "http://dev.packages.vyos.net/repositories/current", "vyos_branch": "current", diff --git a/scripts/live-build-config b/scripts/live-build-config index 8175eab7..f158ba5c 100755 --- a/scripts/live-build-config +++ b/scripts/live-build-config @@ -51,7 +51,6 @@ lb config noauto \ --mirror-chroot-security {{debian_security_mirror}} \ --mirror-binary {{debian_mirror}} \ --mirror-binary-security {{debian_security_mirror}} \ - --mirror-binary-backports {{debian_backports_mirror}} \ --archive-areas "main contrib non-free" \ --firmware-chroot false \ --firmware-binary false \ -- cgit v1.2.3 From dda8ec6f3a46b2dfe9f627c620b7fb57c25d70dc Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 31 Mar 2019 14:26:49 +0200 Subject: live-build: reconfigure build after jessie-backports moved to Debian archive Debian Team finally shut down all jessie-backport mirrors after announcing discontinuation [1] in July 2018. As we heavily rely on Backported Packages for VyOS 1.2 we need to move the installation mirrors to Debian Archive. In addition the repo signing keys already expired requiring us to set Acquire::Check-Valid-Until=false when building the ISO. [1] https://lists.debian.org/debian-backports-announce/2018/07/msg00000.html [2] https://wiki.debian.org/LTS/FAQ#Who_fixes_security_issues_with_packages_in_jessie-backports.3F --- data/defaults.json | 3 ++- scripts/live-build-config | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/data/defaults.json b/data/defaults.json index c403c862..36ec598b 100644 --- a/data/defaults.json +++ b/data/defaults.json @@ -9,7 +9,8 @@ "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://repo.powerdns.com/debian jessie-rec-41 main", + "deb http://archive.debian.org/debian/ jessie-backports main" ], "custom_packages": [] } diff --git a/scripts/live-build-config b/scripts/live-build-config index f158ba5c..9b7c2d67 100755 --- a/scripts/live-build-config +++ b/scripts/live-build-config @@ -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 "${@}" """ -- cgit v1.2.3