From 595d17abea232345cf4475206363de7c379c3211 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 25 Dec 2015 18:28:27 -0500 Subject: Initial support for pbuilder. Note: pbuilder --create does not work well with relative build path, base.tgz creation fails. This led to the build_dir path being absolute. Perhaps we should make it more granular and only use absolute paths for pbuilder options. --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ec9ea473..244229d2 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,12 @@ iso: prepare lb build 2>&1 | tee build.log @echo "VyOS ISO build successful" +.PHONY: prepare-package-env +.ONESHELL: +prepare-package-env: + @scripts/pbuilder-config + @scripts/pbuilder-setup + .PHONY: clean .ONESHELL: clean: -- cgit v1.2.3 From 24a8a430779539d0be840b7ad8a3958ec02612a0 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 24 Jan 2016 13:34:15 -0500 Subject: Keep all common live-build config data in data/live-build-config If more granular data modification is needed, it can be stored in other data/ subdirs. --- Makefile | 3 +- data/includes.chroot/etc/fuse.conf | 1 - .../opt/vyatta/etc/config.boot.default | 39 ---------------------- .../includes.chroot/etc/fuse.conf | 1 + .../opt/vyatta/etc/config.boot.default | 39 ++++++++++++++++++++++ .../package-lists/vyos-base.list.chroot | 3 ++ .../package-lists/vyos-utils.list.chroot | 10 ++++++ data/package-lists/common/vyos-base.list.chroot | 3 -- data/package-lists/common/vyos-utils.list.chroot | 10 ------ 9 files changed, 54 insertions(+), 55 deletions(-) delete mode 100644 data/includes.chroot/etc/fuse.conf delete mode 100644 data/includes.chroot/opt/vyatta/etc/config.boot.default create mode 100644 data/live-build-config/includes.chroot/etc/fuse.conf create mode 100644 data/live-build-config/includes.chroot/opt/vyatta/etc/config.boot.default create mode 100644 data/live-build-config/package-lists/vyos-base.list.chroot create mode 100644 data/live-build-config/package-lists/vyos-utils.list.chroot delete mode 100644 data/package-lists/common/vyos-base.list.chroot delete mode 100644 data/package-lists/common/vyos-utils.list.chroot (limited to 'Makefile') diff --git a/Makefile b/Makefile index 244229d2..0c6d7b5a 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,7 @@ prepare: @scripts/check-config @scripts/live-build-config - cp -r data/includes.chroot/* build/config/includes.chroot/ - cp -r data/package-lists/common/* build/config/package-lists/ + cp -r data/live-build-config/* build/config/ .PHONY: iso .ONESHELL: diff --git a/data/includes.chroot/etc/fuse.conf b/data/includes.chroot/etc/fuse.conf deleted file mode 100644 index a439ab82..00000000 --- a/data/includes.chroot/etc/fuse.conf +++ /dev/null @@ -1 +0,0 @@ -user_allow_other diff --git a/data/includes.chroot/opt/vyatta/etc/config.boot.default b/data/includes.chroot/opt/vyatta/etc/config.boot.default deleted file mode 100644 index f5ec2b5d..00000000 --- a/data/includes.chroot/opt/vyatta/etc/config.boot.default +++ /dev/null @@ -1,39 +0,0 @@ -system { - login { - user vyos { - authentication { - encrypted-password $6$QxPS.uk6mfo$9QBSo8u1FkH16gMyAVhus6fU3LOzvLR9Z9.82m3tiHFAxTtIkhaZSWssSgzt4v4dGAL8rhVQxTg0oAG9/q11h/ - plaintext-password "" - } - level admin - } - } - syslog { - global { - facility all { - level notice - } - facility protocols { - level debug - } - } - } - ntp { - server "0.pool.ntp.org" - server "1.pool.ntp.org" - server "2.pool.ntp.org" - } - console { - device ttyS0 { - speed 9600 - } - } - config-management { - commit-revisions 100 - } -} - -interfaces { - loopback lo { - } -} diff --git a/data/live-build-config/includes.chroot/etc/fuse.conf b/data/live-build-config/includes.chroot/etc/fuse.conf new file mode 100644 index 00000000..a439ab82 --- /dev/null +++ b/data/live-build-config/includes.chroot/etc/fuse.conf @@ -0,0 +1 @@ +user_allow_other diff --git a/data/live-build-config/includes.chroot/opt/vyatta/etc/config.boot.default b/data/live-build-config/includes.chroot/opt/vyatta/etc/config.boot.default new file mode 100644 index 00000000..f5ec2b5d --- /dev/null +++ b/data/live-build-config/includes.chroot/opt/vyatta/etc/config.boot.default @@ -0,0 +1,39 @@ +system { + login { + user vyos { + authentication { + encrypted-password $6$QxPS.uk6mfo$9QBSo8u1FkH16gMyAVhus6fU3LOzvLR9Z9.82m3tiHFAxTtIkhaZSWssSgzt4v4dGAL8rhVQxTg0oAG9/q11h/ + plaintext-password "" + } + level admin + } + } + syslog { + global { + facility all { + level notice + } + facility protocols { + level debug + } + } + } + ntp { + server "0.pool.ntp.org" + server "1.pool.ntp.org" + server "2.pool.ntp.org" + } + console { + device ttyS0 { + speed 9600 + } + } + config-management { + commit-revisions 100 + } +} + +interfaces { + loopback lo { + } +} diff --git a/data/live-build-config/package-lists/vyos-base.list.chroot b/data/live-build-config/package-lists/vyos-base.list.chroot new file mode 100644 index 00000000..6e5c1122 --- /dev/null +++ b/data/live-build-config/package-lists/vyos-base.list.chroot @@ -0,0 +1,3 @@ +debconf +gpgv +gnupg diff --git a/data/live-build-config/package-lists/vyos-utils.list.chroot b/data/live-build-config/package-lists/vyos-utils.list.chroot new file mode 100644 index 00000000..3d1a3b2a --- /dev/null +++ b/data/live-build-config/package-lists/vyos-utils.list.chroot @@ -0,0 +1,10 @@ +nmap +dnsutils +sipcalc +mtr-tiny +whois +netcat +netcat6 +socat +telnet +tcpdump diff --git a/data/package-lists/common/vyos-base.list.chroot b/data/package-lists/common/vyos-base.list.chroot deleted file mode 100644 index 6e5c1122..00000000 --- a/data/package-lists/common/vyos-base.list.chroot +++ /dev/null @@ -1,3 +0,0 @@ -debconf -gpgv -gnupg diff --git a/data/package-lists/common/vyos-utils.list.chroot b/data/package-lists/common/vyos-utils.list.chroot deleted file mode 100644 index 3d1a3b2a..00000000 --- a/data/package-lists/common/vyos-utils.list.chroot +++ /dev/null @@ -1,10 +0,0 @@ -nmap -dnsutils -sipcalc -mtr-tiny -whois -netcat -netcat6 -socat -telnet -tcpdump -- cgit v1.2.3 From cddc611ae3a6da15aaa2bded568209bb3eca27de Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 26 Jan 2016 16:10:52 -0500 Subject: Add a build step for generating version files. --- Makefile | 2 ++ scripts/defaults.py | 3 +++ scripts/make-version-file | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100755 scripts/make-version-file (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0c6d7b5a..56e61d9b 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ prepare: @scripts/live-build-config cp -r data/live-build-config/* build/config/ + @scripts/make-version-file + .PHONY: iso .ONESHELL: iso: prepare diff --git a/scripts/defaults.py b/scripts/defaults.py index beef4a7a..b9a3f255 100644 --- a/scripts/defaults.py +++ b/scripts/defaults.py @@ -28,3 +28,6 @@ DEBIAN_DISTRIBUTION = 'jessie' 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') diff --git a/scripts/make-version-file b/scripts/make-version-file new file mode 100755 index 00000000..fcc399f8 --- /dev/null +++ b/scripts/make-version-file @@ -0,0 +1,66 @@ +#!/usr/bin/python +# Copyright (C) 2016 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 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 . +# +# File: make-version-file +# Purpose: +# Creates version file in live-build chroot includes dir +# that is included in the image and used by 'show version' command +# and install/upgrade scripts. + +from __future__ import print_function +import os +import datetime +import json +import uuid + +import defaults +import util + +util.check_build_config() +with open(defaults.BUILD_CONFIG, 'r') as f: + build_config = json.load(f) + + +now = datetime.datetime.today() + +build_timestamp = now.strftime("%Y%m%d%H%M") + +# FIXME: use aware rather than naive object +build_date = now.strftime("%a %d %b %Y %H:%M UTC") + +# Assign a (hopefully) unique identifier to the build (UUID) +build_id = str(uuid.uuid4()) + +if build_config['build_type'] == 'development': + version = "999.{0}".format(build_timestamp) +else: + version = build_config['version'] + +version_data = { + 'version': version, + 'built_by': build_config['build_by'], + 'built_on': build_date, + 'build_id': build_id +} + + +with open(os.path.join(defaults.CHROOT_INCLUDES_DIR, 'opt/vyatta/etc/version.json'), 'w') as f: + json.dump(version_data, f) + +# For backwards compatibility with 'add system image' script from older versions +# we need a file in old format so that script can find out the version of the image +# for upgrade +with open(os.path.join(defaults.CHROOT_INCLUDES_DIR, 'opt/vyatta/etc/version'), 'w') as f: + print("Version: {0}".format(version), file=f) -- cgit v1.2.3 From dd54dd008d50a301505b8afd1a24326e1a75733b Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 29 Jan 2016 17:23:57 -0500 Subject: Remove the "build successful" message for now. Apparently live-build doesn't return $?>0 correctly for certain failures, which may lead to misleading success message when the build in fact had failed. --- Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 56e61d9b..28c6b96f 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,6 @@ iso: prepare @echo "It's not like I'm building this specially for you or anything!" cd $(build_dir) lb build 2>&1 | tee build.log - @echo "VyOS ISO build successful" .PHONY: prepare-package-env .ONESHELL: -- cgit v1.2.3 From 2b7a2bff886626e9a34966dec07b7010a97a76ba Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 3 Feb 2016 10:21:48 -0500 Subject: Add a script for copying various files to the build config dir depending on build flavour. --- Makefile | 3 +++ data/package-lists/vyos-dev.list.chroot | 2 ++ scripts/build-flavour | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 data/package-lists/vyos-dev.list.chroot create mode 100755 scripts/build-flavour (limited to 'Makefile') diff --git a/Makefile b/Makefile index 28c6b96f..84839ce3 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,14 @@ prepare: @scripts/check-build-env @scripts/check-config + rm -rf build/config/* @scripts/live-build-config cp -r data/live-build-config/* build/config/ @scripts/make-version-file + @scripts/build-flavour + .PHONY: iso .ONESHELL: iso: prepare diff --git a/data/package-lists/vyos-dev.list.chroot b/data/package-lists/vyos-dev.list.chroot new file mode 100644 index 00000000..d057008f --- /dev/null +++ b/data/package-lists/vyos-dev.list.chroot @@ -0,0 +1,2 @@ +gdb +strace diff --git a/scripts/build-flavour b/scripts/build-flavour new file mode 100755 index 00000000..8cbdc10e --- /dev/null +++ b/scripts/build-flavour @@ -0,0 +1,26 @@ +#!/bin/sh +# Copyright (C) 2016 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 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 . +# +# File: build-flavour +# Purpose: Adds various data files to the build config +# depending on the build flavour. + + +BUILD_TYPE=$(scripts/query-config build_type) + +# Add debug tools if it's a development image +if [ $BUILD_TYPE = "development" ]; then + cp data/package-lists/vyos-dev.list.chroot build/config/package-lists/ +fi -- cgit v1.2.3 From 775c50d622863b791f8c7dacc3e9020532291fe8 Mon Sep 17 00:00:00 2001 From: Patrick van Staveren Date: Mon, 1 Feb 2016 07:32:26 +0900 Subject: Handle errors from subscripts. Makefile .ONESHELL mode means that individual line exit codes aren't evaluated, only the final return code from the shell, which will always be zero. This makes it break earlier when a subscript returns non-zero. Maybe we shouldn't be using make? ;) --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 84839ce3..478830b0 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ all: .PHONY: prepare prepare: + set -e @echo "Starting VyOS ISO image build" @scripts/check-build-env @@ -23,6 +24,7 @@ prepare: .PHONY: iso .ONESHELL: iso: prepare + set -e @echo "It's not like I'm building this specially for you or anything!" cd $(build_dir) lb build 2>&1 | tee build.log @@ -30,12 +32,14 @@ iso: prepare .PHONY: prepare-package-env .ONESHELL: prepare-package-env: + set -e @scripts/pbuilder-config @scripts/pbuilder-setup .PHONY: clean .ONESHELL: clean: + set -e cd $(build_dir) lb clean -- cgit v1.2.3 From 285f9672490ca3462ebf6e40555e2b7f80bd226b Mon Sep 17 00:00:00 2001 From: Patrick van Staveren Date: Mon, 1 Feb 2016 07:38:45 +0900 Subject: silently enable error mode in shell --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 478830b0..38448f39 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ all: .PHONY: prepare prepare: - set -e + @set -e @echo "Starting VyOS ISO image build" @scripts/check-build-env @@ -24,7 +24,7 @@ prepare: .PHONY: iso .ONESHELL: iso: prepare - set -e + @set -e @echo "It's not like I'm building this specially for you or anything!" cd $(build_dir) lb build 2>&1 | tee build.log @@ -32,14 +32,14 @@ iso: prepare .PHONY: prepare-package-env .ONESHELL: prepare-package-env: - set -e + @set -e @scripts/pbuilder-config @scripts/pbuilder-setup .PHONY: clean .ONESHELL: clean: - set -e + @set -e cd $(build_dir) lb clean -- cgit v1.2.3 From 6a7696a1122560073c3121fdecb5e3bd0c6549cf Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 3 Mar 2016 18:28:31 -0500 Subject: After build, create a properly named symlink to the ISO (ref T8). This is important for nightly builds, and handy for release builds. --- Makefile | 4 +++- scripts/make-version-file | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 38448f39..0a0cb2dd 100644 --- a/Makefile +++ b/Makefile @@ -23,11 +23,12 @@ prepare: .PHONY: iso .ONESHELL: -iso: prepare +iso: clean prepare @set -e @echo "It's not like I'm building this specially for you or anything!" cd $(build_dir) lb build 2>&1 | tee build.log + ln -nsf live-image-amd64.hybrid.iso vyos-`cat version`-`dpkg --print-architecture`.iso .PHONY: prepare-package-env .ONESHELL: @@ -45,6 +46,7 @@ clean: rm -f config/binary config/bootstrap config/chroot config/common config/source rm -f build.log + rm -f vyos-*.iso .PHONY: purge purge: diff --git a/scripts/make-version-file b/scripts/make-version-file index fcc399f8..6c597090 100755 --- a/scripts/make-version-file +++ b/scripts/make-version-file @@ -64,3 +64,9 @@ with open(os.path.join(defaults.CHROOT_INCLUDES_DIR, 'opt/vyatta/etc/version.jso # for upgrade with open(os.path.join(defaults.CHROOT_INCLUDES_DIR, 'opt/vyatta/etc/version'), 'w') as f: print("Version: {0}".format(version), file=f) + +# Leaky abstraction: we want ISO file name include version number, +# but we probably don't want to have a separate build step just for this, +# neither we want to use lengthy paths in makefiles +with open(os.path.join(defaults.BUILD_DIR, 'version'), 'w') as f: + print(version, file=f) -- cgit v1.2.3 From 3e56d7456e55b46ceb1dbca6a8f5cbc5150e18f5 Mon Sep 17 00:00:00 2001 From: Yuya Kusakabe Date: Fri, 4 Mar 2016 14:33:32 +0900 Subject: Add qemu image build scripts --- .gitignore | 2 ++ Makefile | 7 ++++++ scripts/build-qemu-image | 30 ++++++++++++++++++++++ scripts/check-vm-build-env | 61 +++++++++++++++++++++++++++++++++++++++++++++ scripts/packer.json | 62 ++++++++++++++++++++++++++++++++++++++++++++++ tools/run-qemu-image.sh | 16 ++++++++++++ 6 files changed, 178 insertions(+) create mode 100755 scripts/build-qemu-image create mode 100755 scripts/check-vm-build-env create mode 100644 scripts/packer.json create mode 100755 tools/run-qemu-image.sh (limited to 'Makefile') diff --git a/.gitignore b/.gitignore index a0114d35..889ab43d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ build/* *.pyc +packer_build/* +packer_cache/* diff --git a/Makefile b/Makefile index 0a0cb2dd..86f0c27d 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,13 @@ prepare-package-env: @scripts/pbuilder-config @scripts/pbuilder-setup +.PHONY: qemu +.ONESHELL: +qemu: + @set -e + @scripts/check-vm-build-env + @scripts/build-qemu-image + .PHONY: clean .ONESHELL: clean: diff --git a/scripts/build-qemu-image b/scripts/build-qemu-image new file mode 100755 index 00000000..8643508a --- /dev/null +++ b/scripts/build-qemu-image @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (C) 2016 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 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 . +# +# File: build-qemu-image +# Purpose: +# Build VyOS raw image for qemu. + + +export ISO_IMAGE=./build/live-image-amd64.hybrid.iso +export ISO_MD5_SUM=$(md5sum ${ISO_IMAGE} | awk '{print $1}') +export PACKER_BUILD_DIR=packer_build +export PACKER_LOG_PATH=${PACKER_BUILD_DIR}/build.log +export PACKER_LOG=1 + +mkdir -p ${PACKER_BUILD_DIR} + +packer build -only=qemu scripts/packer.json diff --git a/scripts/check-vm-build-env b/scripts/check-vm-build-env new file mode 100755 index 00000000..290b28c8 --- /dev/null +++ b/scripts/check-vm-build-env @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 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 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 . +# +# File: check-vm-build-env +# Purpose: +# Checks if packages required for VM image build are installed. + + +import os +import sys +from distutils.spawn import find_executable + +required_packages = [ + 'make', + 'qemu-system-x86', + 'qemu-utils' +] + + +def is_installed(name): + result = os.system("dpkg-query -W --showformat='${{Status}}\n' {name} 2>&1 | grep 'install ok installed' >/dev/null".format(name=name)) + return True if result == 0 else False + + +missing_packages = [] + +print("Checking if packages required for VyOS VM image build are installed") + +for p in required_packages: + if not is_installed(p): + missing_packages.append(p) + +if missing_packages: + print("Your system does not have some of the required packages installed.") + print("Please install the following packages:") + print(" ".join(missing_packages)) + sys.exit(1) +else: + print("All required packages are installed") + +if find_executable("packer"): + print("Your system has Packer.") +else: + print("Your system does not have Packer.") + print("Please install Packer from https://www.packer.io/downloads.html.") + sys.exit(1) + +sys.exit(0) diff --git a/scripts/packer.json b/scripts/packer.json new file mode 100644 index 00000000..5d5f201e --- /dev/null +++ b/scripts/packer.json @@ -0,0 +1,62 @@ +{ + "variables": { + "iso_url": "{{env `ISO_IMAGE`}}", + "iso_checksum": "{{env `ISO_MD5_SUM`}}", + "output_directory": "{{env `PACKER_BUILD_DIR`}}" + }, + "builders": + [ + { + "type": "qemu", + "iso_url": "{{user `iso_url`}}", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "md5", + "output_directory": "{{user `output_directory`}}/qemu", + "shutdown_command": "sudo halt -p", + "disk_size": 4096, + "format": "raw", + "headless": true, + "accelerator": "kvm", + "ssh_host_port_min": 2222, + "ssh_host_port_max": 2229, + "ssh_username": "vyos", + "ssh_password": "vyos", + "ssh_port": 22, + "ssh_wait_timeout": "30s", + "vm_name": "vyos_qemu_image.img", + "net_device": "virtio-net", + "disk_interface": "virtio", + "boot_wait": "5s", + "boot_command": + [ + "", + "vyos", + "vyos", + "install image", + "", + "", + "", + "Yes", + "", + "", + "", + "vyos", + "vyos", + "", + "reboot", + "Yes", + "vyos", + "vyos", + "configure", + "delete system console", + "set interface ethernet eth0 address dhcp", + "set service ssh", + "commit", + "save", + "exit", + "reboot", + "Yes" + ] + } + ] +} diff --git a/tools/run-qemu-image.sh b/tools/run-qemu-image.sh new file mode 100755 index 00000000..b021ebd6 --- /dev/null +++ b/tools/run-qemu-image.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +VM_NAME='vyos_qemu' +VM_IMAGE='./packer_build/qemu/vyos_qemu_image.img' +MEMORY_SIZE='1024' +NCPUS=1 +SSH_PORT=2222 + +qemu-system-x86_64 \ + -name "${VM_NAME}" \ + -m ${MEMORY_SIZE} \ + -net nic,vlan=0,model=virtio \ + -net user,vlan=0,hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \ + -drive if=virtio,file=${VM_IMAGE} \ + -machine accel=kvm \ + -cpu host -smp ${NCPUS} -- cgit v1.2.3 From 7ba48ff801e98f25053b048e834b8b073fe21ad3 Mon Sep 17 00:00:00 2001 From: Yuya Kusakabe Date: Mon, 7 Mar 2016 00:00:33 +0900 Subject: Add build scripts for VMware OVF (ref T14) --- Makefile | 7 +++ scripts/build-qemu-image | 2 +- scripts/build-vmware-ovf | 45 ++++++++++++++ scripts/packer-scripts/vmware.sh | 29 +++++++++ scripts/packer.json | 33 ++++++++++ scripts/template.ovf | 131 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 246 insertions(+), 1 deletion(-) create mode 100755 scripts/build-vmware-ovf create mode 100644 scripts/packer-scripts/vmware.sh create mode 100644 scripts/template.ovf (limited to 'Makefile') diff --git a/Makefile b/Makefile index 86f0c27d..adce002c 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,13 @@ qemu: @scripts/check-vm-build-env @scripts/build-qemu-image +.PHONY: vmware-ovf +.ONESHELL: +vmware-ovf: + @set -e + @scripts/check-vm-build-env + @scripts/build-vmware-ovf + .PHONY: clean .ONESHELL: clean: diff --git a/scripts/build-qemu-image b/scripts/build-qemu-image index 8643508a..4a67f0f3 100755 --- a/scripts/build-qemu-image +++ b/scripts/build-qemu-image @@ -27,4 +27,4 @@ export PACKER_LOG=1 mkdir -p ${PACKER_BUILD_DIR} -packer build -only=qemu scripts/packer.json +packer build -only=qemu-image scripts/packer.json diff --git a/scripts/build-vmware-ovf b/scripts/build-vmware-ovf new file mode 100755 index 00000000..ff2a5464 --- /dev/null +++ b/scripts/build-vmware-ovf @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Copyright (C) 2016 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 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 . +# +# File: build-vmware-ovf +# Purpose: +# Build VyOS OVF 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." + exit 1 +else + echo "Your system has vmdk-convert." +fi + +export PACKER_BUILD_DIR=packer_build +export PACKER_LOG_PATH=${PACKER_BUILD_DIR}/build_vmware_ovf.log +export PACKER_LOG=1 + +mkdir -p ${PACKER_BUILD_DIR} + +packer build -only=vmware-image scripts/packer.json + +# Convert raw image to VMDK +source_image=${PACKER_BUILD_DIR}/vmware/vyos_vmware_image.img +tmp_vmdk=${PACKER_BUILD_DIR}/vmware/tmp.vmdk +vmdk=${PACKER_BUILD_DIR}/vmware/vyos_vmware_image.vmdk +qemu-img convert -f raw ${source_image} -O vmdk -o adapter_type=lsilogic ${tmp_vmdk} +vmdk-convert ${tmp_vmdk} ${vmdk} + +# Generate OVF +vmdk_file_size=$(du --bytes ${vmdk} | awk '{print $1}') +cat scripts/template.ovf | sed "s/{{vmdk_file_size}}/${vmdk_file_size}/" > packer_build/vmware/vyos_vmware_image.ovf diff --git a/scripts/packer-scripts/vmware.sh b/scripts/packer-scripts/vmware.sh new file mode 100644 index 00000000..60c4db7e --- /dev/null +++ b/scripts/packer-scripts/vmware.sh @@ -0,0 +1,29 @@ +#!/bin/vbash +source /opt/vyatta/etc/functions/script-template + +# Add Debian Jessie repository +set system package repository jessie url 'http://ftp.nl.debian.org/debian/' +set system package repository jessie distribution 'jessie' +set system package repository jessie components 'main contrib non-free' +commit +save + +# Install open-vm-tools +sudo apt-get update +sudo apt-get -y install open-vm-tools + +# Delete Debian Jessie repository +delete system package repository jessie +commit +save + +# Removing leftover leases and persistent rules +sudo rm -f /var/lib/dhcp3/* + +# Removing apt caches +sudo rm -rf /var/cache/apt/* + +# Removing hw-id +delete interfaces ethernet eth0 hw-id +commit +save diff --git a/scripts/packer.json b/scripts/packer.json index 6d487353..e54dc74e 100644 --- a/scripts/packer.json +++ b/scripts/packer.json @@ -7,6 +7,7 @@ "builders": [ { + "name": "qemu-image", "type": "qemu", "iso_url": "{{user `iso_url`}}", "iso_checksum": "{{user `iso_checksum`}}", @@ -57,6 +58,38 @@ "save", "exit" ] + }, + { + "name": "vmware-image", + "type": "qemu", + "iso_url": "{{user `output_directory`}}/qemu/vyos_qemu_image.img", + "iso_checksum_type": "none", + "output_directory": "{{user `output_directory`}}/vmware", + "shutdown_command": "sudo halt -p", + "disk_image": true, + "disk_size": 4096, + "format": "raw", + "headless": false, + "accelerator": "tcg", + "ssh_host_port_min": 2222, + "ssh_host_port_max": 2229, + "ssh_username": "vyos", + "ssh_password": "vyos", + "ssh_port": 22, + "ssh_wait_timeout": "300s", + "vm_name": "vyos_vmware_image.img", + "net_device": "virtio-net", + "disk_interface": "virtio", + "boot_wait": "5s" + } + ], + "provisioners": [ + { + "type": "shell", + "only": ["vmware-image"], + "scripts": [ + "scripts/packer-scripts/vmware.sh" + ] } ] } diff --git a/scripts/template.ovf b/scripts/template.ovf new file mode 100644 index 00000000..2250eb55 --- /dev/null +++ b/scripts/template.ovf @@ -0,0 +1,131 @@ + + + + + + + Virtual disk information + + + + The list of logical networks + + The VM Network network + + + + A virtual machine + vyos + + The kind of installed guest operating system + + + Virtual hardware requirements + + Virtual Hardware Family + 0 + vyos + vmx-08 + + + hertz * 10^6 + Number of Virtual CPUs + 1 virtual CPU(s) + 1 + 3 + 1 + + + byte * 2^20 + Memory Size + 512MB of memory + 2 + 4 + 512 + + + 0 + USB Controller (EHCI) + usb + 3 + vmware.usb.ehci + 23 + + + + 0 + SCSI Controller + scsiController0 + 4 + lsilogic + 6 + + + 1 + IDE Controller + ideController1 + 5 + 5 + + + true + serial0 + 6 + 21 + + + + 0 + false + cdrom0 + 7 + 5 + 15 + + + 0 + disk0 + ovf:/disk/vmdisk1 + 8 + 4 + 17 + + + 2 + true + VM Network + VMXNET3 ethernet adapter on "nat" + ethernet0 + 9 + VMXNET3 + 10 + + + + false + sound + 10 + vmware.soundcard.ensoniq1371 + 1 + + + false + video + 11 + 24 + + + false + vmci + 12 + vmware.vmci + 1 + + + + + + + + + -- cgit v1.2.3 From c5df2dd17dffda133a0c0bb68d6a9a16c10f1c2e Mon Sep 17 00:00:00 2001 From: Yuya Kusakabe Date: Tue, 8 Mar 2016 09:08:36 +0900 Subject: Add support for signed VMware OVA (ref T14). --- Makefile | 6 ++-- scripts/build-vmware-ova | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/build-vmware-ovf | 55 ----------------------------------- 3 files changed, 77 insertions(+), 58 deletions(-) create mode 100755 scripts/build-vmware-ova delete mode 100755 scripts/build-vmware-ovf (limited to 'Makefile') diff --git a/Makefile b/Makefile index adce002c..6c401e2c 100644 --- a/Makefile +++ b/Makefile @@ -44,12 +44,12 @@ qemu: @scripts/check-vm-build-env @scripts/build-qemu-image -.PHONY: vmware-ovf +.PHONY: vmware-ova .ONESHELL: -vmware-ovf: +vmware-ova: @set -e @scripts/check-vm-build-env - @scripts/build-vmware-ovf + @scripts/build-vmware-ova .PHONY: clean .ONESHELL: diff --git a/scripts/build-vmware-ova b/scripts/build-vmware-ova new file mode 100755 index 00000000..c0e85cdc --- /dev/null +++ b/scripts/build-vmware-ova @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Copyright (C) 2016 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 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 . +# +# File: build-vmware-ovf +# Purpose: +# Build VyOS OVF 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." + exit 1 +else + echo "Your system has vmdk-convert." +fi + +if [ ! $(which ovftool) ]; then + echo "Your system doesn't have ovftool. Please install it from https://www.vmware.com/support/developer/ovf/." + exit 1 +else + echo "Your system has ovftool." +fi + +export PACKER_BUILD_DIR=packer_build +export PACKER_LOG_PATH=${PACKER_BUILD_DIR}/build_vmware_ovf.log +export PACKER_LOG=1 + +mkdir -p ${PACKER_BUILD_DIR} +DST_DIR=${PACKER_BUILD_DIR}/vmware + +packer build -only=vmware-image scripts/packer.json + +# Convert raw image to VMDK +source_image=${DST_DIR}/vyos_vmware_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 raw ${source_image} -O vmdk -o adapter_type=lsilogic ${tmp_vmdk} +vmdk-convert ${tmp_vmdk} ${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 \ + -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... +echo 'Converting the OVF to signed OVA...' +private_key=${PRIVATE_KEY_PATH:-"../../key/privatekey.pem"} +if [ ! -f ${private_key} ]; then + echo 'Please put your key to "key" directory in repository root, or set PRIVATE_KEY_PATH to environment variables.' + exit 1 +fi +ovftool --privateKey=${PRIVATE_KEY_PATH} vyos_vmware_image.ovf vyos_vmware_image.ova diff --git a/scripts/build-vmware-ovf b/scripts/build-vmware-ovf deleted file mode 100755 index 8890ba69..00000000 --- a/scripts/build-vmware-ovf +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2016 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 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 . -# -# File: build-vmware-ovf -# Purpose: -# Build VyOS OVF 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." - exit 1 -else - echo "Your system has vmdk-convert." -fi - -export PACKER_BUILD_DIR=packer_build -export PACKER_LOG_PATH=${PACKER_BUILD_DIR}/build_vmware_ovf.log -export PACKER_LOG=1 - -mkdir -p ${PACKER_BUILD_DIR} -DST_DIR=${PACKER_BUILD_DIR}/vmware - -packer build -only=vmware-image scripts/packer.json - -# Convert raw image to VMDK -source_image=${DST_DIR}/vyos_vmware_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 raw ${source_image} -O vmdk -o adapter_type=lsilogic ${tmp_vmdk} -vmdk-convert ${tmp_vmdk} ${vmdk} - -# Generate OVF -vmdk_file_size=$(vmdk-convert -i ${vmdk} | jq .capacity) -vmdk_populated_size=$(vmdk-convert -i ${vmdk} | jq .used) -version=$(cat build/version) -cat scripts/template.ovf | sed "s/{{vmdk_file_size}}/${vmdk_file_size}/" > ${ovf} -sed -i "s/{{vmdk_populated_size}}/${vmdk_populated_size}/" ${ovf} -sed -i "s/{{version}}/${version}/" ${ovf} - -# Generate manifest file -cd ${DST_DIR} -openssl sha1 *.vmdk *.ovf > vyos_vmware_image.mf -- cgit v1.2.3 From a0a10a1057ceafe7abf6a8da30894c97e5a90a1a Mon Sep 17 00:00:00 2001 From: Yuya Kusakabe Date: Tue, 8 Mar 2016 11:17:56 +0900 Subject: Add support for signed VMware OVF (ref T14). --- Makefile | 6 ++-- scripts/build-vmware-image | 78 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/build-vmware-ova | 74 ------------------------------------------- 3 files changed, 81 insertions(+), 77 deletions(-) create mode 100755 scripts/build-vmware-image delete mode 100755 scripts/build-vmware-ova (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6c401e2c..2e6dd9ad 100644 --- a/Makefile +++ b/Makefile @@ -44,12 +44,12 @@ qemu: @scripts/check-vm-build-env @scripts/build-qemu-image -.PHONY: vmware-ova +.PHONY: vmware .ONESHELL: -vmware-ova: +vmware: @set -e @scripts/check-vm-build-env - @scripts/build-vmware-ova + @scripts/build-vmware-image .PHONY: clean .ONESHELL: diff --git a/scripts/build-vmware-image b/scripts/build-vmware-image new file mode 100755 index 00000000..189461eb --- /dev/null +++ b/scripts/build-vmware-image @@ -0,0 +1,78 @@ +#!/bin/sh +# +# Copyright (C) 2016 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 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 . +# +# File: build-vmware-ovf +# Purpose: +# Build VyOS OVF 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." + exit 1 +else + echo "Your system has vmdk-convert." +fi + +if [ ! $(which ovftool) ]; then + echo "Your system doesn't have ovftool. Please install it from https://www.vmware.com/support/developer/ovf/." + exit 1 +else + echo "Your system has ovftool." +fi + +export PACKER_BUILD_DIR=packer_build +export PACKER_LOG_PATH=${PACKER_BUILD_DIR}/build_vmware_ovf.log +export PACKER_LOG=1 + +mkdir -p ${PACKER_BUILD_DIR} +DST_DIR=${PACKER_BUILD_DIR}/vmware + +packer build -only=vmware-image scripts/packer.json + +# Convert raw image to VMDK +source_image=${DST_DIR}/vyos_vmware_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 raw ${source_image} -O vmdk -o adapter_type=lsilogic ${tmp_vmdk} +vmdk-convert ${tmp_vmdk} ${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 \ + -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... +echo 'Converting the OVF to signed OVA...' +private_key=${PRIVATE_KEY_PATH:-"../../key/privatekey.pem"} +if [ ! -f ${private_key} ]; then + echo 'Please put your key to "key/privatekey.pem" in repository root, or set PRIVATE_KEY_PATH to environment variables.' + exit 1 +fi +ovftool --privateKey=${PRIVATE_KEY_PATH} 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 diff --git a/scripts/build-vmware-ova b/scripts/build-vmware-ova deleted file mode 100755 index c0e85cdc..00000000 --- a/scripts/build-vmware-ova +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2016 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 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 . -# -# File: build-vmware-ovf -# Purpose: -# Build VyOS OVF 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." - exit 1 -else - echo "Your system has vmdk-convert." -fi - -if [ ! $(which ovftool) ]; then - echo "Your system doesn't have ovftool. Please install it from https://www.vmware.com/support/developer/ovf/." - exit 1 -else - echo "Your system has ovftool." -fi - -export PACKER_BUILD_DIR=packer_build -export PACKER_LOG_PATH=${PACKER_BUILD_DIR}/build_vmware_ovf.log -export PACKER_LOG=1 - -mkdir -p ${PACKER_BUILD_DIR} -DST_DIR=${PACKER_BUILD_DIR}/vmware - -packer build -only=vmware-image scripts/packer.json - -# Convert raw image to VMDK -source_image=${DST_DIR}/vyos_vmware_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 raw ${source_image} -O vmdk -o adapter_type=lsilogic ${tmp_vmdk} -vmdk-convert ${tmp_vmdk} ${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 \ - -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... -echo 'Converting the OVF to signed OVA...' -private_key=${PRIVATE_KEY_PATH:-"../../key/privatekey.pem"} -if [ ! -f ${private_key} ]; then - echo 'Please put your key to "key" directory in repository root, or set PRIVATE_KEY_PATH to environment variables.' - exit 1 -fi -ovftool --privateKey=${PRIVATE_KEY_PATH} vyos_vmware_image.ovf vyos_vmware_image.ova -- cgit v1.2.3 From 826fa1a973ffdfee54691bae7a3cb6a51ecaf230 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Tue, 24 May 2016 10:00:20 +0000 Subject: add build options for clearfog --- Makefile | 10 ++ data/live-build-config/archives/vyos.list.chroot | 1 + .../hooks/14-firmware-linux-nonfree.chroot | 6 + data/package-lists/vyos-arm.list.chroot | 1 + scripts/build-clearfog-image | 158 +++++++++++++++++++++ scripts/build-config | 2 +- scripts/build-flavour | 5 + tools/armada-388-clearfog.dtb | Bin 0 -> 18814 bytes tools/u-boot-spl.kwb | Bin 0 -> 550316 bytes 9 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 data/package-lists/vyos-arm.list.chroot create mode 100755 scripts/build-clearfog-image create mode 100755 tools/armada-388-clearfog.dtb create mode 100644 tools/u-boot-spl.kwb (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2e6dd9ad..44e3c139 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,14 @@ vmware: @scripts/check-vm-build-env @scripts/build-vmware-image +.PHONY: clearfog +.ONESHELL: +clearfog: clean prepare + @set -e + @echo "It's not like I'm building this specially for you or anything!" + cd $(build_dir) + @../scripts/build-clearfog-legacy + .PHONY: clean .ONESHELL: clean: @@ -61,6 +69,8 @@ clean: rm -f config/binary config/bootstrap config/chroot config/common config/source rm -f build.log rm -f vyos-*.iso + rm -f *.img + rm -f *.xz .PHONY: purge purge: diff --git a/data/live-build-config/archives/vyos.list.chroot b/data/live-build-config/archives/vyos.list.chroot index 2b117386..664b408c 100644 --- a/data/live-build-config/archives/vyos.list.chroot +++ b/data/live-build-config/archives/vyos.list.chroot @@ -1 +1,2 @@ deb http://dev.packages.vyos.net/vyos current main +deb http://security.debian.org/ jessie/updates main diff --git a/data/live-build-config/hooks/14-firmware-linux-nonfree.chroot b/data/live-build-config/hooks/14-firmware-linux-nonfree.chroot index 3cb7dc6b..887831cc 100755 --- a/data/live-build-config/hooks/14-firmware-linux-nonfree.chroot +++ b/data/live-build-config/hooks/14-firmware-linux-nonfree.chroot @@ -2,5 +2,11 @@ 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/package-lists/vyos-arm.list.chroot b/data/package-lists/vyos-arm.list.chroot new file mode 100644 index 00000000..41fcddf8 --- /dev/null +++ b/data/package-lists/vyos-arm.list.chroot @@ -0,0 +1 @@ +grub-efi-arm diff --git a/scripts/build-clearfog-image b/scripts/build-clearfog-image new file mode 100755 index 00000000..30bc1cb4 --- /dev/null +++ b/scripts/build-clearfog-image @@ -0,0 +1,158 @@ +#!/bin/sh +# +# Copyright (C) 2016 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 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 . +# +# File: build-clearfog-image +# Purpose: +# Build VyOS image for for Solidrun clearfog. + +lb bootstrap +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 + +# get vyos build version +version=$(cat version) +dateymd=$(date +%Y%m%d) + +# create sd-card image and partition it +qemu-img create -f raw sr-a38x-cf-vyos-"$dateymd"-testing.img 1.8G +parted --script sr-a38x-cf-vyos-"$dateymd"-testing.img mklabel msdos +parted --script sr-a38x-cf-vyos-"$dateymd"-testing.img mkpart primary fat16 8192s 60 +parted --script sr-a38x-cf-vyos-"$dateymd"-testing.img mkpart primary ext2 60 1900 +parted --script sr-a38x-cf-vyos-"$dateymd"-testing.img set 1 boot on + +# mount image and create filesystems +losetup /dev/loop0 sr-a38x-cf-vyos-"$dateymd"-testing.img +partprobe /dev/loop0 +mkfs.vfat -n EFI -F 16 -I /dev/loop0p1 +mkfs.ext2 -L persistence /dev/loop0p2 + +# mount image partitions +mkdir -p /boot/efi +mount /dev/loop0p1 /boot/efi +mkdir -p /mnt +mount /dev/loop0p2 /mnt + +# setup files on image +mkdir -p /mnt/boot/grub +mkdir -p /mnt/boot/"$version"/rw +echo "/ union" > /mnt/persistence.conf +cp binary/live/filesystem.squashfs /mnt/boot/"$version"/"$version.squashfs" +cp binary/live/initrd.img-* /mnt/boot/"$version"/initrd.img +cp binary/live/vmlinuz-* /mnt/boot/"$version"/vmlinuz +cp ../tools/armada-388-clearfog.dtb /boot/efi/armada-388-clearfog.dtb + +# create boot script +cat > /boot/efi/boot.script << EOF +# load DTB +echo "Loading armada-388-clearfog.dtb" +load mmc 0:1 \$fdt_addr_r armada-388-clearfog.dtb +fdt addr \$fdt_addr_r 20000 + +# load efi +echo "Loading EFI image ..." +load mmc 0:1 \$loadaddr EFI/debian/grubarm.efi + +# Sleep a while so the MMC driver can settle down +echo "Sleeping 5 seconds ..." +sleep 5 + +# boot +echo "Booting ..." +bootefi \$loadaddr +EOF + +# compile boot script for u-boot +mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d /boot/efi/boot.script /boot/efi/boot.scr + +# create grub config file to include +cat > load.cfg << EOF +set root=(hd0,msdos2) +set prefix=(hd0,msdos2)/boot/grub +devicetree (hd0,msdos1)/armada-388-clearfog.dtb +insmod normal +normal +EOF + +# create grub menu +cat > /mnt/boot/grub/grub.cfg << EOF +set default=0 +set timeout=5 + +echo -n Press ESC to enter the Grub menu... +if sleep --verbose --interruptible 5 ; then + terminal_input console serial +fi + + +menuentry "VyOS $version (Serial console)" { + linux /boot/"$version"/vmlinuz boot=live quiet vyatta-union=/boot/"$version" console=ttyS0,115200n8 + initrd /boot/"$version"/initrd.img +} + +menuentry "Lost password change $version (Serial console)" { + linux /boot/"$version"/vmlinuz boot=live quiet vyatta-union=/boot/"$version" console=ttyS0,115200n8 init=/opt/vyatta/sbin/standalone_root_pw_reset + initrd /boot/"$version"/initrd.img +} +EOF + +# install efi grub to image +grub-install --efi-directory /boot/efi --boot-directory /mnt/boot -d /usr/lib/grub/arm-efi /dev/loop0 + +# create grub efi executable +grub-mkimage -O arm-efi -p /boot/grub -d /usr/lib/grub/arm-efi -c load.cfg \ +ext2 iso9660 linux echo configfile \ +search_label search_fs_file search \ +search_fs_uuid ls normal gzio \ +png fat gettext font minicmd \ +gfxterm gfxmenu video video_fb \ +part_msdos part_gpt > /boot/efi/EFI/debian/grubarm.efi + +# unmount image partitions +umount /mnt +umount /boot/efi + +# write u-boot to image +dd if=../tools/u-boot-spl.kwb of=/dev/loop0 bs=512 seek=1 + +# unmount image +sudo losetup -D + +# compress image +xz -v sr-a38x-cf-vyos-"$dateymd"-testing.img diff --git a/scripts/build-config b/scripts/build-config index 3b39befe..c5d1ab5f 100755 --- a/scripts/build-config +++ b/scripts/build-config @@ -46,7 +46,7 @@ def get_default_build_by(): # 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)', lambda: 'amd64', lambda x: x in ['amd64', 'i586']), + 'architecture': ('Image target architecture (amd64 or i586 or armhf)', lambda: 'amd64', lambda x: x in ['amd64', 'i586', '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), 'pbuilder-debian-mirror': ('Debian repository mirror for pbuilder env bootstrap', lambda: defaults.DEBIAN_MIRROR, None), diff --git a/scripts/build-flavour b/scripts/build-flavour index 389be980..c14f5735 100755 --- a/scripts/build-flavour +++ b/scripts/build-flavour @@ -30,3 +30,8 @@ fi if [ $BUILD_ARCH = 'amd64' -o $BUILD_ARCH = 'i686' ]; then cp data/package-lists/vyos-x86.list.chroot build/config/package-lists/ fi + +# Install grub-efi-arm if it's an arm build +if [ $BUILD_ARCH = 'armhf' -o $BUILD_ARCH = 'armel' -o $BUILD_ARCH = 'arm' ]; then + cp data/package-lists/vyos-arm.list.chroot build/config/package-lists/ +fi diff --git a/tools/armada-388-clearfog.dtb b/tools/armada-388-clearfog.dtb new file mode 100755 index 00000000..71d28b83 Binary files /dev/null and b/tools/armada-388-clearfog.dtb differ diff --git a/tools/u-boot-spl.kwb b/tools/u-boot-spl.kwb new file mode 100644 index 00000000..b7dd4c8d Binary files /dev/null and b/tools/u-boot-spl.kwb differ -- cgit v1.2.3 From 02a1ef1574a47861b57da8620bfd10d647050e23 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Tue, 24 May 2016 11:14:46 +0000 Subject: update clearfog script name add x86 specific packages to vyos-x86.list.chroot --- Makefile | 2 +- data/package-lists/vyos-x86.list.chroot | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 44e3c139..8889604d 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ clearfog: clean prepare @set -e @echo "It's not like I'm building this specially for you or anything!" cd $(build_dir) - @../scripts/build-clearfog-legacy + @../scripts/build-clearfog-image .PHONY: clean .ONESHELL: diff --git a/data/package-lists/vyos-x86.list.chroot b/data/package-lists/vyos-x86.list.chroot index c20456df..cfd318ca 100644 --- a/data/package-lists/vyos-x86.list.chroot +++ b/data/package-lists/vyos-x86.list.chroot @@ -1 +1,3 @@ +grub2 grub-pc +open-vm-tools -- cgit v1.2.3 From ae66df2b8b764df7bf2b3b6d3895358012791feb Mon Sep 17 00:00:00 2001 From: Yuya Kusakabe Date: Wed, 26 Oct 2016 14:41:26 +0900 Subject: Initial Hyper-V image --- Makefile | 7 +++++++ scripts/build-hyperv-image | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 scripts/build-hyperv-image (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8889604d..8dbb7a92 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,13 @@ vmware: @scripts/check-vm-build-env @scripts/build-vmware-image +.PHONY: hyperv +.ONESHELL: +hyperv: + @set -e + @scripts/check-vm-build-env + @scripts/build-hyperv-image + .PHONY: clearfog .ONESHELL: clearfog: clean prepare diff --git a/scripts/build-hyperv-image b/scripts/build-hyperv-image new file mode 100755 index 00000000..40c0c828 --- /dev/null +++ b/scripts/build-hyperv-image @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Copyright (C) 2016 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 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 . +# +# File: build-hyperv-image +# Purpose: +# Build VyOS image for Hyper-V. + +export PACKER_BUILD_DIR=packer_build + +DST_DIR=${PACKER_BUILD_DIR}/hyperv +mkdir -p ${DST_DIR} + +# Convert raw image to VHD +source_image=${PACKER_BUILD_DIR}/qemu/vyos_qemu_image.img +vhd=${DST_DIR}/vyos_hyperv_image.vhd +qemu-img convert -f raw ${source_image} -O vpc ${vhd} +if [ "$?" = "0" ]; then + echo "Hyper-V image successfully created to ./${vhd}" +fi -- cgit v1.2.3 From e119d44d2bc5b0fc8daa7a208199ad9448427af7 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 21 Dec 2016 22:24:54 +0100 Subject: T229: automatically import locally build .deb's from packages/ at build time. Made it a separate script, if we ever need anything fancier than cp *.deb If not, we can move it to the makefile. --- Makefile | 1 + scripts/import-local-packages | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100755 scripts/import-local-packages (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8889604d..9d9576de 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ prepare: rm -rf build/config/* @scripts/live-build-config cp -r data/live-build-config/* build/config/ + @scripts/import-local-packages @scripts/make-version-file diff --git a/scripts/import-local-packages b/scripts/import-local-packages new file mode 100755 index 00000000..be8e1688 --- /dev/null +++ b/scripts/import-local-packages @@ -0,0 +1,6 @@ +#!/bin/sh + +LOCAL_PKG_DIR=build/config/packages.chroot + +mkdir -p $LOCAL_PKG_DIR +cp packages/*.deb $LOCAL_PKG_DIR -- cgit v1.2.3 From 607dcde9bce70b17fbd24df7d441e6a1924983e9 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 26 Jan 2017 21:27:12 -0500 Subject: Account for different architectures in ISO naming. --- Makefile | 3 ++- scripts/build-qemu-image | 5 ++++- scripts/copy-image | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 scripts/copy-image (limited to 'Makefile') diff --git a/Makefile b/Makefile index 501ab041..088a3474 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,8 @@ iso: clean prepare @echo "It's not like I'm building this specially for you or anything!" cd $(build_dir) lb build 2>&1 | tee build.log - ln -nsf live-image-amd64.hybrid.iso vyos-`cat version`-`dpkg --print-architecture`.iso + cd .. + @scripts/copy-image .PHONY: prepare-package-env .ONESHELL: diff --git a/scripts/build-qemu-image b/scripts/build-qemu-image index 4a67f0f3..59a42f07 100755 --- a/scripts/build-qemu-image +++ b/scripts/build-qemu-image @@ -18,8 +18,11 @@ # Purpose: # Build VyOS raw image for qemu. +BUILD_DIR=$(scripts/query-json build/build-config.json build_dir) +BUILD_ARCH=$(scripts/query-json build/build-config.json architecture) +VERSION=$(cat $BUILD_DIR/version) -export ISO_IMAGE=./build/live-image-amd64.hybrid.iso +export ISO_IMAGE=./build/live-image-$BUILD_ARCH.hybrid.iso export ISO_MD5_SUM=$(md5sum ${ISO_IMAGE} | awk '{print $1}') export PACKER_BUILD_DIR=packer_build export PACKER_LOG_PATH=${PACKER_BUILD_DIR}/build.log diff --git a/scripts/copy-image b/scripts/copy-image new file mode 100755 index 00000000..01af511d --- /dev/null +++ b/scripts/copy-image @@ -0,0 +1,7 @@ +#!/bin/sh + +BUILD_DIR=$(scripts/query-json build/build-config.json build_dir) +BUILD_ARCH=$(scripts/query-json build/build-config.json architecture) +VERSION=$(cat $BUILD_DIR/version) + +ln -nsf $BUILD_DIR/live-image-$BUILD_ARCH.hybrid.iso $BUILD_DIR/vyos-$VERSION-$BUILD_ARCH.iso -- cgit v1.2.3 From 822747f4de0274e366452c594c1a65562740a4f1 Mon Sep 17 00:00:00 2001 From: Yuya Kusakabe Date: Sat, 29 Jul 2017 15:30:57 +0900 Subject: Add vagrant-libvirt make target --- Makefile | 7 ++++ scripts/build-vagrant-libvirt-box | 69 +++++++++++++++++++++++++++++++++++++++ scripts/packer.json | 57 +------------------------------- 3 files changed, 77 insertions(+), 56 deletions(-) create mode 100755 scripts/build-vagrant-libvirt-box (limited to 'Makefile') diff --git a/Makefile b/Makefile index 088a3474..d3c1beec 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,13 @@ qemu: @scripts/check-vm-build-env @scripts/build-qemu-image +.PHONY: vagrant-libvirt +.ONESHELL: +vagrant-libvirt: + @set -e + @scripts/check-vm-build-env + @scripts/build-vagrant-libvirt-box + .PHONY: vmware .ONESHELL: vmware: diff --git a/scripts/build-vagrant-libvirt-box b/scripts/build-vagrant-libvirt-box new file mode 100755 index 00000000..5cb0b041 --- /dev/null +++ b/scripts/build-vagrant-libvirt-box @@ -0,0 +1,69 @@ +#!/bin/sh +# +# Copyright (C) 2016 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 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 . +# +# File: build-vagrant-libvirt-box +# Purpose: +# Build VyOS Vagrant libvirt box. + +export PACKER_BUILD_DIR=packer_build + +DST_DIR=${PACKER_BUILD_DIR}/vagrant-libvirt +BOX_DIR=${DST_DIR}/box +mkdir -p ${BOX_DIR} + +# Copy qcow2 image +cp -p packer_build/qemu/vyos_qemu_image.img ${BOX_DIR}/box.img + +# Put metadata.json and Vagrantfile +echo '{"format":"qcow2","provider":"libvirt","virtual_size":4}' > ${BOX_DIR}/metadata.json +cat < ${BOX_DIR}/Vagrantfile +Vagrant.configure("2") do |config| + config.vm.synced_folder './', '/vagrant', + type: "rsync", + owner: 'vyos', + group: 'users', + mount_options: ['dmode=775,fmode=775'] + config.ssh.username = "vyos" + config.ssh.password = "vyos" + config.vm.provider :libvirt do |libvirt| + libvirt.driver = "kvm" + end +end +EOF + +# Create box +box=${DST_DIR}/vyos_vagrant_libvirt.box +tar -C ${BOX_DIR} -czvf ${box} metadata.json Vagrantfile box.img +if [ "$?" = "0" ]; then + echo "Vagrant libvirt box successfully created to ./${box}" +fi + +PROVIDER=libvirt + +# Create version +curl -XPOST -d "version[version]=${VERSION}" \ + https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/versions?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN} +echo + +# Create provider +curl -XPOST -d "provider[name]=${PROVIDER}" -d "provider[url]=${VAGRANT_BOX_BASE_URL}" \ + https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/version/${VERSION}/providers?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN} +echo + +# Release version +curl -XPUT \ + https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/version/${VERSION}/release?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN} +echo diff --git a/scripts/packer.json b/scripts/packer.json index 30bd2fb7..218b2a85 100644 --- a/scripts/packer.json +++ b/scripts/packer.json @@ -2,11 +2,7 @@ "variables": { "iso_url": "{{env `ISO_IMAGE`}}", "iso_checksum": "{{env `ISO_MD5_SUM`}}", - "output_directory": "{{env `PACKER_BUILD_DIR`}}", - "box_tag": "{{env `VAGRANT_BOX_NAME`}}", - "cloud_token": "{{env `VAGRANT_CLOUD_ACCESS_TOKEN`}}", - "version": "{{env `VERSION`}}", - "box_base_url": "{{env `BOX_BASE_URL`}}" + "output_directory": "{{env `PACKER_BUILD_DIR`}}" }, "builders": [ @@ -61,57 +57,6 @@ "save", "exit" ] - }, - { - "name": "vmware-image", - "type": "qemu", - "iso_url": "{{user `output_directory`}}/qemu/vyos_qemu_image.img", - "iso_checksum_type": "none", - "output_directory": "{{user `output_directory`}}/vmware", - "shutdown_command": "sudo halt -p", - "disk_image": true, - "disk_size": 4096, - "format": "raw", - "headless": true, - "accelerator": "tcg", - "ssh_host_port_min": 2222, - "ssh_host_port_max": 2229, - "ssh_username": "vyos", - "ssh_password": "vyos", - "ssh_port": 22, - "ssh_wait_timeout": "300s", - "vm_name": "vyos_vmware_image.img", - "net_device": "virtio-net", - "disk_interface": "virtio", - "boot_wait": "5s" - } - ], - "provisioners": [ - { - "type": "shell", - "only": ["vmware-image"], - "scripts": [ - "scripts/packer-scripts/vmware.sh" - ] } - ], - "post-processors": [ - [ - { - "type": "vagrant", - "only": ["qemu-image"], - "vagrantfile_template": "scripts/Vagrantfile", - "output": "{{user `output_directory`}}/vagrant-libvirt/vyos_vagrant_libvirt.box", - "keep_input_artifact": true - }, - { - "type": "vagrant-cloud", - "only": ["qemu-image"], - "box_tag": "{{user `box_tag`}}", - "access_token": "{{user `cloud_token`}}", - "version": "{{user `version`}}", - "box_download_url": "{{user `box_base_url`}}/vyos-{{user `version`}}-vagrant-libvirt.box" - } - ] ] } -- cgit v1.2.3 From ac391c82d1f0c8d380e31386472c5aec563d9e56 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 21 Aug 2017 18:49:34 -0400 Subject: T361: check the build environment setup in ./configure before it can even get to make. --- Makefile | 9 +++++---- scripts/build-config | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d3c1beec..8aa082ce 100644 --- a/Makefile +++ b/Makefile @@ -5,14 +5,15 @@ all: @echo "Make what specifically?" @echo "The most common target is 'iso'" +.PHONY: check_build_config +check_build_config: + @scripts/check-config + .PHONY: prepare prepare: @set -e @echo "Starting VyOS ISO image build" - @scripts/check-build-env - @scripts/check-config - rm -rf build/config/* @scripts/live-build-config cp -r data/live-build-config/* build/config/ @@ -24,7 +25,7 @@ prepare: .PHONY: iso .ONESHELL: -iso: clean prepare +iso: check_build_config clean prepare @set -e @echo "It's not like I'm building this specially for you or anything!" cd $(build_dir) diff --git a/scripts/build-config b/scripts/build-config index 9ea92e1f..ae8501e8 100755 --- a/scripts/build-config +++ b/scripts/build-config @@ -97,6 +97,11 @@ args['distribution'] = defaults.DEBIAN_DISTRIBUTION args['build_dir'] = os.path.join(os.getcwd(), defaults.BUILD_DIR) args['pbuilder_config'] = defaults.PBUILDER_CONFIG +# Check the build environment and dependencies +env_check_retval = os.system("scripts/check-build-env") +if env_check_retval > 0: + print("Build environment check failed, fix the issues and retry") + # Save to file distutils.dir_util.mkpath(defaults.BUILD_DIR) -- cgit v1.2.3 From 679747704af6b13081341163e7e32ddb9746b7b1 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 11 Jan 2018 06:51:58 +0100 Subject: T519: fix paths and operation order in the makefile for correct repo setup. --- Makefile | 3 ++- scripts/live-build-config | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8aa082ce..2eaed429 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,9 @@ prepare: @echo "Starting VyOS ISO image build" rm -rf build/config/* - @scripts/live-build-config + mkdir -p build/config cp -r data/live-build-config/* build/config/ + @scripts/live-build-config @scripts/import-local-packages @scripts/make-version-file diff --git a/scripts/live-build-config b/scripts/live-build-config index 544c67e8..4b491aeb 100755 --- a/scripts/live-build-config +++ b/scripts/live-build-config @@ -66,7 +66,7 @@ debug = build_config['debug'] print("Setting up additional APT entries") vyos_repo_entry = "deb {0} {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch']) -apt_file = os.path.join(defaults.BUILD_DIR, defaults.VYOS_REPO_FILE) +apt_file = os.path.join(build_config['build_dir'], defaults.VYOS_REPO_FILE) if debug: print("Adding these entries to {0}:".format(apt_file)) -- cgit v1.2.3