T3664: remove vagrant build

This commit is contained in:
Kim Hagen 2021-07-07 05:22:28 -05:00
parent 43f4d5c3cd
commit 7afee1ae93
5 changed files with 0 additions and 309 deletions

View File

@ -44,20 +44,6 @@ prepare-package-env:
@scripts/pbuilder-config
@scripts/pbuilder-setup
.PHONY: vagrant-libvirt
.ONESHELL:
vagrant-libvirt:
@set -e
@scripts/check-vm-build-env
@scripts/build-vagrant-libvirt-box
.PHONY: hyperv
.ONESHELL:
hyperv:
@set -e
@scripts/check-vm-build-env
@scripts/build-hyperv-image
.PHONY: AWS
.ONESHELL:
AWS: clean prepare

12
scripts/Vagrantfile vendored
View File

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

View File

@ -1,158 +0,0 @@
#!/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,74 +0,0 @@
#!/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-vagrant-libvirt-box
# Purpose:
# Build VyOS Vagrant libvirt box.
export PACKER_BUILD_DIR=packer_build
DST_DIR=${PACKER_BUILD_DIR}/vagrant-libvirt
BOX_DIR=${DST_DIR}/box
mkdir -p ${BOX_DIR}
# Copy qcow2 image
cp -p packer_build/qemu/vyos_qemu_image.img ${BOX_DIR}/box.img
# Put metadata.json and Vagrantfile
echo '{"format":"qcow2","provider":"libvirt","virtual_size":4}' > ${BOX_DIR}/metadata.json
cat <<EOF > ${BOX_DIR}/Vagrantfile
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
EOF
# Create box
box=${DST_DIR}/vyos_vagrant_libvirt.box
tar -C ${BOX_DIR} -czvf ${box} metadata.json Vagrantfile box.img
if [ "$?" = "0" ]; then
echo "Vagrant libvirt box successfully created to ./${box}"
fi
PROVIDER=libvirt
# Create 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
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}
echo

View File

@ -1,51 +0,0 @@
#!/usr/bin/env python3
#
# 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: check-vm-build-env
# Purpose:
# Checks if packages required for VM image build are installed.
import os
import sys
import util
deps = {
'packages': [
'jq',
'qemu-system-x86',
'qemu-utils'
],
'binaries': ['packer']
}
print("Checking if packages required for VyOS image build are installed")
checker = util.DependencyChecker(deps)
missing = checker.get_missing_dependencies()
if not missing:
print("All dependencies are installed")
sys.exit(0)
else:
checker.print_missing_deps()
if 'packer' in missing['binaries']:
print("Your system does not have Packer.")
print("Please install Packer from https://www.packer.io/downloads.html.")
sys.exit(1)
sys.exit(0)