diff options
Diffstat (limited to 'data/live-build-config')
9 files changed, 90 insertions, 151 deletions
diff --git a/data/live-build-config/hooks/live/01-live-serial.binary b/data/live-build-config/hooks/live/01-live-serial.binary new file mode 100755 index 00000000..e138b20d --- /dev/null +++ b/data/live-build-config/hooks/live/01-live-serial.binary @@ -0,0 +1,31 @@ +#!/bin/sh + +GRUB_PATH=boot/grub/grub.cfg +ISOLINUX_PATH=isolinux/live.cfg + +KVM_CONSOLE="console=ttyS0,115200 console=tty0" +SERIAL_CONSOLE="console=tty0 console=ttyS0,115200" + +# Grub.cfg Update +GRUB_MENUENTRY=$(sed -e '/menuentry.*hotkey.*/,/^}/!d' -e 's/--hotkey=l//g' $GRUB_PATH) + +# Update KVM menuentry name +sed -i 's/"Live system \((.*-vyos)\)"/"Live system \1 - KVM console"/' $GRUB_PATH + +# Insert serial menuentry +echo "$GRUB_MENUENTRY" | sed \ + -e 's/"Live system \((.*-vyos)\)"/"Live system \1 - Serial console"/' \ + -e "s/$KVM_CONSOLE/$SERIAL_CONSOLE/g" >> $GRUB_PATH + +# Live.cfg Update +ISOLINUX_MENUENTRY=$(sed -e '/label live-\(.*\)-vyos$/,/^\tappend.*/!d' $ISOLINUX_PATH) + +# Update KVM menuentry name +sed -i 's/Live system \((.*-vyos)\)/Live system \1 - KVM console/' $ISOLINUX_PATH + +# Insert serial menuentry +echo "\n$ISOLINUX_MENUENTRY" | sed \ + -e 's/live-\(.*\)-vyos/live-\1-vyos-serial/' \ + -e '/^\tmenu default/d' \ + -e 's/Live system \((.*-vyos)\)/Live system \1 - Serial console/' \ + -e "s/$KVM_CONSOLE/$SERIAL_CONSOLE/g" >> $ISOLINUX_PATH diff --git a/data/live-build-config/hooks/live/20-rm_ddclient_hook.chroot b/data/live-build-config/hooks/live/20-rm_ddclient_hook.chroot deleted file mode 100755 index 350843c7..00000000 --- a/data/live-build-config/hooks/live/20-rm_ddclient_hook.chroot +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -if [ -f /etc/dhcp/dhclient-exit-hooks.d/ddclient ]; then - rm -f /etc/dhcp/dhclient-exit-hooks.d/ddclient -fi - -if [ -f /etc/ddclient.conf ]; then - rm -f /etc/ddclient.conf -fi diff --git a/data/live-build-config/hooks/live/22-rm_cron_atop.chroot b/data/live-build-config/hooks/live/22-rm_cron_atop.chroot deleted file mode 100755 index 7f77e1f7..00000000 --- a/data/live-build-config/hooks/live/22-rm_cron_atop.chroot +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -if [ -f /etc/cron.d/atop ]; then - rm -f /etc/cron.d/atop -fi - diff --git a/data/live-build-config/hooks/live/30-frr-configs.chroot b/data/live-build-config/hooks/live/30-frr-configs.chroot deleted file mode 100755 index 03b1af6c..00000000 --- a/data/live-build-config/hooks/live/30-frr-configs.chroot +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python3 - -# For FRR to work in VyOS as expected we need a few fixups -# -# 1. Enable daemons we use in /etc/frr/daemons -# 2. Set the VRF backend of Zebra to netns (-n option) in /etc/frr/daemons.conf -# Otherwise multiple routing tables for PBR won't work -# 3. Create empty configs for daemons with use -# That is to make them possible to start on boot before config is loaded -# - -import os - -daemons = """ -zebra=yes -bgpd=yes -ospfd=yes -ospf6d=yes -ripd=yes -ripngd=yes -isisd=yes -pimd=no -pim6d=yes -ldpd=yes -nhrpd=no -eigrpd=yes -babeld=yes -sharpd=no -pbrd=no -bfdd=yes -staticd=yes - -vtysh_enable=yes -zebra_options="-s 90000000 --daemon -A 127.0.0.1 -M snmp" -bgpd_options="--daemon -A 127.0.0.1 -M snmp -M rpki -M bmp" -ospfd_options="--daemon -A 127.0.0.1 -M snmp" -ospf6d_options="--daemon -A ::1 -M snmp" -ripd_options="--daemon -A 127.0.0.1 -M snmp" -ripngd_options="--daemon -A ::1" -isisd_options="--daemon -A 127.0.0.1 -M snmp" -pimd_options="--daemon -A 127.0.0.1" -pim6d_options=""--daemon -A ::1" -ldpd_options="--daemon -A 127.0.0.1" -nhrpd_options="--daemon -A 127.0.0.1" -mgmtd_options=" --daemon -A 127.0.0.1" -eigrpd_options="--daemon -A 127.0.0.1" -babeld_options="--daemon -A 127.0.0.1" -sharpd_options="--daemon -A 127.0.0.1" -pbrd_options="--daemon -A 127.0.0.1" -staticd_options="--daemon -A 127.0.0.1" -bfdd_options="--daemon -A 127.0.0.1" - -watchfrr_enable=no -valgrind_enable=no -""" - -frr_conf = """ -log syslog -log facility local7 -""" - -frr_log = '' - -with open("/etc/frr/daemons", "w") as f: - f.write(daemons) - -with open("/etc/frr/frr.conf", "w") as f: - f.write(frr_conf) - -# Prevent writing logs to /var/log/frr/frr.log. T2061 -with open("/etc/rsyslog.d/45-frr.conf", "w") as f: - f.write(frr_log) diff --git a/data/live-build-config/hooks/live/80-delete-docs.chroot b/data/live-build-config/hooks/live/80-delete-docs.chroot deleted file mode 100755 index 1f50a9ec..00000000 --- a/data/live-build-config/hooks/live/80-delete-docs.chroot +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# Delete various unused files and directories in order free some space and shrink imagesize. - -# We do not need any documentation on the system. -# Copyright/licenses files are ignored for deletion. -shopt -s extglob -rm -rf /usr/share/doc/*/!(copyright*|README*) /usr/share/doc-base - -# We do not need any manpages on the system since man-binary is missing. -rm -rf /usr/local/man -rm -rf /usr/local/share/man -rm -rf /usr/share/man - -# We do not need any games on the system. -rm -rf /usr/games -rm -rf /usr/local/games - -# We do not need any caches on the system (will be recreated when needed). -rm -rf /var/cache/* - -# We do not need any log-files on the system (will be recreated when needed). -rm -rf /var/log/alternatives.log -rm -rf /var/log/bootstrap.log -rm -rf /var/log/dpkg.log -rm -rf /var/log/apt/history.log -rm -rf /var/log/apt/term.log -rm -rf /var/log/nginx/access.log -rm -rf /var/log/nginx/error.log -rm -rf /var/log/squidguard/squidGuard.log -rm -rf /var/log/stunnel4/stunnel.log - -# We do not need any backup-files on the system. -rm -rf /etc/sudoers.bak -rm -rf /etc/xml/catalog.old -rm -rf /etc/xml/polkitd.xml.old -rm -rf /etc/xml/xml-core.xml.old -rm -rf /root/.gnupg/pubring.kbx~ -rm -rf /var/lib/dpkg/diversions-old -rm -rf /var/lib/dpkg/status-old -rm -rf /var/lib/sgml-base/supercatalog.old - diff --git a/data/live-build-config/hooks/live/81-cleanup-etc-defaults.chroot b/data/live-build-config/hooks/live/81-cleanup-etc-defaults.chroot deleted file mode 100755 index c93deee1..00000000 --- a/data/live-build-config/hooks/live/81-cleanup-etc-defaults.chroot +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# we use systemd to control ISC daemons from within vyos-1x -FILES="/etc/default/isc-dhcp-server /etc/default/isc-dhcp-relay" - -for FILE in ${FILES} -do - if [ -f ${FILE} ]; then - rm -f ${FILE} - fi -done diff --git a/data/live-build-config/hooks/live/82-cleanup-udev-rules.chroot b/data/live-build-config/hooks/live/82-cleanup-udev-rules.chroot deleted file mode 100755 index a0173e49..00000000 --- a/data/live-build-config/hooks/live/82-cleanup-udev-rules.chroot +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# 99-default.link rule always calls link_config that trying to set -# autonegotiation and duplex even for PPP interfaces. -# Need to delete this rule to prevent overhead on interface creation stage - -rm /lib/systemd/network/99-default.link diff --git a/data/live-build-config/hooks/live/83-cleanup-etc-motd-d.chroot b/data/live-build-config/hooks/live/83-cleanup-etc-motd-d.chroot deleted file mode 100755 index 9d8dc97e..00000000 --- a/data/live-build-config/hooks/live/83-cleanup-etc-motd-d.chroot +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -if [ -f /etc/update-motd.d/10-uname ]; then - rm -f /etc/update-motd.d/10-uname -fi diff --git a/data/live-build-config/rootfs/excludes b/data/live-build-config/rootfs/excludes new file mode 100644 index 00000000..2af69d7b --- /dev/null +++ b/data/live-build-config/rootfs/excludes @@ -0,0 +1,59 @@ +# Exclude various unused files and directories in order to free some space and shrink imagesize. +# +# For information on how to use wildcards properly (Anchored and Non-anchored excludes): +# +# https://github.com/plougher/squashfs-tools/blob/master/RELEASE-READMEs/README-3.3 +# +# Note: +# +# - root starts without leading '/'. +# + +# Txxx: Drop isc-dhcp helper files from /etc/default. +# We use systemd to control ISC daemons from within vyos-1x. +etc/default/isc-dhcp-server +etc/default/isc-dhcp-relay + +# T2185: Clean leftover files (ddclient) from base package. +etc/dhcp/dhclient-exit-hooks.d/ddclient +etc/ddclient.conf + +# T3242: Add hook to prevent link_config redundancy call in systemd-udev. +# 99-default.link rule always calls link_config thats trying to set autonegotiation and duplex even for PPP interfaces. +# Need to delete this rule to prevent overhead on interface creation stage. +lib/systemd/network/99-default.link + +# T3774: Disabled atop services. +etc/cron.d/atop + +# T3912: Remove superfluous motd.d kernel version shell script. +etc/update-motd.d/10-uname + +# T4415: We do not need any documentation on the system. +# Copyright/licenses files are ignored for deletion. +usr/share/doc/*/!(copyright*|README*) +usr/share/doc-base + +# T5468: We do not need any manpages on the system since man-binary is missing. +usr/local/man/* +usr/local/share/man/* +usr/share/man/* + +# T5511: We do not need any games on the system. +usr/games/* +usr/local/games/* + +# T5511: We do not need any caches on the system (will be recreated when needed). +var/cache/* + +# T5511: We do not need any log-files on the system (will be recreated when needed). +var/log/*.log +var/log/*/*.log +var/log/*/*.log.xz + +# T5511: We do not need any backup-files on the system (will be recreated when needed). +... *.bak +... *.old +... *.kbx~ +var/lib/dpkg/*-old + |