Merge branch 'current'

This commit is contained in:
Daniil Baturin 2018-06-23 04:37:36 +02:00
commit 9113afff3a
127 changed files with 2527 additions and 68 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
build/*
*.pyc
packer_build/*
packer_cache/*
key/*

141
.gitmodules vendored Normal file
View File

@ -0,0 +1,141 @@
[submodule "packages/vyatta-bash"]
path = packages/vyatta-bash
url = https://github.com/vyos/vyatta-bash.git
[submodule "packages/vyatta-cfg"]
path = packages/vyatta-cfg
url = https://github.com/vyos/vyatta-cfg.git
[submodule "packages/vyatta-op"]
path = packages/vyatta-op
url = https://github.com/vyos/vyatta-op.git
[submodule "packages/vyatta-cfg-system"]
path = packages/vyatta-cfg-system
url = https://github.com/vyos/vyatta-cfg-system.git
[submodule "packages/vyatta-cfg-firewall"]
path = packages/vyatta-cfg-firewall
url = https://github.com/vyos/vyatta-cfg-firewall.git
[submodule "packages/vyatta-op-firewall"]
path = packages/vyatta-op-firewall
url = https://github.com/vyos/vyatta-op-firewall.git
[submodule "packages/vyatta-cfg-vpn"]
path = packages/vyatta-cfg-vpn
url = https://github.com/vyos/vyatta-cfg-vpn.git
[submodule "packages/vyatta-op-vpn"]
path = packages/vyatta-op-vpn
url = https://github.com/vyos/vyatta-op-vpn.git
[submodule "packages/vyatta-cfg-qos"]
path = packages/vyatta-cfg-qos
url = https://github.com/vyos/vyatta-cfg-qos.git
[submodule "packages/vyatta-op-qos"]
path = packages/vyatta-op-qos
url = https://github.com/vyos/vyatta-op-qos.git
[submodule "packages/vyatta-cfg-op-pppoe"]
path = packages/vyatta-cfg-op-pppoe
url = https://github.com/vyos/vyatta-cfg-op-pppoe.git
[submodule "packages/vyatta-openvpn"]
path = packages/vyatta-openvpn
url = https://github.com/vyos/vyatta-openvpn.git
[submodule "packages/vyatta-conntrack"]
path = packages/vyatta-conntrack
url = https://github.com/vyos/vyatta-conntrack.git
[submodule "packages/vyatta-conntrack-sync"]
path = packages/vyatta-conntrack-sync
url = https://github.com/vyos/vyatta-conntrack-sync.git
[submodule "packages/vyatta-nat"]
path = packages/vyatta-nat
url = https://github.com/vyos/vyatta-nat.git
[submodule "packages/vyatta-config-mgmt"]
path = packages/vyatta-config-mgmt
url = https://github.com/vyos/vyatta-config-mgmt.git
[submodule "packages/vyatta-config-migrate"]
path = packages/vyatta-config-migrate
url = https://github.com/vyos/vyatta-config-migrate.git
[submodule "packages/vyatta-zone"]
path = packages/vyatta-zone
url = https://github.com/vyos/vyatta-zone.git
[submodule "packages/vyatta-cluster"]
path = packages/vyatta-cluster
url = https://github.com/vyos/vyatta-cluster.git
[submodule "packages/vyatta-vrrp"]
path = packages/vyatta-vrrp
url = https://github.com/vyos/vyatta-vrrp.git
[submodule "packages/vyatta-eventwatch"]
path = packages/vyatta-eventwatch
url = https://github.com/vyos/vyatta-eventwatch.git
[submodule "packages/vyatta-webproxy"]
path = packages/vyatta-webproxy
url = https://github.com/vyos/vyatta-webproxy.git
[submodule "packages/vyatta-webgui"]
path = packages/vyatta-webgui
url = https://github.com/vyos/vyatta-webgui.git
[submodule "packages/vyatta-cfg-quagga"]
path = packages/vyatta-cfg-quagga
url = https://github.com/vyos/vyatta-cfg-quagga.git
[submodule "packages/vyatta-op-quagga"]
path = packages/vyatta-op-quagga
url = https://github.com/vyos/vyatta-op-quagga.git
[submodule "packages/vyatta-cfg-dhcp-server"]
path = packages/vyatta-cfg-dhcp-server
url = https://github.com/vyos/vyatta-cfg-dhcp-server.git
[submodule "packages/vyatta-cfg-dhcp-relay"]
path = packages/vyatta-cfg-dhcp-relay
url = https://github.com/vyos/vyatta-cfg-dhcp-relay.git
[submodule "packages/vyatta-op-dhcp-server"]
path = packages/vyatta-op-dhcp-server
url = https://github.com/vyos/vyatta-op-dhcp-server.git
[submodule "packages/vyatta-wireless"]
path = packages/vyatta-wireless
url = https://github.com/vyos/vyatta-wireless.git
[submodule "packages/vyatta-wirelessmodem"]
path = packages/vyatta-wirelessmodem
url = https://github.com/vyos/vyatta-wirelessmodem.git
[submodule "packages/vyatta-wanloadbalance"]
path = packages/vyatta-wanloadbalance
url = https://github.com/vyos/vyatta-wanloadbalance.git
[submodule "packages/vyatta-netflow"]
path = packages/vyatta-netflow
url = https://github.com/vyos/vyatta-netflow.git
[submodule "packages/vyatta-lldp"]
path = packages/vyatta-lldp
url = https://github.com/vyos/vyatta-lldp.git
[submodule "packages/vyatta-ipv6-rtradv"]
path = packages/vyatta-ipv6-rtradv
url = https://github.com/vyos/vyatta-ipv6-rtradv.git
[submodule "packages/vyatta-ravpn"]
path = packages/vyatta-ravpn
url = https://github.com/vyos/vyatta-ravpn.git
[submodule "packages/vyos-pppoe-server"]
path = packages/vyos-pppoe-server
url = https://github.com/vyos/vyos-pppoe-server.git
[submodule "packages/vyos-nhrp"]
path = packages/vyos-nhrp
url = https://github.com/vyos/vyos-nhrp.git
[submodule "packages/vyos-igmpproxy"]
path = packages/vyos-igmpproxy
url = https://github.com/vyos/vyos-igmpproxy.git
[submodule "packages/vyatta-util"]
path = packages/vyatta-util
url = https://github.com/vyos/vyatta-util.git
[submodule "packages/vyos-world"]
path = packages/vyos-world
url = https://github.com/vyos/vyos-world.git
[submodule "packages/vyos-kernel"]
path = packages/vyos-kernel
url = https://github.com/vyos/vyos-kernel.git
[submodule "packages/vyos-1x"]
path = packages/vyos-1x
url = https://github.com/vyos/vyos-1x.git
[submodule "packages/mdns-repeater"]
path = packages/mdns-repeater
url = https://github.com/vyos/mdns-repeater.git
[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
[submodule "packages/vyatta-quagga"]
path = packages/vyatta-quagga
url = https://github.com/vyos/vyatta-quagga.git

33
Dockerfile Normal file
View File

@ -0,0 +1,33 @@
# Must be run with --privileged flag
# Recommended to run the container with a volume mapped
# in order to easy exprort images built to "external" world
FROM debian:jessie
RUN apt-get update &&\
apt-get install -y \
vim \
git \
make \
live-build \
pbuilder \
devscripts \
python3-pystache \
squashfs-tools \
autoconf \
dpkg-dev \
syslinux \
genisoimage \
lsb-release \
fakechroot \
kernel-package \
libtool \
libglib2.0-dev \
libboost-filesystem-dev \
libapt-pkg-dev \
flex \
bison \
libperl-dev \
libnfnetlink-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR ~

View File

@ -5,33 +5,90 @@ all:
@echo "Make what specifically?"
@echo "The most common target is 'iso'"
.PHONY: prepare
prepare:
@echo "Starting VyOS ISO image build"
@scripts/check-build-env
.PHONY: check_build_config
check_build_config:
@scripts/check-config
.PHONY: prepare
prepare:
@set -e
@echo "Starting VyOS ISO image build"
rm -rf build/config/*
mkdir -p build/config
cp -r data/live-build-config/* build/config/
@scripts/live-build-config
cp -r data/includes.chroot/* build/config/includes.chroot/
cp -r data/package-lists/common/* build/config/package-lists/
@scripts/import-local-packages
@scripts/make-version-file
@scripts/build-flavour
.PHONY: iso
.ONESHELL:
iso: 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)
lb build 2>&1 | tee build.log
@echo "VyOS ISO build successful"
cd ..
@scripts/copy-image
.PHONY: prepare-package-env
.ONESHELL:
prepare-package-env:
@set -e
@scripts/pbuilder-config
@scripts/pbuilder-setup
.PHONY: qemu
.ONESHELL:
qemu:
@set -e
@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:
@set -e
@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
@set -e
@echo "It's not like I'm building this specially for you or anything!"
cd $(build_dir)
@../scripts/build-clearfog-image
.PHONY: clean
.ONESHELL:
clean:
@set -e
cd $(build_dir)
lb 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:

125
README.md
View File

@ -1,18 +1,22 @@
VyOS toplevel build
===================
# WARNING
# Important!
This repository is for building the VyOS version 1.2.0 and above.
For VyOS 1.1.x, use the build-iso repository.
This is repository is for the ongoing work on porting VyOS to Debian Jessie. It is not yet ready to use.
For building stable release images, refer to the vyos/build-iso repository.
# What is VyOS
VyOS is an open source operating system for network devices (routers, firewalls and so on).
If you want to use it in your network, check out download and installation instructions at http://vyos.net
If you want to use it in your network, check out download and installation instructions at https://vyos.io
If you want to modify VyOS and/or join its development, read on.
VyOS is not new. It is a fork of Vyatta Core that was created when the open source version of it was
discontinued. If you are a Vyatta Core user, you can upgrade your installation to VyOS.
# What is this repository?
VyOS is a GNU/Linux distribution based on Debian. Just like any other distribution, it consists of multiple
@ -39,17 +43,120 @@ 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 Debian 8 "Jessie" environment (with jessie-backports repository). You can create it with [debootstrap](https://wiki.debian.org/Debootstrap) on Debian, Ubuntu and many other distributions. To create a Debian 8 "Jessie" environment under vyos-chroot directory, run these commands:
Several packages are required for building the ISO and all packages, namely live-build, pbuilder, and dev-scripts.
Individual packages may have other build dependencies. If some packages are missing, build scripts will tell you.
```
$ sudo apt-get install debootstrap # (Note: This is on Debian/Ubuntu, adjust it for 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-get update
```
Several packages are required for building the ISO: python3, live-build, pbuilder, python3-pystache. The ./configure script
will warn you if any dependencies are missing.
Individual packages may have other build dependencies. If some dependencies are missing, package build scripts will tell you.
## Building the ISO image inside a docker container
Using Dockerfile you can create your own docker container that can be used to build a VyOS ISO image.
The Dockerfile contains some of the most used packages needed for a VyOS build ISO process.
```
squashfs-tools # Required for squashfs file system
git # Required, for cloning the source
autoconf # Required, for generating build scripts
dpkg-dev # Required, used in build scripts
live-helper # Required, for ISO build
syslinux # Required, for ISO build
genisoimage # Required, for ISO build
make # Required, for ISO build
lsb-release # Required, used by configure script
fakechroot # Required, for ISO build
devscripts # Optional, for building submodules (kernel etc)
kernel-package # Optional, for building the kernel
libtool # Optional, for building certain packages (eg vyatta-op-vpn)
libglib2.0-dev # Optional, for building vyatta-cfg
libboost-filesystem-dev # Optional, for building vyatta-cfg
libapt-pkg-dev # Optional, for building vyatta-cfg
flex # Optional, for building vyatta-cfg
bison # Optional, for building vyatta-cfg
libperl-dev # Optional, for building vyatta-cfg
libnfnetlink-dev # Optional, for building vyatta-cfg-vpn
vim # Optional, vim, vi, nano or other text editor
```
To build the docker image:
```
docker build -t vyos-builder $PATH_TO_Dockerfile
```
To run the docker image:
```
docker run --privileged -v /HOST_PATH/images:/vyos --name=vyos_node_builder -d vyos-builder bash
```
* docker container must be run with --privileged flag
* is recommended to run the container with a volume mapped in order to easy export built VyOS ISO images
to the "external" world
To connect to the docker image once is running:
```
docker exec -it vyos_node_builder bash
```
After the docker container is running you can git clone the vyos-build repository inside the container
and follow up the bellow instructions in order to build the VyOS ISO image
## Building the ISO image
Before you can build an image, you need to configure your build.
To build an image, use the following commands:
./configure
make iso
```
./configure
make iso
```
The ./configure script has a number of options that you can see by calling it with --help
## Building the images for virtualization platforms
* QEMU
Run following command after building the ISO image.
```
make qemu
```
* VMware
Run following command after building the QEMU image.
```
make vmware
```
# Development process
## git branches
The default branch that contains the most recent VyOS code is called 'current' rather than 'master'.
We know if'ts confusing, but it's not easy to fix.
In a nutshell, the code we inherited from Vyatta Core had its master branch so out of sync with everything
it was beyong any repair. Vyatta developers used to create a new branch not when a release is ready for
code freeze, but rather before starting to work on a new release.
This is hard to change in existing code, so this is just the way it is, for now.
All new code goes to the 'current' branch. When it's time for a code freeze, a new branch is created
for the release, and new code from 'current' is backported to the release branch as needed.
In packages that originate from VyOS the master branch is kept in sync with "current", but we still use
"current" as default branch for uniformity. When the last legacy package is gone, we will switch to using
the master branch and retire "current".
For branch naming we use chemical elements (hydrogen, helium, ...).

View File

@ -1 +0,0 @@
user_allow_other

View File

@ -0,0 +1,32 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)
mQENBFOQPGwBCADjm8Oq3kaJQh0rI33XVfd9mNq5ffay884SlDCbG1hkLVf8tnGV
cjH7/nFfJdW/6Gr4dj4LQuHHnin5QeWnlHfuOySlOEsJCNP5dm14oEjy7epSXOv2
A3m2tPDDqwMgfrOyw1gN+Clit9QIujiRzbcakqearyNxcVNvinIVunNiWbAyIhvc
uI6yfMjno4q/O83c7e1zBqJj9t9guQjBuqaJrmZVf985/6ue9yWzSI4JtzxVmhKI
dfCxHWE7BiEt2hnZPSVGcb4q6cBrkpcra7Ny55eoyN51wQGokPv3a9/8b3r5speR
gene2MTvD/3eZOtTvMN000f/gJX4E6o8xx+fABEBAAG0R1Z5T1MgTWFpbnRhaW5l
cnMgKERldmVsb3BtZW50IGFuZCB0ZXN0aW5nIHJlcG9zKSA8bWFpbnRhaW5lcnNA
dnlvcy5uZXQ+iQE4BBMBAgAiBQJTkDxsAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIe
AQIXgAAKCRAywkm9DfBLXJbHB/4xlwn+6cZGEWWNZgXwUTMeHubZItl1o3Tbrzaa
E3EqYyHJMYb3gBLOomlw7JLw5qT/247tlPC8ricl+BpeE5vYA3a08mIpcymROFh6
pKJLNvdZHjrVN9yH2xYifI5sIDyuPga8Bgq/BMRiB1ragS/on2aUs75+tsEI32NI
JO8+jIav0Nd6n/Wmw55ioTXS3fx6VDb64D80luOf1ve5LFDs8Oz2I+ZjSf7mPMY/
b9qQHNb/300k/tIeK2F4G7LFu6o/1YMlrv0Ry7j9BsLzIkmTh0pX4mSVvF6IrxsZ
WJRKu3uQDH2qccjptZDq4jHo/ow+aWT8rakjOgL9nJgKD5u/uQENBFOQPGwBCAC0
zHpsmcfUIDyflGL+vwHV/3L02/vItHXfIkugL+wFB9C9i6nWA1KqNJwqNflJLGQF
y+vHXs0oa3oMKj7S3p2zTbuU8s9Vz2Cg5c15sy7yGjh/LTwVOR5ZJrgbRJxTTp9K
j5bkrx/DbDjIQ5szyjZ5N1ZAUyUx5Z/xMB3mTnLxDASvaoq+/F6WNcYY7NzjI7M0
SFtnZLj6MFUVTmSbyYdGQc/Cxu5Utl7WKJUqHW5z10vJruZsdKV2+vf98yqhAJ+v
wPhKUoVD+KtCH/CrHFrVq0hCKIMtyPLtaTeR/QnCNDEsV4p82HB9KQOYEADEL3/A
a7Dntf3Xi+5eO/3MlnshABEBAAGJAR8EGAECAAkFAlOQPGwCGwwACgkQMsJJvQ3w
S1z+wwf9GnVn9GhbB1FhKQdavljp9rUzz8FvH3tRpftdhhJ8B0PVAMl4QRcIXrgD
nyd1K9ggzyWa4Z/9PygvH0Njv4YWlZh900wei9uVD8am1ncgQ/Jqlb36WvXyr8W/
VPzQDtKAOkUz6RhKQ4V6I0PBK9nGeqeFkeH1bF1uGXkKpa0hGWffyOT1VasaZVXT
UN4VAYNzBwkoU0mIYK73CPi7e4YJrtOp/i8MGDL3pxKaZEEZJdc4/dZassqBuwSG
MRr2kecj9f53KWI0jLQdLgTMJQxscotfzhsWoF/842sUCbezwV3/4FtBhlNeqUHA
c9HOeh3wbjjt4uONvxeleE+jM9v63Q==
=gflA
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -0,0 +1,4 @@
#!/bin/sh
echo I: Backwards compat packages.txt
echo "ii vyatta-version " > binary/live/packages.txt

View File

@ -0,0 +1,22 @@
#!/bin/sh
# create the buildid file
etcdir=/opt/vyatta/etc
[ -d $etcdir ] || mkdir -p -m 0755 $etcdir
rm -f $etcdir/build.txt $etcdir/iso-build.txt $etc/iso-submodules.txt
## NOTE: on live image build, these files are in the chroot/root
## however, during install, these are in /cdrom
for f in iso-build.txt iso-submodules.txt ; do
if [ -f /cdrom/$f ] ; then
cp /cdrom/$f $etcdir
elif [ -f /$f ] ; then
cp /$f $etcdir
else
>$etcdir/$f
fi
done
# backwards compatible symlink
ln -s iso-build.txt $etcdir/build.txt

View File

@ -0,0 +1,12 @@
#!/bin/sh
if ! grep '^auto lo' /etc/network/interfaces &> /dev/null ; then
mkdir -p -m 0755 /etc/network
cat >> /etc/network/interfaces <<-EOF
# The loopback network interface
auto lo
iface lo inet loopback
EOF
fi

View File

@ -0,0 +1,10 @@
#!/bin/sh
echo I: Rewriting /etc/issue and /etc/issue.net
cat <<EOF > etc/issue
Welcome to VyOS - \n \l
EOF
cat <<EOF > etc/issue.net
Welcome to VyOS
EOF

View File

@ -0,0 +1,10 @@
#!/bin/sh
grep -q '\(^[^#]*\)\(\.\|source\) /etc/bash_completion' root/.bashrc || \
cat <<-EOF >> root/.bashrc
source /etc/bash_completion
EOF
sed -i 's/set $BASH_COMPLETION_ORIGINAL_V_VALUE/builtin set $BASH_COMPLETION_ORIGINAL_V_VALUE/g' /usr/share/bash-completion/bash_completion

View File

@ -0,0 +1,9 @@
#!/bin/sh
echo I: Set default locale
cat <<EOF >etc/default/locale
LANG=en_US.UTF-8
LC_ALL=C
EOF
sed -i 's/AcceptEnv LANG LC_\*/# AcceptEnv LANG LC_\*/g' /etc/ssh/sshd_config

View File

@ -0,0 +1,34 @@
#!/bin/sh
if [ -r etc/event.d/tty1 ] ; then
echo I: Delay getty until rcX completes
sed -i 's/start on runlevel /start on stopped rc/' \
etc/event.d/tty[1-6]
if [ ! -r etc/event.d/ttyS0 ] && [ -c dev/ttyS0 ] ; then
echo I: Enable serial console login
cat <<-EOF > etc/event.d/ttyS0
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on stopped rc2
start on stopped rc3
start on stopped rc4
start on stopped rc5
stop on runlevel 0
stop on runlevel 1
stop on runlevel 6
respawn
exec /sbin/getty 9600 ttyS0 vt100
EOF
fi
fi
if [ -r etc/inittab ] && [ -c dev/ttyS0 ] && grep -q '^#T0:.*getty.*ttyS0' etc/inittab ; then
echo I: Enable serial console login
sed -i '/^#T0:/s|^#.*$|T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100|' etc/inittab
fi

View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ -e /cdrom/vyatta-pubkey.gpg ] ; then
apt-key add /cdrom/vyatta-pubkey.gpg
elif [ -e /vyatta-pubkey.gpg ] ; then
apt-key add /vyatta-pubkey.gpg
rm -f /vyatta-pubkey.gpg
fi

View File

@ -0,0 +1,47 @@
#!/bin/sh
for conf in motd.tail syslog.conf; do
cp -f /opt/vyatta/etc/$conf /etc/$conf
done
cp -f /opt/vyatta/etc/default_ssh /etc/default/ssh
>/etc/pam_radius_auth.conf
update_sysctl_conf ()
{
var=$1
val=$2
comment=$3
sysctl_conf=/etc/sysctl.conf
if grep -q "^${var}[[:space:]]*=" $sysctl_conf ; then
sed -i "/^${var}[[:space:]]*=/ s,=.*,= ${val}," $sysctl_conf
elif grep -q "^#[[:space:]]*${var}[[:space:]]*=" $sysctl_conf ; then
sed -i "/^#[[:space:]]*${var}[[:space:]]*=/ { s,^#[[:space:]]*,, ; s,[[:space:]]*=.*, = ${val},} " $sysctl_conf
else
cat <<-EOF >> $sysctl_conf
# $comment
$var = $val
EOF
fi
}
update_sysctl_conf kernel.printk "4 4 1 7" \
"the following stops low-level messages on console"
update_sysctl_conf net.ipv4.conf.default.arp_filter 1 \
"reset promiscous arp response"
update_sysctl_conf net.ipv4.conf.all.promote_secondaries 1 \
"promote secondaries with removal of primary address"
update_sysctl_conf net.ipv4.ip_forward 1 \
"enable ipv4 forwarding"
# FIXME! need to load or staticly link ipv6 module before adding this.
# update_sysctl_conf net.ipv6.conf.all.forwarding 1 \
# "enable ipv6 forwarding"
update_sysctl_conf net.core.rmem_max 223232 \
"maximize netlink buffers"
# Local Variables:
# mode: shell-script
# sh-indentation: 4
# End:

View File

@ -0,0 +1,11 @@
#!/bin/sh
# hack live script that tries to mount ext[23] floppies as root
# remove user settings live config scripts
sed -e '/ln -s "${devname}"/,/return 0/ s/^/: FIXME/' \
-i /usr/share/initramfs-tools/scripts/live
rm -rf /lib/live/config/0030-live-debconfig_passwd
rm -rf /lib/live/config/0030-user-setup
rm -rf /lib/live/config/0040-sudo

View File

@ -0,0 +1,12 @@
#!/bin/sh
# hack umountfs script to cleanly unmount live systems
sed \
-e '/proc|procfs|linprocfs/ s/)/|squashfs|iso9660)/' \
-e '/tmpfs)/ a\
[ "$MTPT" != "/media" ] && \
[ "$MTPT" != "/live" ] && \
[ "$MTPT" != "/live/cow" ] &&
' \
-i /etc/init.d/umountfs

View File

@ -0,0 +1,183 @@
#!/bin/sh
# create busybox alternatives
bb=`which busybox`
applets=$(busybox | sed '1,/^Currently defined functions:/d; s/[\[,]//g; s/ / /g; s/$/ /g')
bb_alternative ()
{
full=$1
full_bb=${full}.bb
app=${full##*/}
if [ ! -x $full ] && (echo -n "$applets" | grep -q " $app "); then
ln -s $bb $full_bb
update-alternatives --install $full $app $full_bb 10
fi
}
bb_alternative /bin/bunzip2
bb_alternative /bin/bzcat
bb_alternative /bin/cat
bb_alternative /bin/chgrp
bb_alternative /bin/chmod
bb_alternative /bin/chown
bb_alternative /bin/cp
bb_alternative /bin/cpio
bb_alternative /bin/date
bb_alternative /bin/dd
bb_alternative /bin/df
bb_alternative /bin/dmesg
bb_alternative /bin/echo
bb_alternative /bin/egrep
bb_alternative /bin/false
bb_alternative /bin/fgrep
bb_alternative /bin/grep
bb_alternative /bin/gunzip
bb_alternative /bin/gzip
bb_alternative /bin/hostname
bb_alternative /bin/ip
bb_alternative /bin/kill
bb_alternative /bin/ln
bb_alternative /bin/login
bb_alternative /bin/ls
bb_alternative /bin/mkdir
bb_alternative /bin/mknod
bb_alternative /bin/mktemp
bb_alternative /bin/more
bb_alternative /bin/mount
bb_alternative /bin/mt
bb_alternative /bin/mv
bb_alternative /bin/nc
bb_alternative /bin/netstat
bb_alternative /bin/pidof
bb_alternative /bin/ping
bb_alternative /bin/ping6
bb_alternative /bin/ps
bb_alternative /bin/pwd
bb_alternative /bin/readlink
bb_alternative /bin/rm
bb_alternative /bin/rmdir
bb_alternative /bin/run-parts
bb_alternative /bin/sed
bb_alternative /bin/sh
bb_alternative /bin/sleep
bb_alternative /bin/stty
bb_alternative /bin/sync
bb_alternative /bin/tar
bb_alternative /bin/touch
bb_alternative /bin/true
bb_alternative /bin/umount
bb_alternative /bin/uname
bb_alternative /bin/uncompress
bb_alternative /bin/which
bb_alternative /bin/zcat
bb_alternative /sbin/ifconfig
bb_alternative /sbin/ip
bb_alternative /sbin/iptunnel
bb_alternative /sbin/klogd
bb_alternative /sbin/losetup
bb_alternative /sbin/nameif
bb_alternative /sbin/route
bb_alternative /sbin/start-stop-daemon
bb_alternative /sbin/swapoff
bb_alternative /sbin/swapon
bb_alternative /sbin/syslogd
bb_alternative /usr/bin/adjtimex
bb_alternative /usr/bin/ar
bb_alternative /usr/bin/arping
bb_alternative /usr/bin/awk
bb_alternative /usr/bin/basename
bb_alternative /usr/bin/cal
bb_alternative /usr/bin/chvt
bb_alternative /usr/bin/clear
bb_alternative /usr/bin/cmp
bb_alternative /usr/bin/cut
bb_alternative /usr/bin/dc
bb_alternative /usr/bin/deallocvt
bb_alternative /usr/bin/dirname
bb_alternative /usr/bin/dos2unix
bb_alternative /usr/bin/dumpkmap
bb_alternative /usr/bin/du
bb_alternative /usr/bin/env
bb_alternative /usr/bin/expr
bb_alternative /usr/bin/find
bb_alternative /usr/bin/fold
bb_alternative /usr/bin/free
bb_alternative /usr/bin/ftpget
bb_alternative /usr/bin/ftpput
bb_alternative /usr/bin/getopt
bb_alternative /usr/bin/head
bb_alternative /usr/bin/hexdump
bb_alternative /usr/bin/hostid
bb_alternative /usr/bin/id
bb_alternative /usr/bin/ipaddr
bb_alternative /usr/bin/ipcalc
bb_alternative /usr/bin/iplink
bb_alternative /usr/bin/iproute
bb_alternative /usr/bin/killall
bb_alternative /usr/bin/last
bb_alternative /usr/bin/loadfont
bb_alternative /usr/bin/loadkmap
bb_alternative /usr/bin/logger
bb_alternative /usr/bin/logname
bb_alternative /usr/bin/logread
bb_alternative /usr/bin/md5sum
bb_alternative /usr/bin/mkfifo
bb_alternative /usr/bin/nslookup
bb_alternative /usr/bin/od
bb_alternative /usr/bin/openvt
bb_alternative /usr/bin/patch
bb_alternative /usr/bin/printf
bb_alternative /usr/bin/rdate
bb_alternative /usr/bin/realpath
bb_alternative /usr/bin/rpm
bb_alternative /usr/bin/rpm2cpio
bb_alternative /usr/bin/renice
bb_alternative /usr/bin/reset
bb_alternative /usr/bin/setkeycodes
bb_alternative /usr/bin/sha1sum
bb_alternative /usr/bin/sort
bb_alternative /usr/bin/strings
bb_alternative /usr/bin/tail
bb_alternative /usr/bin/tee
bb_alternative /usr/bin/test
bb_alternative /usr/bin/tftp
bb_alternative /usr/bin/time
bb_alternative /usr/bin/top
bb_alternative /usr/bin/touch
bb_alternative /usr/bin/tr
bb_alternative /usr/bin/traceroute
bb_alternative /usr/bin/tty
bb_alternative /usr/bin/uniq
bb_alternative /usr/bin/unix2dos
bb_alternative /usr/bin/unzip
bb_alternative /usr/bin/uptime
bb_alternative /usr/bin/usleep
bb_alternative /usr/bin/uudecode
bb_alternative /usr/bin/uuencode
bb_alternative /usr/bin/vi
bb_alternative /usr/bin/watch
bb_alternative /usr/bin/wc
bb_alternative /usr/bin/wget
bb_alternative /usr/bin/which
bb_alternative /usr/bin/who
bb_alternative /usr/bin/whoami
bb_alternative /usr/bin/xargs
bb_alternative /usr/bin/yes
bb_alternative /usr/sbin/chroot
bb_alternative /usr/sbin/dumpleases
bb_alternative /usr/sbin/httpd
bb_alternative /usr/sbin/telnetd
bb_alternative /usr/sbin/traceroute
bb_alternative /usr/sbin/udhcpc
bb_alternative /usr/sbin/udhcpd
bb_alternative /usr/sbin/watchdog
# Local Variables:
# mode: shell-script
# sh-indentation: 4
# End:

View File

@ -0,0 +1,9 @@
#!/bin/sh
# this was a "local patch" but patch generates a .orig file if it doesn't
# apply cleanly, which is not good when all files in the hook directory are
# executed. just use sed to hack the udev hook here.
sed -i 's/^\(mount -n -o move \/dev .*\/dev\)$/\1 2>\/dev\/null/' \
/usr/share/initramfs-tools/scripts/init-bottom/udev

View File

@ -0,0 +1,3 @@
#!/bin/sh
apt-get -y install vyos-replace

View File

@ -0,0 +1,12 @@
#!/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

View File

@ -0,0 +1,4 @@
#!/bin/sh
rm -f /etc/apt/sources.list.d/*.list >/dev/null 2>&1 || true

View File

@ -0,0 +1,4 @@
#!/bin/sh
sed -i 's/#user_allow_other/user_allow_other/g' /etc/fuse.conf
chmod a+r /etc/fuse.conf

View File

@ -0,0 +1,4 @@
#!/bin/sh
echo I: Create initramfs if it does not exist.
update-initramfs -c -k `ls /boot | grep vmlinuz- | sed 's/vmlinuz-//g'`

View File

@ -0,0 +1,34 @@
#!/bin/sh
echo I: Enabling/Disabling services.
systemctl disable exim4
/usr/sbin/update-rc.d -f exim4 remove
systemctl disable isc-dhcp-server
/usr/sbin/update-rc.d -f isc-dhcp-server remove
systemctl disable isc-dhcp-relay
/usr/sbin/update-rc.d -f isc-dhcp-relay remove
systemctl disable nfacctd
/usr/sbin/update-rc.d -f nfacctd remove
systemctl disable pmacctd
/usr/sbin/update-rc.d -f pmacctd remove
systemctl disable sfacctd
/usr/sbin/update-rc.d -f sfacctd remove
systemctl disable uacctd
/usr/sbin/update-rc.d -f uacctd remove
systemctl disable lighttpd
/usr/sbin/update-rc.d -f lighttpd remove
systemctl disable ssh
/usr/sbin/update-rc.d -f ssh remove
systemctl disable openvpn
/usr/sbin/update-rc.d -f openvpn remove
systemctl disable lldpd
/usr/sbin/update-rc.d -f lldpd remove
systemctl enable ssh-session-cleanup
systemctl disable conntrackd
/usr/sbin/update-rc.d -f conntrackd remove
systemctl disable mdns-repeater
/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

View File

@ -0,0 +1,6 @@
#!/bin/sh
echo I: Creating kernel symlinks.
cd /boot
ln -s initrd.img-* initrd.img
ln -s vmlinuz-* vmlinuz

View File

@ -0,0 +1,3 @@
#!/bin/sh
rm -f /etc/dhcp/dhclient-exit-hooks.d/ddclient

View File

@ -0,0 +1,16 @@
#!/bin/sh
echo I: Create home directory on login.
cat > /usr/share/pam-configs/mkhomedir <<EOF
Name: Create home directory during login
Default: yes
Priority: 900
Session-Type: Additional
Session:
required pam_mkhomedir.so umask=0022 skel=/etc/skel
EOF
sync
sed -i '/mkhomedir/d' /var/lib/pam/seen
pam-auth-update --package

View File

@ -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

View File

@ -0,0 +1,11 @@
include menu.cfg
default vesamenu.c32
prompt 0
# Ignore the Shift/Alt/Caps Lock/Scroll Lock escape
noescape 1
# Wait 10 seconds unless the user types something, but
# always boot after 5 minutes.
timeout 100
totaltimeout 3000

View File

@ -0,0 +1,8 @@
menu hshift 0
menu width 82
menu title VyOS - Boot Menu
include stdmenu.cfg
include live.cfg
menu clear

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

View File

@ -0,0 +1,43 @@
# 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.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See journald.conf(5) for details.
[Journal]
#Storage=persistent
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=1000
#SystemMaxUse=
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
#MaxRetentionSec=
#MaxFileSec=1month
ForwardToSyslog=yes
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg

View File

@ -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=

View File

@ -0,0 +1,2 @@
[Unit]
After=vyatta-router.service

View File

@ -0,0 +1,2 @@
[Service]
TTYVTDisallocate=no

View File

@ -0,0 +1,13 @@
[Unit]
Description=OpenBSD Secure Shell session cleanup
Wants=network.target
After=network.target
[Service]
ExecStart=/bin/true
ExecStop=/usr/lib/openssh/ssh-session-cleanup
RemainAfterExit=yes
Type=oneshot
[Install]
WantedBy=multi-user.target

View File

@ -1,4 +1,5 @@
system {
host-name vyos
login {
user vyos {
authentication {

View File

@ -0,0 +1,20 @@
menuentry "VyOS (KVM console)" {
linux /boot//vmlinuz boot=live quiet vyos-union=/boot/ console=ttyS0,9600 console=tty0
initrd /boot//initrd.img
}
menuentry "VyOS (Serial console)" {
linux /boot//vmlinuz boot=live quiet vyos-union=/boot/ console=tty0 console=ttyS0,9600
initrd /boot//initrd.img
}
menuentry "Lost password change (KVM console)" {
linux /boot//vmlinuz boot=live quiet vyos-union=/boot/ console=ttyS0,9600 console=tty0 init=/opt/vyatta/sbin/standalone_root_pw_reset
initrd /boot//initrd.img
}
menuentry "Lost password change (Serial console)" {
linux /boot//vmlinuz boot=live quiet vyos-union=/boot/ console=tty0 console=ttyS0,9600 init=/opt/vyatta/sbin/standalone_root_pw_reset
initrd /boot//initrd.img
}

View File

@ -0,0 +1,17 @@
#!/bin/bash
source /opt/vyatta/sbin/install-functions
NEWVER=`mount | grep /mnt/inst_root`
NEWVER=${NEWVER#*upperdir=/live/image/boot/}
NEWVER=${NEWVER%/live-rw*}
DISK_LABEL=`mount | grep /live/image | awk '{print $1}' | grep dev`
if [ -d "/live/image" ]; then
e2label "${DISK_LABEL}" persistence
if [ ! -f /live/image/persistence.conf ]; then
echo "/ union" > /live/image/persistence.conf
fi
rm -f /live/image/boot/"${NEWVER}"/live-rw/etc/fstab
mv /live/image/boot/"${NEWVER}"/live-rw /live/image/boot/"${NEWVER}"/rw
fi

View File

@ -0,0 +1,11 @@
#! /bin/sh
ssh_session_pattern='sshd: \S.*@pts/[0-9]+'
IFS="$IFS@"
pgrep -a -f "$ssh_session_pattern" | while read pid daemon user pty; do
echo "Found ${daemon%:} session $pid on $pty; sending SIGTERM"
kill "$pid" || true
done
exit 0

View File

@ -0,0 +1,21 @@
nmap
dnsutils
ipcalc
sipcalc
mtr-tiny
whois
netcat
netcat6
socat
telnet
nano
vim-tiny
screen
minicom
wakeonlan
iperf
iperf3
iftop
lsof
openssh-client
nmap

View File

@ -1,10 +0,0 @@
nmap
dnsutils
sipcalc
mtr-tiny
whois
netcat
netcat6
socat
telnet
tcpdump

View File

@ -0,0 +1 @@
grub-efi-arm

View File

@ -0,0 +1,2 @@
gdb
strace

View File

@ -0,0 +1,8 @@
grub2
grub-pc
open-vm-tools
qemu-guest-agent
mlnx-ofed-kernel-modules
iser-modules
ofed-scripts

3
data/versions Normal file
View File

@ -0,0 +1,3 @@
{
"current": "1.2.0"
}

5
packages/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*.dsc
*.tar.gz
*.deb
*.build
*.changes

@ -0,0 +1 @@
Subproject commit 051977458f4078a06008bb6c6fd338cd994cf56c

@ -0,0 +1 @@
Subproject commit 13127cbd62e69be2d186c9d76d112729ea95a1ef

1
packages/vyatta-bash Submodule

@ -0,0 +1 @@
Subproject commit 001f9b1a9bd2b307bca94510ce05bc067e34f84d

1
packages/vyatta-cfg Submodule

@ -0,0 +1 @@
Subproject commit c56e20b98438e33822244315249e3edf0e356593

@ -0,0 +1 @@
Subproject commit 85c7b8b985685e859067ff75afebdb6fa64ed8e7

@ -0,0 +1 @@
Subproject commit 7440cf0c153d3f6484c96c32d4e02157fb938e2c

@ -0,0 +1 @@
Subproject commit 5248dbcc34eb6b041af928a0451ea866fc77488d

@ -0,0 +1 @@
Subproject commit 2de6ecd6068e6a9debb032a074395398f2dc4df1

@ -0,0 +1 @@
Subproject commit 0a5049b38b0830b289d0052a1fa2ce64785bc6ba

@ -0,0 +1 @@
Subproject commit 82dd077c98131a8a4b3383139e782f534bc310a1

@ -0,0 +1 @@
Subproject commit 2f9b0ecaf33c8598dc1a74ac0fb4f34abaad97cd

@ -0,0 +1 @@
Subproject commit 5c1672341b33dc726da5d7845725bd74e3cc7cb6

@ -0,0 +1 @@
Subproject commit 1881e2ef2fb041e7836db90b12450d63c1628473

@ -0,0 +1 @@
Subproject commit a47cd02bca9cb25125e14fe1b731029fb985d89c

@ -0,0 +1 @@
Subproject commit 28f7ce91358975ba9b36ac2874f6b47482815aab

@ -0,0 +1 @@
Subproject commit 362135271f8bd647d8fa772f775d26c1edcac7c6

@ -0,0 +1 @@
Subproject commit 4f6ae97660e512d90f1d4ac9822cdc1172f0fdf3

@ -0,0 +1 @@
Subproject commit ab07c835d1b09ab5424190dd240dfa65e77b81f2

@ -0,0 +1 @@
Subproject commit 0b78fea66ab7d8ae84da7345650965e1752e1c28

@ -0,0 +1 @@
Subproject commit 809508f4b3248e8dc4bfbcb527084d3bac4c78f8

1
packages/vyatta-lldp Submodule

@ -0,0 +1 @@
Subproject commit b7c70732793bfd88c23ffb424bf44fd65b0bf8bc

1
packages/vyatta-nat Submodule

@ -0,0 +1 @@
Subproject commit 52fb9ab3f8a1d1aeda0149946b1e1b77617bc6cd

@ -0,0 +1 @@
Subproject commit 22b60a0e4dc9ff7d4001b55bf1f17e55e5267389

1
packages/vyatta-op Submodule

@ -0,0 +1 @@
Subproject commit 6152bc3abd0cb1dc6c7717a653558a1c3393fe31

@ -0,0 +1 @@
Subproject commit 2c8c4ae26ea671cd48c80335b127bbac7ad0783a

@ -0,0 +1 @@
Subproject commit 7ad3f22bedd1ce169b076fd3fabb32761082b66e

@ -0,0 +1 @@
Subproject commit ec1c87ec516d0814d1f4b6115dd93b4287f3055d

@ -0,0 +1 @@
Subproject commit 24189c4533bc9147ac3c780ce80bf49194beb67c

@ -0,0 +1 @@
Subproject commit 0ec07e891b0191b24185ea09c6f33f6502597df6

@ -0,0 +1 @@
Subproject commit 5f754cd2c2660f3fd58210c92d5847225fc2b6b5

@ -0,0 +1 @@
Subproject commit b721e84e0915406cb5458fea7f444b45b5d1196a

1
packages/vyatta-ravpn Submodule

@ -0,0 +1 @@
Subproject commit 6fb662b78e2b688d2a00d0221821904ef841b391

1
packages/vyatta-util Submodule

@ -0,0 +1 @@
Subproject commit 22ee60e33a9e5fc4dc372ae8798b4f05d1b520c3

1
packages/vyatta-vrrp Submodule

@ -0,0 +1 @@
Subproject commit c6411d8c4c1a11f0305ddee2824d7081cd2654a3

@ -0,0 +1 @@
Subproject commit c4ad578e0d82b688d5ed60b649604982eae8350a

@ -0,0 +1 @@
Subproject commit 30133ba0fd68b0c3726127f195e1058c427fe58f

@ -0,0 +1 @@
Subproject commit 4a86d4a3f886b8b42311dabd0ddceabdf8cdd519

@ -0,0 +1 @@
Subproject commit 5b92a6e5a446b3b74ad78832ea82f977d6bba325

@ -0,0 +1 @@
Subproject commit 8022e5ca50591afa2db948fd9454ce4f4cfb406f

1
packages/vyatta-zone Submodule

@ -0,0 +1 @@
Subproject commit f8f40ba6bf5a95a5b147f9cd0e7e425cdb9c015a

1
packages/vyos-1x Submodule

@ -0,0 +1 @@
Subproject commit 4022a8820ccf0539f2eb5c19d9abd777810a48b4

@ -0,0 +1 @@
Subproject commit 97db97216f05756b6428449412e35f8b06dc73f3

@ -0,0 +1 @@
Subproject commit dc8ade02407f836873e78887f4b3c94b6540a578

1
packages/vyos-kernel Submodule

@ -0,0 +1 @@
Subproject commit 123087671203ad50989a2ff0c91d0df2dc4d32e1

1
packages/vyos-nhrp Submodule

@ -0,0 +1 @@
Subproject commit aae14502e55b41e822d890ba08e3460609454cd0

@ -0,0 +1 @@
Subproject commit 566709144fb119d32cc029615cff2e688a8a7557

1
packages/vyos-world Submodule

@ -0,0 +1 @@
Subproject commit 5055f0b8215df93c2973d8b35ac40fa8b526d0a1

12
scripts/Vagrantfile vendored Normal file
View File

@ -0,0 +1,12 @@
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

158
scripts/build-clearfog-image Executable file
View File

@ -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 <http://www.gnu.org/licenses/>.
#
# 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 vyos-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 vyos-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

View File

@ -1,4 +1,27 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# 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
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# File: build-config
# Purpose:
# This script serves the same purpose as ./configure in traditional
# autoconf setups.
# It takes build configuration options from command line, checks them,
# builds a config dictionary, augments it with some default and/or
# computed values and saves it to build/build-config.json
# for other build scripts to read.
import argparse
import re
@ -19,28 +42,80 @@ def field_to_option(s):
def get_default_build_by():
return "{user}@{host}".format(user= getpass.getuser(), host=platform.node())
def get_validator(optdict, name):
try:
return optdict[name][2]
except KeyError:
return None
# 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']),
'build-by': ('Builder identifier (e.g. jrandomhacker@example.net)', get_default_build_by, None)
'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),
'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),
'vyos-mirror': ('VyOS package mirror', lambda: defaults.VYOS_MIRROR, None),
'build-type': ('Build type, release or development', lambda: 'development', lambda x: x in ['release', 'development']),
'version': ('Version number (release builds only)', None, None)
}
# Create the option parser
parser = argparse.ArgumentParser()
for k, v in options.items():
parser.add_argument('--' + k, type=str, help=v[0], default=v[1]())
help_string, default_value_thunk = v[0], v[1]
if default_value_thunk is None:
parser.add_argument('--' + k, type=str, help=help_string)
else:
parser.add_argument('--' + k, type=str, help=help_string, default=default_value_thunk())
# The debug option is a bit special since it's different type
parser.add_argument('--debug', help="Enable debug output", action='store_true')
args = vars(parser.parse_args())
# Validate options
for k, v in args.items():
key = field_to_option(k)
func = options[key][2]
func = get_validator(options, k)
if func is not None:
if not func(v):
print("{v} is not a valid value for --{o} option".format(o=key, v=v))
sys.exit(1)
# 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):
args['pbuilder_debian_mirror'] = args['debian_mirror']
# Version can only be set for release builds,
# for dev builds it hardly makes any sense
if args['build_type'] == 'development':
if args['version'] is not None:
print("Version can only be set for release builds")
print("Use --build-type=release option if you want to set version number")
sys.exit(1)
# Populate some defaults that are not configurable,
# but that are handy to have in the options hash
args['distribution'] = 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
# 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
os.makedirs(defaults.BUILD_DIR, exist_ok=True)
print("Saving the build config to {0}".format(defaults.BUILD_CONFIG))
with open(defaults.BUILD_CONFIG, 'w') as f:
json.dump(args, f)
json.dump(args, f, indent=4, sort_keys=True)
print("\n", file=f)

Some files were not shown because too many files have changed in this diff Show More