mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-09 06:32:00 -03:30
Add build-SD-armbian-vagrant.sh
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
parent
f1f6ca3bc7
commit
f1b1f643bc
43
build/armbian/Vagrantfile
vendored
Normal file
43
build/armbian/Vagrantfile
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
#
|
||||
# Vagrantfile for the NCP Debian VM
|
||||
#
|
||||
# Instructions: vagrant up; vagrant ssh
|
||||
#
|
||||
# Notes: User/Pass is ubnt/ubnt.
|
||||
# $HOME is accessible as /external. CWD is accessible as /cwd
|
||||
#
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
vmname = "NCP Ubuntu VM"
|
||||
config.vm.box = "generic/ubuntu2204"
|
||||
config.vm.box_check_update = true
|
||||
config.vm.hostname = "ncp-vm"
|
||||
config.vm.define "ncp-vm"
|
||||
config.vm.provider :libvirt do |libvirt|
|
||||
libvirt.default_prefix = ""
|
||||
libvirt.cpus = 6
|
||||
libvirt.memory = 4096
|
||||
end
|
||||
|
||||
config.vm.synced_folder '.', '/vagrant', disabled: true
|
||||
|
||||
$script = <<-SHELL
|
||||
sudo su
|
||||
set -ex
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates
|
||||
cd /tmp/nextcloudpi
|
||||
./build/build-SD-armbian.sh "${BOARD_ID?}" "${BOARD_NAME?}"
|
||||
mv /tmp/nextcloudpi/armbian/output/*.img /tmp/ncp-out/
|
||||
SHELL
|
||||
|
||||
# Provision the VM
|
||||
config.vm.provision "shell", inline: $script, env: {"BOARD_ID" => ENV['BOARD_ID'], "BOARD_NAME" => ENV['BOARD_NAME']}
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
config.vm.synced_folder "../..", "/tmp/nextcloudpi", type: "rsync", rsync_exclude: ["armbian", ".git", ".venv", "cache", "raspbian_root", "output", "tmp", ".idea"]
|
||||
config.vm.synced_folder "./output", "/tmp/ncp-out", type: "sshfs"
|
||||
|
||||
end
|
||||
30
build/build-SD-armbian-vagrant.sh
Executable file
30
build/build-SD-armbian-vagrant.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Batch creation of NextCloudPi Armbian based images
|
||||
#
|
||||
# Copyleft 2023 by Tobias Knöppler
|
||||
# GPL licensed (see end of file) * Use at your own risk!
|
||||
#
|
||||
# Usage: sudo ./build-SD-armbian-vagrant.sh <board_code> [<board_name>]
|
||||
#
|
||||
|
||||
[[ "$UID" == 0 ]] || {
|
||||
echo "This script needs to be run as root. Try sudo"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -ex
|
||||
export BOARD_ID="${1?}"
|
||||
export BOARD_NAME="${2:-$1}"
|
||||
vagrant plugin list | grep vagrant-libvirt || vagrant plugin install vagrant-libvirt
|
||||
vagrant plugin list | grep vagrant-sshfs || vagrant plugin install vagrant-sshfs
|
||||
export VAGRANT_DEFAULT_PROVIDER=libvirt
|
||||
|
||||
vagrant box list | grep generic/ubuntu2204 || vagrant box add --provider libvirt generic/ubuntu2204
|
||||
|
||||
cd "$(dirname "$0")/armbian"
|
||||
mkdir -p "../../output"
|
||||
trap 'echo "Cleaning up vagrant..."; vagrant halt; vagrant destroy -f' EXIT
|
||||
BOARD_ID="$BOARD_ID" BOARD_NAME="$BOARD_NAME" vagrant up --provider=libvirt
|
||||
|
||||
exit 0
|
||||
Loading…
x
Reference in New Issue
Block a user