diff options
22 files changed, 174 insertions, 93 deletions
diff --git a/.gitmodules b/.gitmodules index 5e095b4d..7ec3cb00 100644 --- a/.gitmodules +++ b/.gitmodules @@ -130,3 +130,9 @@ [submodule "packages/udp-broadcast-relay"] path = packages/udp-broadcast-relay url = https://github.com/vyos/udp-broadcast-relay.git +[submodule "packages/vyos-keepalived"] + path = packages/vyos-keepalived + url = https://github.com/vyos/vyos-keepalived.git +[submodule "packages/vyatta-iproute"] + path = packages/vyatta-iproute + url = https://github.com/vyos/vyatta-iproute.git @@ -43,7 +43,16 @@ There are several directories with their own purpose: ## Prerequisites -To build a VyOS image, you need a machine that runs Debian Jessie. Other build hosts are not supported. +To build a VyOS image, you need Debian8 "Jessie" environment (with jessie-backports repository). You can create it with [debootstrap](https://wiki.debian.org/Debootstrap) on Debian, Ubuntu and many distributions. To create Debian8 "Jessie" environment under vyos-chroot directory, run below commands. + +``` +$ sudo apt install debootstrap (Note: This is on Debian/Ubuntu, adjust it with your favorite distro package manager) +$ sudo debootstrap jessie vyos-chroot +$ sudo chroot vyos-chroot + +# echo "deb http://deb.debian.org/debian jessie-backports main" >> /etc/apt/sources.list +# apt update +``` Several packages are required for building the ISO and all packages, namely python3, live-build, pbuilder, python3-pystache and devscripts. Individual packages may have other build dependencies. If some packages are missing, build scripts will tell you. diff --git a/data/live-build-config/hooks/18-enable-disable_services.chroot b/data/live-build-config/hooks/18-enable-disable_services.chroot index ea31eb1e..fe30c95f 100755 --- a/data/live-build-config/hooks/18-enable-disable_services.chroot +++ b/data/live-build-config/hooks/18-enable-disable_services.chroot @@ -21,14 +21,14 @@ systemctl disable ssh /usr/sbin/update-rc.d -f ssh remove systemctl disable openvpn /usr/sbin/update-rc.d -f openvpn remove -systemctl disable dnsmasq -/usr/sbin/update-rc.d -f dnsmasq remove systemctl disable lldpd /usr/sbin/update-rc.d -f lldpd remove systemctl enable ssh-session-cleanup -/usr/sbin/update-rc.d -f conntrackd remove systemctl disable conntrackd -/usr/sbin/update-rc.d -f mdns-repeater remove +/usr/sbin/update-rc.d -f conntrackd remove systemctl disable mdns-repeater -/usr/sbin/update-rc.d -f udp-broadcast-relay remove +/usr/sbin/update-rc.d -f mdns-repeater remove systemctl disable udp-broadcast-relay{1.99} +/usr/sbin/update-rc.d -f udp-broadcast-relay remove +systemctl disable pdns-recursor +/usr/sbin/update-rc.d -f pdns-recursor remove diff --git a/data/live-build-config/hooks/22-pam_mkhomedir.chroot b/data/live-build-config/hooks/21-pam_mkhomedir.chroot index af155ba4..af155ba4 100755 --- a/data/live-build-config/hooks/22-pam_mkhomedir.chroot +++ b/data/live-build-config/hooks/21-pam_mkhomedir.chroot diff --git a/data/live-build-config/hooks/21-systemd_conf.chroot b/data/live-build-config/hooks/21-systemd_conf.chroot deleted file mode 100755 index 541fdf11..00000000 --- a/data/live-build-config/hooks/21-systemd_conf.chroot +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -echo I: Show systemd statuson boot. - -echo "ShowStatus=yes" >> /etc/systemd/system.conf diff --git a/data/live-build-config/hooks/99-cleanup-packages.chroot b/data/live-build-config/hooks/99-cleanup-packages.chroot new file mode 100755 index 00000000..63be7df6 --- /dev/null +++ b/data/live-build-config/hooks/99-cleanup-packages.chroot @@ -0,0 +1,14 @@ +#!/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/data/live-build-config/includes.chroot/etc/rsyslog.conf b/data/live-build-config/includes.chroot/etc/rsyslog.conf deleted file mode 100644 index 9e468ed0..00000000 --- a/data/live-build-config/includes.chroot/etc/rsyslog.conf +++ /dev/null @@ -1,67 +0,0 @@ -# /etc/rsyslog.conf Configuration file for rsyslog. -# -# For more information see -# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html - - -################# -#### MODULES #### -################# - -$ModLoad imuxsock # provides support for local system logging -$ModLoad imklog # provides kernel logging support (previously done by rklogd) -#$ModLoad immark # provides --MARK-- message capability - -$OmitLocalLogging no -$SystemLogSocketName /run/systemd/journal/syslog - -$KLogPath /proc/kmsg - -# provides UDP syslog reception -#$ModLoad imudp -#$UDPServerRun 514 - -# provides TCP syslog reception -#$ModLoad imtcp -#$InputTCPServerRun 514 - - -########################### -#### GLOBAL DIRECTIVES #### -########################### - -# -# Use traditional timestamp format. -# To enable high precision timestamps, comment out the following line. -# -$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat - -# Filter duplicated messages -$RepeatedMsgReduction on - -# -# Set the default permissions for all log files. -# -$FileOwner root -$FileGroup adm -$FileCreateMode 0640 -$DirCreateMode 0755 -$Umask 0022 - -# -# Include all config files in /etc/rsyslog.d/ -# -$IncludeConfig /etc/rsyslog.d/*.conf - -############### -#### RULES #### -############### - -daemon.* /var/log/messages - -# Log authorization failure messages -#auth,authpriv.* /var/log/auth.log - -# Emergencies are sent to everybody logged in. -*.emerg :omusrmsg:* - diff --git a/data/live-build-config/includes.chroot/etc/systemd/journald.conf b/data/live-build-config/includes.chroot/etc/systemd/journald.conf index 07612424..5aecf4f8 100644 --- a/data/live-build-config/includes.chroot/etc/systemd/journald.conf +++ b/data/live-build-config/includes.chroot/etc/systemd/journald.conf @@ -1,3 +1,5 @@ +# This file is managed in vyos-build +# # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it diff --git a/data/live-build-config/includes.chroot/etc/systemd/system.conf b/data/live-build-config/includes.chroot/etc/systemd/system.conf new file mode 100644 index 00000000..91af4090 --- /dev/null +++ b/data/live-build-config/includes.chroot/etc/systemd/system.conf @@ -0,0 +1,55 @@ +# This file is managed in vyos-build +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# See systemd-system.conf(5) for details + +[Manager] +#LogLevel=info +#LogTarget=journal-or-kmsg +#LogColor=yes +#LogLocation=no +#DumpCore=yes +#CrashShell=no +ShowStatus=yes +#CrashChVT=1 +#CPUAffinity=1 2 +#JoinControllers=cpu,cpuacct net_cls,net_prio +#RuntimeWatchdogSec=0 +#ShutdownWatchdogSec=10min +#CapabilityBoundingSet= +#SystemCallArchitectures= +#TimerSlackNSec= +#DefaultTimerAccuracySec=1min +#DefaultStandardOutput=journal +#DefaultStandardError=inherit +#DefaultTimeoutStartSec=90s +#DefaultTimeoutStopSec=90s +#DefaultRestartSec=100ms +#DefaultStartLimitInterval=10s +#DefaultStartLimitBurst=5 +#DefaultEnvironment= +#DefaultCPUAccounting=no +#DefaultBlockIOAccounting=no +#DefaultMemoryAccounting=no +#DefaultLimitCPU= +#DefaultLimitFSIZE= +#DefaultLimitDATA= +#DefaultLimitSTACK= +#DefaultLimitCORE= +#DefaultLimitRSS= +#DefaultLimitNOFILE= +#DefaultLimitAS= +#DefaultLimitNPROC= +#DefaultLimitMEMLOCK= +#DefaultLimitLOCKS= +#DefaultLimitSIGPENDING= +#DefaultLimitMSGQUEUE= +#DefaultLimitNICE= +#DefaultLimitRTPRIO= +#DefaultLimitRTTIME= 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 index f5ec2b5d..0a75716b 100644 --- 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 @@ -1,4 +1,5 @@ system { + host-name vyos login { user vyos { authentication { diff --git a/data/live-build-config/package-lists/vyos-utils.list.chroot b/data/live-build-config/package-lists/vyos-utils.list.chroot index de0f6d00..44372082 100644 --- a/data/live-build-config/package-lists/vyos-utils.list.chroot +++ b/data/live-build-config/package-lists/vyos-utils.list.chroot @@ -8,9 +8,10 @@ netcat netcat6 socat telnet -tcpdump nano -vim +vim-tiny screen minicom wakeonlan +iperf +iperf3 diff --git a/data/package-lists/vyos-x86.list.chroot b/data/package-lists/vyos-x86.list.chroot index cfd318ca..300f97dd 100644 --- a/data/package-lists/vyos-x86.list.chroot +++ b/data/package-lists/vyos-x86.list.chroot @@ -1,3 +1,8 @@ grub2 grub-pc open-vm-tools +qemu-guest-agent + +mlnx-ofed-kernel-modules +iser-modules +ofed-scripts diff --git a/data/versions b/data/versions new file mode 100644 index 00000000..3d0c2871 --- /dev/null +++ b/data/versions @@ -0,0 +1,3 @@ +{ + "current": "1.2.0" +} diff --git a/packages/vyatta-iproute b/packages/vyatta-iproute new file mode 160000 +Subproject 0b78fea66ab7d8ae84da7345650965e1752e1c2 diff --git a/packages/vyos-keepalived b/packages/vyos-keepalived new file mode 160000 +Subproject dc8ade02407f836873e78887f4b3c94b6540a57 diff --git a/packages/vyos-kernel b/packages/vyos-kernel -Subproject 94c9ef1d0d549d46187f2abb3c1d6979654dc28 +Subproject 123087671203ad50989a2ff0c91d0df2dc4d32e diff --git a/scripts/build-vagrant-libvirt-box b/scripts/build-vagrant-libvirt-box index 7aff4eda..6db77c2a 100755 --- a/scripts/build-vagrant-libvirt-box +++ b/scripts/build-vagrant-libvirt-box @@ -54,16 +54,21 @@ fi PROVIDER=libvirt # Create version -curl -XPOST -d "version[version]=${VERSION}" \ +major=$(cat build/version | cut -d'+' -f2 | cut -d'-' -f1 | rev | cut -c 5- | rev) +sub=$(cat build/version | cut -d'+' -f2 | cut -d'-' -f1 | rev | cut -c 3-4 | rev) +minor=$(cat build/version | cut -d'+' -f2 | cut -d'-' -f1 | rev | cut -c 1-2 | rev) +version=$(echo "$major.$sub.$minor") +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}/vyos-${VERSION}-vagrant-${PROVIDER}.box" \ - https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/version/${VERSION}/providers?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN} +urlencoded_version=$(cat build/version | sed 's/+/%2B/') +curl -XPOST -d "provider[name]=${PROVIDER}" -d "provider[url]=${VAGRANT_BOX_BASE_URL}/vyos-${urlencoded_version}-vagrant-${PROVIDER}.box" \ + 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} + https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/version/${version}/release?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN} echo diff --git a/scripts/check-build-env b/scripts/check-build-env index 7f02c02a..7377be64 100755 --- a/scripts/check-build-env +++ b/scripts/check-build-env @@ -32,7 +32,8 @@ deps = { 'live-build', 'pbuilder', 'devscripts', - 'python3-pystache' + 'python3-pystache', + 'python3-git' ], 'binaries': [] } diff --git a/scripts/defaults.py b/scripts/defaults.py index bb6f0910..93eadc30 100644 --- a/scripts/defaults.py +++ b/scripts/defaults.py @@ -33,7 +33,7 @@ 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' +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 4c4a38ac..b1a77b4c 100755 --- a/scripts/live-build-config +++ b/scripts/live-build-config @@ -36,7 +36,7 @@ lb config noauto \ --architectures {{architecture}} \ --bootappend-live "boot=live components hostname=vyos username=live nopersistence noautologin nonetworking union=overlay" \ --linux-flavours {{architecture}}-vyos \ - --linux-packages linux-image-4.4.113 \ + --linux-packages linux-image-4.14.26 \ --bootloader syslinux \ --binary-images iso-hybrid \ --debian-installer false \ @@ -53,7 +53,8 @@ lb config noauto \ --archive-areas "main contrib non-free" \ --firmware-chroot true \ --updates true \ - --security true + --security true \ + --apt-indices false "${@}" """ @@ -64,16 +65,19 @@ debug = build_config['debug'] # Add the additional repositories to package lists print("Setting up additional APT entries") -vyos_repo_entry = "deb {0} {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch']) +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']) apt_file = os.path.join(build_config['build_dir'], defaults.VYOS_REPO_FILE) if debug: print("Adding these entries to {0}:".format(apt_file)) print("\t", vyos_repo_entry) + print("\t", vyos_debian_repo_entry) with open(apt_file, 'w') as f: f.write(vyos_repo_entry) + f.write(vyos_debian_repo_entry) # Configure live-build diff --git a/scripts/make-version-file b/scripts/make-version-file index 3bb33319..0459b8bf 100755 --- a/scripts/make-version-file +++ b/scripts/make-version-file @@ -1,6 +1,6 @@ #!/usr/bin/python3 # -# Copyright (C) 2016 VyOS maintainers and contributors +# Copyright (C) 2018 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 @@ -25,16 +25,18 @@ import datetime import json import uuid +import git + import defaults import util +# Load the build config util.check_build_config() with open(defaults.BUILD_CONFIG, 'r') as f: build_config = json.load(f) - +# Create a build timestamp now = datetime.datetime.today() - build_timestamp = now.strftime("%Y%m%d%H%M") # FIXME: use aware rather than naive object @@ -43,9 +45,23 @@ 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()) +# Create a build version if build_config['build_type'] == 'development': - version = "999.{0}".format(build_timestamp) + try: + # Load the branch to version mapping file + with open('data/versions') as f: + version_mapping = json.load(f) + + repo = git.Repo('.') + git_branch = repo.active_branch.name + branch_version = version_mapping[git_branch] + + version = "{0}-rolling+{1}".format(branch_version, build_timestamp) + except Exception as e: + print("Could not build a version string specific to git branch, falling back to default: {0}".format(str(e))) + version = "999.{0}".format(build_timestamp) else: + # Release build, use the version from ./configure arguments version = build_config['version'] version_data = { diff --git a/tools/get_latest_iso.py b/tools/get_latest_iso.py new file mode 100755 index 00000000..4a2ea9a8 --- /dev/null +++ b/tools/get_latest_iso.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +import os +import sys +from lxml import html +from urllib.parse import unquote +import requests + +BASE_URL = 'https://downloads.vyos.io/' +PAGE_URL = BASE_URL+'?dir=rolling/current/amd64' + + +def download(): + page = requests.get(PAGE_URL) + tree = html.fromstring(page.content) + path = '//*[@id="directory-listing"]/li/a[1]/@href' + isos = [x for x in tree.xpath(path) if os.path.splitext(x)[1] == '.iso'] + latest_iso_url = os.path.join(BASE_URL, isos[-1]) + filename = unquote(os.path.basename(latest_iso_url)) + print(filename) + if os.path.exists(filename): + print("{} already exists".format(filename)) + sys.exit(0) + r = requests.get(latest_iso_url) + with open(filename, 'wb') as fd: + for chunk in r.iter_content(chunk_size=128): + fd.write(chunk) + + +if __name__ == '__main__': + download() |