From 301cd5b991caded9c84d1ce4bb214ac720ba5796 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 9 Aug 2021 09:24:21 -0500 Subject: add items for grub setup and enable persistence --- scripts/build/binary_grub-legacy | 4 +- scripts/build/binary_hdd | 11 ++++ scripts/build/binary_linux-image | 2 +- scripts/build/binary_loopback_cfg | 41 ++++++++++++++- scripts/build/binary_manifest | 2 +- scripts/build/binary_memtest | 2 +- scripts/build/binary_rootfs | 2 +- scripts/build/config | 104 +++++++++++++++++++++++++++++++++++++- 8 files changed, 160 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/build/binary_grub-legacy b/scripts/build/binary_grub-legacy index fea9b7b6a..76c7da500 100755 --- a/scripts/build/binary_grub-legacy +++ b/scripts/build/binary_grub-legacy @@ -127,7 +127,7 @@ fi case "${LB_INITRAMFS}" in live-boot) - INITFS="live" + INITFS="${LB_VYOS_VERSION}" ;; *) @@ -140,7 +140,7 @@ case "${LIVE_IMAGE_TYPE}" in iso*|tar) case "${LB_INITRAMFS}" in live-boot) - DESTDIR_LIVE="binary/live" + DESTDIR="binary/${LB_VYOS_VERSION}" ;; *) diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd index dee92017e..8cf44126e 100755 --- a/scripts/build/binary_hdd +++ b/scripts/build/binary_hdd @@ -275,6 +275,17 @@ else fi cp -T ${CP_OPTIONS} binary/ chroot/binary.tmp +if [ "${LB_VYOS_PERSISTENCE}" = "true" ] +then + mkdir -p chroot/binary.tmp/${LB_VYOS_VERSION}/rw + mkdir -p chroot/binary.tmp/${LB_VYOS_VERSION}/work + mv chroot/binary.tmp/${LB_VYOS_VERSION}/filesystem.squashfs \ + chroot/binary.tmp/${LB_VYOS_VERSION}/$(basename ${LB_VYOS_VERSION}).squashfs + cat > chroot/binary.tmp/persistence.conf << EOF +/ union +EOF +fi + if [ -n "${GRUB_PC_ENABLED}" ] then case "${LB_BUILD_WITH_CHROOT}" in diff --git a/scripts/build/binary_linux-image b/scripts/build/binary_linux-image index 12a6304a1..9b46a104a 100755 --- a/scripts/build/binary_linux-image +++ b/scripts/build/binary_linux-image @@ -45,7 +45,7 @@ Create_lockfile .lock case "${LB_INITRAMFS}" in live-boot) - DESTDIR="binary/live" + DESTDIR="binary/${LB_VYOS_VERSION}" ;; *) diff --git a/scripts/build/binary_loopback_cfg b/scripts/build/binary_loopback_cfg index f710ed483..71b2dca33 100755 --- a/scripts/build/binary_loopback_cfg +++ b/scripts/build/binary_loopback_cfg @@ -146,7 +146,7 @@ fi case "${LB_INITRAMFS}" in live-boot) - INITFS="live" + INITFS="${LB_VYOS_VERSION}" ;; *) @@ -210,6 +210,45 @@ if [ "${_AMD64_686_NUMBER}" -ge 2 ] ; then "/${INITFS}/${_686_INITRD}" \ "${LB_BOOTAPPEND_LIVE_FAILSAFE}" fi +elif [ "${LB_VYOS_VERSION}" != "live" ]; then + if [ "${LB_BOOTAPPEND_VYOS_CONSOLE_1}" != "none" ]; then + Grub_live_entry "VyOS $(basename ${LB_VYOS_VERSION}) linux (${LB_VYOS_CONSOLE_1} console)" \ + "/${INITFS}/${DEFAULT_KERNEL}" \ + "/${INITFS}/${DEFAULT_INITRD}" \ + "${LB_BOOTAPPEND_VYOS_CONSOLE_1}" + fi + if [ "${LB_BOOTAPPEND_VYOS_CONSOLE_2}" != "none" ]; then + Grub_live_entry "VyOS $(basename ${LB_VYOS_VERSION}) linux (${LB_VYOS_CONSOLE_2} console)" \ + "/${INITFS}/${DEFAULT_KERNEL}" \ + "/${INITFS}/${DEFAULT_INITRD}" \ + "${LB_BOOTAPPEND_VYOS_CONSOLE_2}" + fi + if [ "${LB_BOOTAPPEND_VYOS_CONSOLE_3}" != "none" ]; then + Grub_live_entry "VyOS $(basename ${LB_VYOS_VERSION}) linux (${LB_VYOS_CONSOLE_3} console)" \ + "/${INITFS}/${DEFAULT_KERNEL}" \ + "/${INITFS}/${DEFAULT_INITRD}" \ + "${LB_BOOTAPPEND_VYOS_CONSOLE_3}" + fi + if [ "${LB_BOOTAPPEND_VYOS_PW_CONSOLE_1}" != "none" ]; then + Grub_live_entry "Lost password change $(basename ${LB_VYOS_VERSION}) linux (${LB_VYOS_CONSOLE_1} console)" \ + "/${INITFS}/${DEFAULT_KERNEL}" \ + "/${INITFS}/${DEFAULT_INITRD}" \ + "${LB_BOOTAPPEND_VYOS_PW_CONSOLE_1}" + fi + if [ "${LB_BOOTAPPEND_VYOS_PW_CONSOLE_2}" != "none" ]; then + Grub_live_entry "Lost password change $(basename ${LB_VYOS_VERSION}) linux (${LB_VYOS_CONSOLE_2} console)" \ + "/${INITFS}/${DEFAULT_KERNEL}" \ + "/${INITFS}/${DEFAULT_INITRD}" \ + "${LB_BOOTAPPEND_VYOS_PW_CONSOLE_2}" + fi + if [ "${LB_BOOTAPPEND_VYOS_PW_CONSOLE_3}" != "none" ]; then + Grub_live_entry "Lost password change $(basename ${LB_VYOS_VERSION}) linux (${LB_VYOS_CONSOLE_3} console)" \ + "/${INITFS}/${DEFAULT_KERNEL}" \ + "/${INITFS}/${DEFAULT_INITRD}" \ + "${LB_BOOTAPPEND_VYOS_PW_CONSOLE_3}" + fi + + else Grub_live_entry "Live system" "/${INITFS}/${DEFAULT_KERNEL}" "/${INITFS}/${DEFAULT_INITRD}" "${APPEND_LIVE}" if [ "${LB_BOOTAPPEND_LIVE_FAILSAFE}" != "none" ] diff --git a/scripts/build/binary_manifest b/scripts/build/binary_manifest index ceee2c380..963e27cda 100755 --- a/scripts/build/binary_manifest +++ b/scripts/build/binary_manifest @@ -45,7 +45,7 @@ Create_lockfile .lock case "${LB_INITRAMFS}" in live-boot) - INITFS="live" + INITFS="${LB_VYOS_VERSION}" SUFFIX="packages" ;; diff --git a/scripts/build/binary_memtest b/scripts/build/binary_memtest index 96fb4f101..035809b83 100755 --- a/scripts/build/binary_memtest +++ b/scripts/build/binary_memtest @@ -81,7 +81,7 @@ Install_package # Setting destination directory case "${LB_INITRAMFS}" in live-boot) - DESTDIR="binary/live" + DESTDIR="binary/${LB_VYOS_VERSION}" ;; *) diff --git a/scripts/build/binary_rootfs b/scripts/build/binary_rootfs index d50cf3b43..1e288073c 100755 --- a/scripts/build/binary_rootfs +++ b/scripts/build/binary_rootfs @@ -50,7 +50,7 @@ esac case "${LB_INITRAMFS}" in live-boot) - INITFS="live" + INITFS="${LB_VYOS_VERSION}" ;; *) diff --git a/scripts/build/config b/scripts/build/config index 6c2ab3b7b..bf20f3653 100755 --- a/scripts/build/config +++ b/scripts/build/config @@ -31,7 +31,17 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--binary-filesystem fat16|fat32|ext2|ext3|ext4|ntfs]\n\ \t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\ \t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-vyos-console-1 PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-vyos-console-2 PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-vyos-console-3 PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-vyos-pw-console-1 PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-vyos-pw-console-2 PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-vyos-pw-console-3 PARAMETER|\"PARAMETERS\"]\n\ \t [--bootappend-live-failsafe PARAMETER|\"PARAMETERS\"]\n\ +\t [--vyos-console-1 KVM|Serial|USB]\n\ +\t [--vyos-console-2 KVM|Serial|USB]\n\ +\t [--vyos-console-3 KVM|Serial|USB]\n\ +\t [--vyos-persistence true|false]\n\ \t [--bootloaders grub-legacy|grub-pc|syslinux|grub-efi]\n\ \t [--cache true|false]\n\ \t [--cache-indices true|false]\n\ @@ -123,6 +133,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--backports true|false]\n\ \t [--verbose]\n\ \t [--loadlin true|false]\n\ +\t [--vyos-version]\n\ \t [--win32-loader true|false]\n\ \t [--bootstrap-qemu-exclude PACKAGES]\n\ \t [--bootstrap-qemu-static PATH]\n\ @@ -144,13 +155,16 @@ Local_arguments () gzip-options:,image-name:,interactive:,keyring-packages:,linux-flavours:,linux-packages:, security:,updates:,backports:,binary-filesystem:,binary-images:, apt-indices:,bootappend-install:,bootappend-live:,bootappend-live-failsafe:,bootloader:,bootloaders:,checksums:,compression:,config:,zsync:,build-with-chroot:, + bootappend-vyos-console-1:,bootappend-vyos-console-2:,bootappend-vyos-console-3:, + bootappend-vyos-pw-console-1:,bootappend-vyos-pw-console-2:,bootappend-vyos-pw-console-3:, + vyos-console-1:,vyos-console-2:,vyos-console-3:,vyos-persistence:, debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, grub-splash:,isohybrid-options:,hdd-label:,hdd-size:,hdd-partition-start:,iso-application:,iso-preparer:,iso-publisher:, iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:, net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:, net-cow-server:,net-tarball:,onie:,onie-kernel-cmdline:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:, loadlin:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, - help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:, + help,ignore-system-defaults,quiet,usage,verbose,version,vyos-version:,bootstrap-qemu-static:,bootstrap-qemu-arch:, uefi-secure-boot:, bootstrap-qemu-exclude:" # Remove spaces added by indentation @@ -493,11 +507,61 @@ Local_arguments () shift 2 ;; + --bootappend-vyos-console-1) + LB_BOOTAPPEND_VYOS_CONSOLE_1="${2}" + shift 2 + ;; + + --bootappend-vyos-console-2) + LB_BOOTAPPEND_VYOS_CONSOLE_2="${2}" + shift 2 + ;; + + --bootappend-vyos-console-3) + LB_BOOTAPPEND_VYOS_CONSOLE_3="${2}" + shift 2 + ;; + + --bootappend-vyos-pw-console-1) + LB_BOOTAPPEND_VYOS_PW_CONSOLE_1="${2}" + shift 2 + ;; + + --bootappend-vyos-pw-console-2) + LB_BOOTAPPEND_VYOS_PW_CONSOLE_2="${2}" + shift 2 + ;; + + --bootappend-vyos-pw-console-3) + LB_BOOTAPPEND_VYOS_PW_CONSOLE_3="${2}" + shift 2 + ;; + --bootappend-live-failsafe) LB_BOOTAPPEND_LIVE_FAILSAFE="${2}" shift 2 ;; + --vyos-console-1) + LB_VYOS_CONSOLE_1="${2}" + shift 2 + ;; + + --vyos-console-2) + LB_VYOS_CONSOLE_2="${2}" + shift 2 + ;; + + --vyos-console-3) + LB_VYOS_CONSOLE_3="${2}" + shift 2 + ;; + + --vyos-persistence) + LB_VYOS_PERSISTENCE="${2}" + shift 2 + ;; + --bootappend-install) LB_BOOTAPPEND_INSTALL="${2}" shift 2 @@ -698,6 +762,11 @@ Local_arguments () shift 2 ;; + --vyos-version) + LB_VYOS_VERSION="boot/${2}" + shift 2 + ;; + --win32-loader) LB_WIN32_LOADER="${2}" shift 2 @@ -1174,6 +1243,36 @@ LB_APT_INDICES="${LB_APT_INDICES}" # (Default: empty) LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE}" +# Set boot parameters +LB_BOOTAPPEND_VYOS_CONSOLE_1="${LB_BOOTAPPEND_VYOS_CONSOLE_1}" + +# Set boot parameters +LB_BOOTAPPEND_VYOS_CONSOLE_2="${LB_BOOTAPPEND_VYOS_CONSOLE_2}" + +# Set boot parameters +LB_BOOTAPPEND_VYOS_CONSOLE_3="${LB_BOOTAPPEND_VYOS_CONSOLE_3}" + +# Set boot parameters +LB_BOOTAPPEND_VYOS_PW_CONSOLE_1="${LB_BOOTAPPEND_VYOS_PW_CONSOLE_1}" + +# Set boot parameters +LB_BOOTAPPEND_VYOS_PW_CONSOLE_2="${LB_BOOTAPPEND_VYOS_PW_CONSOLE_2}" + +# Set boot parameters +LB_BOOTAPPEND_VYOS_PW_CONSOLE_3="${LB_BOOTAPPEND_VYOS_PW_CONSOLE_3}" + +# Set console +LB_VYOS_CONSOLE_1="${LB_VYOS_CONSOLE_1}" + +# Set console +LB_VYOS_CONSOLE_2="${LB_VYOS_CONSOLE_2}" + +# Set console +LB_VYOS_CONSOLE_3="${LB_VYOS_CONSOLE_3}" + +# Set VyOS presistence +LB_VYOS_PERSISTENCE="${LB_VYOS_PERSISTENCE}" + # \$LB_BOOTAPPEND_INSTALL: set boot parameters # (Default: empty) LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL}" @@ -1263,6 +1362,9 @@ LB_MEMTEST="${LB_MEMTEST}" # (Default: ${LB_LOADLIN}) LB_LOADLIN="${LB_LOADLIN}" +# Set VyOS version +LB_VYOS_VERSION="${LB_VYOS_VERSION}" + # \$LB_WIN32_LOADER: set win32-loader # (Default: ${LB_WIN32_LOADER}) LB_WIN32_LOADER="${LB_WIN32_LOADER}" -- cgit v1.2.3