mirror of
https://github.com/Retropex/raspiblitz.git
synced 2025-05-12 19:20:48 +02:00
Vagrant: Updates for MacOS & Packer >1.6.0 (#1657)
This commit is contained in:
parent
6fd28477b3
commit
4e0b4f1675
10
Vagrantfile
vendored
10
Vagrantfile
vendored
@ -1,24 +1,20 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# in order to attach a secondary disk we need to enable vagrant disk experimental feature
|
||||
if ENV['VAGRANT_EXPERIMENTAL'] != 'disks'
|
||||
ENV['VAGRANT_EXPERIMENTAL'] = 'disks'
|
||||
end
|
||||
|
||||
Vagrant.configure('2') do |config|
|
||||
|
||||
config.vm.box = 'raspiblitz'
|
||||
|
||||
config.vm.network "private_network", type: "dhcp"
|
||||
|
||||
config.ssh.username = 'admin'
|
||||
config.ssh.password = 'raspiblitz'
|
||||
config.ssh.insert_key = true
|
||||
|
||||
config.vm.disk :disk, size: '16GB', primary: true
|
||||
config.vm.disk :disk, size: '500GB', name: 'external_disk'
|
||||
|
||||
config.vm.provider 'virtualbox' do |vb, override|
|
||||
vb.memory = 2048
|
||||
vb.customize ['modifyvm', :id, '--usbxhci', 'on']
|
||||
end
|
||||
|
||||
config.vm.provision 'shell',
|
||||
|
@ -6,7 +6,13 @@ This guide was tested on vagrant
|
||||
|
||||
This feature is very experimental and not supported.
|
||||
|
||||
In order to run raspiblitz on `vagrant` you need `packer` to build the base box.
|
||||
In order to run raspiblitz on `vagrant` you need `packer` (>=1.6.0) to build the base box.
|
||||
|
||||
On MacOS you need to install:
|
||||
1. brew: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"`
|
||||
2. packer: `brew install packer`
|
||||
3. vagrant: `brew install vagrant`
|
||||
4. virtualbox: `brew cask install virtualbox` (maybe re-run after you changed the requested secruity permission to be successfull)
|
||||
|
||||
```sha
|
||||
cd alternative.platforms/amd64/packer
|
||||
@ -18,6 +24,12 @@ cd ../../..
|
||||
|
||||
With the base box built, you can start a development environment with `vagrant up` and login with `vagrant ssh`.
|
||||
|
||||
You will need to connect a virtual data drive to the RaspiBlitzVM ... todo so:
|
||||
- make sure VM is stopped: use command `off` when within VM or from outside `vagrant halt`
|
||||
- no open the VirtualBox Manager GUI and use `change` on the RaspiBlitzVM
|
||||
- Go to the `mass storage` section and add a second disc as `primary slave` to the already existing controller
|
||||
- create a new dynamic VDI with around 900GB .. choose as storage path for the VDI an external drive if you dont have that much space on your laptop.
|
||||
- now start the VM again with `vagrant up` and `vagrangt ssh` to run thru the setup process
|
||||
|
||||
**Note**
|
||||
|
||||
|
@ -1,60 +1,72 @@
|
||||
{
|
||||
"variables": {
|
||||
"iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.5.0-amd64-netinst.iso",
|
||||
"iso_checksum_type": "sha256",
|
||||
"iso_checksum": "93863e17ac24eeaa347dfb91dddac654f214c189e0379d7c28664a306e0301e7",
|
||||
"branch": "dev",
|
||||
"github_user": "rootzoll"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"type": "virtualbox-iso",
|
||||
"boot_command": [
|
||||
"<esc><wait>",
|
||||
"auto ",
|
||||
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
|
||||
"<enter>"
|
||||
"builders": [
|
||||
{
|
||||
"boot_command": [
|
||||
"<esc><wait>",
|
||||
"auto ",
|
||||
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
|
||||
"<enter>"
|
||||
],
|
||||
"boot_wait": "5s",
|
||||
"disk_size": "16384",
|
||||
"guest_os_type": "Debian_64",
|
||||
"headless": false,
|
||||
"http_directory": "http",
|
||||
"iso_checksum": "{{ user `iso_checksum_type` }}:{{ user `iso_checksum` }}",
|
||||
"iso_url": "{{ user `iso_url` }}",
|
||||
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
|
||||
"ssh_password": "vagrant",
|
||||
"ssh_port": 22,
|
||||
"ssh_timeout": "30m",
|
||||
"ssh_username": "vagrant",
|
||||
"type": "virtualbox-iso",
|
||||
"vboxmanage": [
|
||||
[
|
||||
"modifyvm",
|
||||
"{{.Name}}",
|
||||
"--memory",
|
||||
"1024"
|
||||
],
|
||||
"boot_wait": "5s",
|
||||
"disk_size": "16384",
|
||||
"headless": false,
|
||||
"guest_os_type": "Debian_64",
|
||||
"http_directory": "http",
|
||||
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
|
||||
"iso_checksum": "{{ user `iso_checksum` }}",
|
||||
"iso_url": "{{ user `iso_url` }}",
|
||||
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
|
||||
"ssh_password": "vagrant",
|
||||
"ssh_port": 22,
|
||||
"ssh_username": "vagrant",
|
||||
"ssh_timeout": "30m",
|
||||
"vm_name": "raspiblitz-amd64",
|
||||
"vboxmanage": [
|
||||
["modifyvm", "{{.Name}}", "--memory", "1024"],
|
||||
["modifyvm", "{{.Name}}", "--cpus", "1"]
|
||||
[
|
||||
"modifyvm",
|
||||
"{{.Name}}",
|
||||
"--cpus",
|
||||
"1"
|
||||
]
|
||||
}
|
||||
],
|
||||
"vm_name": "raspiblitz-amd64"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/init.sh",
|
||||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "../../../build_sdcard.sh",
|
||||
"execute_command": "echo 'yes' | {{.Vars}} bash '{{.Path}}' {{ user `branch` }} {{ user `github_user` }} /dev/sda1 false false"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/cleanup.sh",
|
||||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'"
|
||||
}
|
||||
],
|
||||
"post-processors": [{
|
||||
"type": "vagrant",
|
||||
"post-processors": [
|
||||
{
|
||||
"compression_level": "8",
|
||||
"output": "output/raspiblitz.box"
|
||||
}]
|
||||
"output": "output/raspiblitz.box",
|
||||
"type": "vagrant"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
|
||||
"script": "scripts/init.sh",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"execute_command": "echo 'yes' | {{.Vars}} bash '{{.Path}}' {{ user `branch` }} {{ user `github_user` }} /dev/sda1 false false",
|
||||
"script": "../../../build_sdcard.sh",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
|
||||
"script": "scripts/cleanup.sh",
|
||||
"type": "shell"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"branch": "dev",
|
||||
"github_user": "rootzoll",
|
||||
"iso_checksum": "2af8f43d4a7ab852151a7f630ba596572213e17d3579400b5648eba4cc974ed0",
|
||||
"iso_checksum_type": "sha256",
|
||||
"iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.6.0-amd64-netinst.iso"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,14 +4,6 @@ set -e
|
||||
|
||||
echo "************* Vagrant provisioning ********************"
|
||||
|
||||
|
||||
if ! [ -e /dev/sdb1 ]; then
|
||||
echo 'Data drive partitioning'
|
||||
|
||||
echo 'type=83' | sudo sfdisk /dev/sdb
|
||||
fi
|
||||
|
||||
|
||||
echo 'linking development files'
|
||||
source_dir=/vagrant/home.admin
|
||||
dest_dir=$HOME
|
||||
|
@ -28,9 +28,14 @@ esac
|
||||
if [ "${setupStep}" = "100" ]; then
|
||||
# make sure services are not running
|
||||
echo "stopping services ..."
|
||||
sudo systemctl stop background
|
||||
sudo systemctl stop lnd
|
||||
sudo systemctl stop bitcoind
|
||||
sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf
|
||||
else
|
||||
# make sure bitcoind is not running
|
||||
sudo systemctl stop background <2 /dev/null
|
||||
sudo systemctl stop bitcoind <2 /dev/null
|
||||
fi
|
||||
|
||||
# check if old blockchain data exists
|
||||
|
@ -81,7 +81,8 @@ if [ "$1" = "status" ]; then
|
||||
# find the HDD (biggest single partition)
|
||||
hdd=""
|
||||
sizeDataPartition=0
|
||||
OSPartition=$(sudo df /usr | grep dev | cut -d " " -f 1)
|
||||
OSPartition=$(sudo df /usr | grep dev | cut -d " " -f 1 | sed "s/\/dev\///g")
|
||||
#echo "# OSPartition(${OSPartition})"
|
||||
|
||||
lsblk -o NAME,SIZE -b | grep -P "[s|v]d[a-z][0-9]?" > .lsblk.tmp
|
||||
while read line; do
|
||||
@ -104,8 +105,8 @@ if [ "$1" = "status" ]; then
|
||||
testpartitioncount=$((testpartitioncount-1))
|
||||
|
||||
if [ $testpartitioncount -gt 0 ]; then
|
||||
# if a partition was found - make sure to skip OS partition
|
||||
if [ "$testpartition" != "$OSPartition" ]; then
|
||||
# if a partition was found - make sure to skip OS partition & if <=32gb
|
||||
if [ "$testpartition" != "$OSPartition" ] && [ ${testsize} -gt 32900000000 ]; then
|
||||
|
||||
# make sure to use the biggest
|
||||
if [ ${testsize} -gt ${sizeDataPartition} ]; then
|
||||
@ -115,8 +116,8 @@ if [ "$1" = "status" ]; then
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Partion to be created is smaller than disk so this is not correct (but close)
|
||||
sizeDataPartition=$(sudo fdisk -l /dev/$testdevice | grep GiB | cut -d " " -f 5)
|
||||
# Partion to be created is smaller than disk so this is not correct (but close)
|
||||
sizeDataPartition=$(sudo fdisk -l /dev/$testdevice | grep GiB | cut -d " " -f 5)
|
||||
hddDataPartition="${testdevice}1"
|
||||
hdd="${testdevice}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user