Files

86 lines
2.3 KiB
Jsonnet
Raw Permalink Normal View History

2025-08-18 00:39:03 -05:00
// For more docs, check out
// https://agama-project.github.io/docs/user/profile/dynamic
2024-11-18 18:26:48 -06:00
// This is a Jsonnet file. Please, check https://jsonnet.org/ for more
// information about the language.
// For the schema, see
// https://github.com/openSUSE/agama/blob/master/rust/agama-lib/share/profile.schema.json
// The "hw.libsonnet" file contains hardware information from the "lshw" tool.
// Agama generates this file at runtime by running (with root privileges):
//
// lshw -json
//
// There are included also helpers to search this hardware tree. To see helpers check
// "/usr/share/agama-cli/agama.libsonnet"
local agama = import 'hw.libsonnet';
// Find the biggest disk which is suitable for installing the system.
local findBiggestDisk(disks) =
local sizedDisks = std.filter(function(d) std.objectHas(d, 'size'), disks);
local sorted = std.sort(sizedDisks, function(x) -x.size);
sorted[0].logicalname;
// Find how much physical memory system has.
local memory = agama.findByID(agama.lshw, 'memory').size;
{
product: {
id: 'Leap_16.0',
},
software: {
patterns: [
],
},
user: {
fullName: 'vagrant',
userName: 'vagrant',
password: 'vagrant',
},
root: {
password: 'vagrant',
},
localization: {
language: 'en_US',
keyboard: 'us',
},
storage: {
boot: {
configure: true,
2025-04-01 17:04:21 -05:00
device: "boot",
2024-11-18 18:26:48 -06:00
},
drives: [{
search: findBiggestDisk(agama.selectByClass(agama.lshw, 'disk')),
2025-04-01 17:04:21 -05:00
alias: "boot",
2024-11-18 18:26:48 -06:00
ptableType: 'gpt',
partitions: [{
2025-04-01 17:04:21 -05:00
"search": "*",
"delete": true,
2024-11-18 18:26:48 -06:00
},{
2025-04-01 17:04:21 -05:00
"generate": "default"
}],
2024-11-18 18:26:48 -06:00
}]
},
scripts: {
post: [ {
name: 'configure-vagrant',
2025-04-01 23:47:14 -05:00
chroot: true,
2025-08-18 00:39:03 -05:00
content: |||
#!/bin/bash
2024-11-18 18:26:48 -06:00
# Configure the insecure Vagrant SSH key
mkdir -p /home/vagrant/.ssh
curl -o /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub
chown -R vagrant /home/vagrant/.ssh
chmod 600 /home/vagrant/.ssh
# Start services
systemctl enable sshd
# Configure sudo access for the vagrant user
2025-04-01 23:47:14 -05:00
cat << EOF > /etc/sudoers.d/00_vagrant
2024-11-18 18:26:48 -06:00
Defaults:vagrant !requiretty
vagrant ALL=(ALL) NOPASSWD: ALL
root ALL=(ALL) NOPASSWD: ALL
EOF
2025-08-18 00:39:03 -05:00
|||,
2024-11-18 18:26:48 -06:00
} ]
},
}