Trivial guide for setting up cloud images (incl. Ubuntu Core) for local development in VM.
It's assumed that the images are configured to run cloud-init.
Example cloud configuration file:
| #!/usr/bin/env python3 | |
| import argparse | |
| import subprocess | |
| import os | |
| import os.path | |
| import logging | |
| import shutil | |
| import shlex |
| #!/bin/bash | |
| # naive snap replacement | |
| set -ex | |
| SNAPD_SOCKET=/run/snapd.socket | |
| CURL="${CURL:-curl}" | |
| CURL_CMD="${CURL} --unix-socket $SNAPD_SOCKET -D- -v" |
| #!/bin/bash | |
| set -eu -o pipefail | |
| if [ -n "${V:-}" ]; then | |
| set -x | |
| fi | |
| CGROUP_BASE_MOUNT=/sys/fs/cgroup | |
| CGROUPV1_MEMORY_MOUNT=/sys/fs/cgroup/memory |
| // gcc -lapparmor | |
| #include <sys/apparmor.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| char *label, *mode = NULL; | |
| if (aa_getcon(&label, &mode) == -1) { | |
| perror("aa_getcon"); |
| #!/usr/bin/env python3 | |
| import argparse | |
| import subprocess | |
| import os | |
| import os.path | |
| import logging | |
| import shutil | |
| import shlex |
| #!/bin/bash | |
| set -e | |
| if [[ -n "$D" ]]; then | |
| set -x | |
| fi | |
| ##HELP: Usage: repack-kernel <command> <opts> | |
| ##HELP: |
| #!/bin/sh | |
| set -x | |
| set -e | |
| if [ "$#" -lt 3 ]; then | |
| echo "usage: $0 <source-img> <dest-img> <uci-config>" | |
| exit 1 | |
| fi |
| #cloud-config | |
| password: fedora | |
| chpasswd: { expire: False } | |
| ssh_pwauth: True | |
| datasource_list: [ NoCloud, None ] | |
| packages: | |
| - kernel-modules | |
| - nc | |
| - strace | |
| - xdelta |