T2640: update VyOS in docker image to current version

This commit is contained in:
Christian Breunig 2023-11-26 20:12:24 +01:00
parent a0d3d87813
commit 0411ec870e
5 changed files with 52 additions and 32 deletions

View File

@ -20,10 +20,29 @@ ARG BUILD_DATE
# Use Debian as base layer
FROM debian:bookworm-slim
# Copy installer script and default build settings
COPY [ "data/defaults.json", "data/live-build-config/archives/*", "docker-vyos/vyos_install_common.sh", "docker-vyos/vyos_install_stage_01.sh", "/tmp/" ]
COPY [ "data/live-build-config/hooks/live/*", "/tmp/hooks/" ]
LABEL authors="VyOS Maintainers <maintainers@vyos.io>"
ENV DEBIAN_FRONTEND noninteractive
RUN /bin/echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommends
# Base packaged needed to build packages and their package dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
gnupg \
curl \
fuse-overlayfs \
jq \
yq
# Copy installer script and default build settings
COPY [ "data/defaults.toml", \
"data/architectures/amd64.toml", \
"data/live-build-config/archives/*", \
"docker-vyos/vyos_install_common.sh", \
"docker-vyos/vyos_install_stage_01.sh", \
"/tmp/"]
COPY [ "data/live-build-config/hooks/live/*", "/tmp/hooks/" ]
# Install VyOS dependencies
WORKDIR /tmp
@ -31,14 +50,15 @@ RUN bash /tmp/vyos_install_stage_01.sh
# Install VyOS specific software
COPY [ "data/defaults.json", "docker-vyos/vyos_install_common.sh", "docker-vyos/vyos_install_stage_02.sh", "/tmp/" ]
COPY [ "data/defaults.toml", \
"data/architectures/amd64.toml", \
"docker-vyos/vyos_install_common.sh", \
"docker-vyos/vyos_install_stage_02.sh", "/tmp/" ]
RUN bash /tmp/vyos_install_stage_02.sh
# Tune system for VyOS
COPY [ "docker-vyos/vyos_install_common.sh", "docker-vyos/vyos_install_stage_03.sh", "/tmp/" ]
# Copy skel for bash profile
COPY data/live-build-config/includes.chroot/etc/skel/.bashrc /etc/skel/.bashrc
# Copy default config
COPY data/live-build-config/includes.chroot/opt/vyatta/etc/config.boot.default /opt/vyatta/etc/

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright (C) 2020 VyOS maintainers and contributors
# Copyright (C) 2020-2023 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
@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Set environment variables
export DEBIAN_FRONTEND="noninteractive"
@ -23,21 +22,21 @@ function prepare_apt() {
# Update packages list
apt-get update
# Install jq (required to easily extract variables from defaults.json)
apt-get install -y --no-install-recommends jq gnupg
# Add VyOS repository to the system
local APT_VYOS_MIRROR=`jq --raw-output .vyos_mirror /tmp/defaults.json`
local APT_VYOS_BRANCH=`jq --raw-output .vyos_branch /tmp/defaults.json`
local APT_ADDITIONAL_REPOS=`jq --raw-output .additional_repositories[] /tmp/defaults.json`
local RELEASE_TRAIN=`jq --raw-output .release_train /tmp/defaults.json`
local APT_VYOS_MIRROR=$(tomlq --raw-output .vyos_mirror /tmp/defaults.toml)
local APT_VYOS_BRANCH=$(tomlq --raw-output .vyos_branch /tmp/defaults.toml)
local APT_ADDITIONAL_REPOS=$(tomlq --raw-output .additional_repositories[] /tmp/amd64.toml)
local RELEASE_TRAIN=$(tomlq --raw-output .release_train /tmp/defaults.toml)
if [[ "${RELEASE_TRAIN}" == "crux" ]]; then
echo -e "deb ${APT_VYOS_MIRROR}/vyos ${APT_VYOS_BRANCH} main\ndeb ${APT_VYOS_MIRROR}/debian ${APT_VYOS_BRANCH} main\n${APT_ADDITIONAL_REPOS}" > /etc/apt/sources.list.d/vyos.list
fi
echo "APT_VYOS_MIRROR : $APT_VYOS_MIRROR"
echo "APT_VYOS_BRANCH : $APT_VYOS_BRANCH"
echo "APT_ADDITIONAL_REPOS : $APT_ADDITIONAL_REPOS"
echo "RELEASE_TRAIN : $RELEASE_TRAIN"
if [[ "${RELEASE_TRAIN}" == "equuleus" || "${RELEASE_TRAIN}" == "sagitta" ]]; then
echo -e "deb ${APT_VYOS_MIRROR} ${APT_VYOS_BRANCH} main\n${APT_ADDITIONAL_REPOS}" > /etc/apt/sources.list.d/vyos.list
echo -e "deb ${APT_VYOS_MIRROR} ${APT_VYOS_BRANCH} main\n${APT_ADDITIONAL_REPOS}" > /etc/apt/sources.list.d/vyos.list
cat /etc/apt/sources.list.d/vyos.list
if [ ${RELEASE_TRAIN} == "equuleus" ]; then
# Add backports repository
echo -e "deb http://deb.debian.org/debian buster-backports main\ndeb http://deb.debian.org/debian buster-backports non-free" >> /etc/apt/sources.list.d/vyos.list
fi
@ -65,8 +64,6 @@ function prepare_apt() {
# Cleanup APT after finish
function cleanup_apt() {
# delete jq tool
dpkg -P jq
# Clear APT cache
apt-get clean
rm -rf /var/lib/apt/lists/*

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright (C) 2020 VyOS maintainers and contributors
# Copyright (C) 2020-2023 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
@ -58,6 +58,7 @@ ignore_list=(
"cluster-glue"
"resource-agents"
"heartbeat"
"podman"
)
# Get list of packages from VYOS repository

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright (C) 2020 VyOS maintainers and contributors
# Copyright (C) 2020-2023 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
@ -35,6 +35,8 @@ vyos_packages_filtered=("$(filter_list vyos_packages[@] vyos_packages_filter[@])
vyos_packages_filtered+=(
"uuid"
"jq"
"yq"
"systemd"
)
echo "Packages for installing: ${vyos_packages_filtered[@]}"
@ -43,12 +45,12 @@ echo "Installing VyOS packages"
apt-get install -y --no-install-recommends ${vyos_packages_filtered[@]}
# Create VyOS version file
RELEASAE_TRAIN=`jq --raw-output .release_train /tmp/defaults.json`
RELEASAE_TRAIN=$(tomlq --raw-output .release_train /tmp/defaults.toml)
apt-cache show vyos-1x | awk -v release_train=${RELEASAE_TRAIN} '{ if ($1 == "Version:") version = $2 } END { build_git = "unknown" ; built_by = "Sentrium S.L." ; built_on = strftime("%F %T UTC", systime(), utc) ; "uuid -v 4" | getline build_uuid ; printf("{\"version\": \"%s\", \"build_git\": \"%s\", \"built_on\": \"%s\", \"built_by\": \"%s\", \"build_uuid\": \"%s\", \"release_train\": \"%s\"}", version, build_git, built_on, built_by, build_uuid, release_train) }' | json_pp > /usr/share/vyos/version.json
# Delete what we do not need inside Docker image (this step makes packages database inconsistent)
echo "Deleting what is needless in containers"
dpkg -P --force-depends dosfstools efibootmgr jq gdisk grub-common grub-efi-amd64-bin initscripts installation-report laptop-detect libossp-uuid16 libparted2 libwireshark-data libwireshark5 mdadm parted tshark uuid vyos-qat-kernel-modules wireguard-modules
dpkg -P --force-depends dosfstools efibootmgr yq jq gdisk grub-common grub-efi-amd64-bin initscripts installation-report laptop-detect libossp-uuid16 libparted2 libwireshark-data libwireshark5 mdadm parted tshark uuid
dpkg -l | awk '/linux-image-/ { system("dpkg -P --force-depends " $2) }'
# Delete documentation

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright (C) 2020 VyOS maintainers and contributors
# Copyright (C) 2020-2023 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
@ -20,6 +20,7 @@
. vyos_install_common.sh
# Add config partition marker
mkdir -p /opt/vyatta/etc/config
touch /opt/vyatta/etc/config/.vyatta_config
# create folder for configuration mounting
@ -54,10 +55,9 @@ for hook in ${hooks_list[@]}; do
done
# Delete needless options from CLI
# CLI_DELETION=(
# "/opt/vyatta/share/vyatta-cfg/templates/system/host-name/"
# )
# rm -rf ${CLI_DELETION[@]}
CLI_DELETION=(
"/opt/vyatta/share/vyatta-cfg/templates/container/"
)
rm -rf ${CLI_DELETION[@]}
exit 0