mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-20 18:44:25 +00:00
Added keybase vagrant box and updated the docs
This commit is contained in:
@@ -9,6 +9,7 @@ vagrant up
|
|||||||
|
|
||||||
# connect to the box
|
# connect to the box
|
||||||
vagrant ssh
|
vagrant ssh
|
||||||
|
|
||||||
# print the ssh config snippet to connect to the box
|
# print the ssh config snippet to connect to the box
|
||||||
vagrant ssh-config
|
vagrant ssh-config
|
||||||
|
|
||||||
@@ -43,43 +44,38 @@ vagrant plugin install vagrant-disksize
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. install using your package manager
|
> All commands need to be run from the box's folder.
|
||||||
1. create a box:
|
|
||||||
|
1. Install Vagrant.
|
||||||
|
1. Optionally, create a folder to keep all files in order and move into it:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
[home]$ mkdir -p "~/vagrant/archlinux"
|
mkdir test-box
|
||||||
[home]$ cd "${_}"
|
cd $_
|
||||||
[archlinux]$ vagrant init archlinux/archlinux
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. start the box:
|
1. Create a configuration:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
[archlinux]$ vagrant up
|
vagrant init archlinux/archlinux
|
||||||
|
|
||||||
# re-run provisioning
|
|
||||||
[archlinux]$ vagrant up --provision
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. connect to the machine:
|
1. Start the box:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
[archlinux]$ vagrant ssh
|
vagrant up
|
||||||
|
|
||||||
|
# re-provision the box after startup
|
||||||
|
vagrant up --provision
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install autocomplete
|
1. Connect to the machine:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ vagrant autocomplete install --bash
|
vagrant ssh
|
||||||
Autocomplete installed at paths:
|
```
|
||||||
- /home/user/.bashrc
|
|
||||||
|
|
||||||
$ vagrant autocomplete install --zsh
|
### Boxes management
|
||||||
Autocomplete installed at paths:
|
|
||||||
- /home/user/.zshrc
|
|
||||||
```
|
|
||||||
|
|
||||||
## Boxes management
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
vagrant box add archlinux/archlinux
|
vagrant box add archlinux/archlinux
|
||||||
@@ -91,16 +87,40 @@ vagrant box update
|
|||||||
vagrant box update --box generic/gentoo
|
vagrant box update --box generic/gentoo
|
||||||
```
|
```
|
||||||
|
|
||||||
## Customize VM settings
|
## Install shell's autocomplete
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ vagrant autocomplete install --bash
|
||||||
|
Autocomplete installed at paths:
|
||||||
|
- /home/user/.bashrc
|
||||||
|
|
||||||
|
$ vagrant autocomplete install --zsh
|
||||||
|
Autocomplete installed at paths:
|
||||||
|
- /home/user/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customize a box
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.box = "archlinux/archlinux"
|
config.vm.box = "archlinux/archlinux"
|
||||||
|
|
||||||
config.vm.provider "virtualbox" do |vb|
|
config.vm.provider "virtualbox" do |vb|
|
||||||
vb.memory = "3072"
|
# Vagrant can call any VBoxManage command prior to booting the machine.
|
||||||
|
# Multiple customize directives will be executed in order.
|
||||||
vb.customize ["modifyvm", :id, "--vram", "64"]
|
vb.customize ["modifyvm", :id, "--vram", "64"]
|
||||||
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
|
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
|
||||||
|
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
|
||||||
|
|
||||||
|
# Some settings have convenience shortcuts.
|
||||||
|
vb.name = "xfce4 latest"
|
||||||
|
vb.cpus = 2
|
||||||
|
vb.memory = "2048"
|
||||||
|
vb.default_nic_type = "82543GC"
|
||||||
|
vb.gui = true
|
||||||
|
|
||||||
|
# Skip the guest additions check.
|
||||||
|
vb.check_guest_additions = false
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -110,15 +130,16 @@ Add the variables as argument of the `config.vm.provision` key:
|
|||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.provision "shell", env: { "KEYBASE_USERNAME" => ENV['KEYBASE_USERNAME'], "KEYBASE_PAPERKEY" => ENV['KEYBASE_PAPERKEY'] }, inline: <<-SHELL
|
config.vm.provision :shell do |shell|
|
||||||
pacman -Sy --noconfirm --noprogressbar \
|
shell.env = {
|
||||||
fzf zsh-completions \
|
"STATIC" => "set-in-config",
|
||||||
keybase
|
"FORWARDED" => ENV['HOST_VAR'],
|
||||||
pacman -Scc --noconfirm
|
}
|
||||||
chsh --shell /bin/zsh vagrant
|
shell.inline = <<-SHELL
|
||||||
sudo --user vagrant --preserve-env=KEYBASE_USERNAME,KEYBASE_PAPERKEY keybase oneshot
|
printenv STATIC FORWARDED
|
||||||
sudo --user vagrant --preserve-env=KEYBASE_USERNAME,KEYBASE_PAPERKEY keybase git list
|
sudo -u vagrant --preserve-env=STATIC,FORWARDED printenv STATIC FORWARDED
|
||||||
SHELL
|
SHELL
|
||||||
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -138,12 +159,17 @@ vagrant.configure('2') do |config|
|
|||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reboot after provision
|
## Reboot after provisioning
|
||||||
|
|
||||||
Add this to the Vagrantfile:
|
Add one of the following to the box's Vagrantfile:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
config.vm.provision "shell", reboot: true
|
config.vm.provision "shell", reboot: true
|
||||||
|
|
||||||
|
config.vm.provision :shell do |shell|
|
||||||
|
shell.privileged = true
|
||||||
|
shell.reboot = true
|
||||||
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
## Further readings
|
## Further readings
|
||||||
|
|||||||
34
vagrant/keybase/Vagrantfile
vendored
Normal file
34
vagrant/keybase/Vagrantfile
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# -*- mode: ruby -*-
|
||||||
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
# Sources:
|
||||||
|
# - https://book.keybase.io/guides/linux
|
||||||
|
|
||||||
|
Vagrant.configure("2") do |config|
|
||||||
|
config.vm.box = "fedora/35-cloud-base"
|
||||||
|
|
||||||
|
config.vm.provider "virtualbox" do |vb|
|
||||||
|
vb.name = "keybase"
|
||||||
|
vb.cpus = 1
|
||||||
|
vb.memory = "1024"
|
||||||
|
vb.customize ["modifyvm", :id, "--vram", "64"]
|
||||||
|
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.provision :shell do |shell|
|
||||||
|
shell.env = {
|
||||||
|
"KEYBASE_ALLOW_ROOT" => 1,
|
||||||
|
"KEYBASE_DEVICENAME" => ENV['KEYBASE_DEVICENAME'],
|
||||||
|
"KEYBASE_NO_KBFS" => 0,
|
||||||
|
"KEYBASE_NO_GUI" => 1,
|
||||||
|
"KEYBASE_PAPERKEY" => ENV['KEYBASE_PAPERKEY'],
|
||||||
|
"KEYBASE_USERNAME" => ENV['KEYBASE_USERNAME'],
|
||||||
|
}
|
||||||
|
shell.inline = <<-SHELL
|
||||||
|
dnf install --assumeyes https://prerelease.keybase.io/keybase_amd64.rpm
|
||||||
|
|
||||||
|
keybase oneshot
|
||||||
|
keybase git list
|
||||||
|
SHELL
|
||||||
|
end
|
||||||
|
end
|
||||||
9
vagrant/xfce4-latest/Vagrantfile
vendored
9
vagrant/xfce4-latest/Vagrantfile
vendored
@@ -6,23 +6,22 @@ Vagrant.configure("2") do |config|
|
|||||||
|
|
||||||
config.vm.provider "virtualbox" do |vb|
|
config.vm.provider "virtualbox" do |vb|
|
||||||
vb.name = "xfce4 latest"
|
vb.name = "xfce4 latest"
|
||||||
vb.memory = "3072"
|
vb.cpus = 1
|
||||||
|
vb.memory = "2048"
|
||||||
vb.gui = true
|
vb.gui = true
|
||||||
vb.customize ["modifyvm", :id, "--vram", "64"]
|
vb.customize ["modifyvm", :id, "--vram", "64"]
|
||||||
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
|
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
|
||||||
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.provision "shell", inline: <<-SHELL
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
pacman --noconfirm \
|
pacman --noconfirm \
|
||||||
--remove --nosave --recursive --unneeded \
|
--remove --nosave --recursive --unneeded \
|
||||||
virtualbox-guest-utils-nox
|
virtualbox-guest-utils-nox
|
||||||
|
|
||||||
pacman --noconfirm \
|
pacman --noconfirm \
|
||||||
--sync --needed --noprogressbar --quiet --refresh \
|
--sync --needed --noprogressbar --quiet --refresh \
|
||||||
virtualbox-guest-utils
|
virtualbox-guest-utils
|
||||||
SHELL
|
SHELL
|
||||||
config.vm.provision "shell", path: "../../scripts/archlinux/xfce4.install.sh"
|
config.vm.provision "shell", path: "../../scripts/archlinux/xfce4.install.sh"
|
||||||
config.vm.provision "shell", inline: <<-SHELL
|
config.vm.provision "shell", reboot: true
|
||||||
shutdown -r now
|
|
||||||
SHELL
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user