Skip to content

Instantly share code, notes, and snippets.

@dm0-
dm0- / notes.md
Created December 20, 2023 21:51
Notes on using Fedora to cross-compile Rust projects

Cross-compile Rust on Fedora

These notes will set up a cross-compiling environment for Rust projects using only prebuilt Fedora RPMs with no emulation. While this works, it is unsupported and will leave the system RPM database in an odd state that could result in packages getting out of sync. It should only be used as a temporary measure if at all.

The example commands use aarch64 as the target architecure.

Install a cross-compiling environment for GNU C

@dm0-
dm0- / README.md
Last active December 7, 2018 14:33
Automated Tectonic installer for local virtual machines

Tectonic virtual install script

This script is a Tectonic installer for local development and testing. It creates a cluster of virtual machines on the same host that runs the script. All files, processes, and any other virtual resources that are created during its execution should be automatically removed on exit.

Dependencies

The first lines in the script list every command dependency, which can be

@dm0-
dm0- / coreos-docker-update.sh
Last active April 6, 2020 17:12
Update Docker on CoreOS using torcx
#!/bin/bash -e
# Select which Docker version to use on CoreOS with torcx.
# Specify the available Docker version to enable.
version=17.09
# Create modifiable torcx paths if they don't exist already.
mkdir -p /etc/torcx/profiles /var/lib/torcx/store
# Download the torcx manifest file for the currently running OS version.
@dm0-
dm0- / test-ipsec.sh
Created March 10, 2017 00:28
Test IPSec between two containers
#!/bin/bash -ex
# Test IPSec with a tunnel between two containers.
# Provide /proc/net/pfkey since af_key.ko apparently isn't autoloaded.
sudo modprobe af_key
# Start and prepare the containers.
for host in left right
do
docker run \
@dm0-
dm0- / auto-update-kmods.ignition
Last active September 28, 2023 10:03
Automatically update custom kernel modules on CoreOS
{
"ignition": { "version": "2.0.0" },
"systemd": {
"units": [
{
"name": "auto-update-kmods.service",
"enable": true,
"contents": "[Unit]\nDescription=Install custom kernel modules\nAfter=lib-modules.mount network-online.target\nRequires=lib-modules.mount network-online.target\nConditionPathExists=!/opt/modules/%v\nConditionPathExistsGlob=/lib/modules/auto-update-kmods.d/*.sh\n\n[Service]\nType=oneshot\nExecStart=/bin/bash -ex /lib/modules/auto-update-kmods.sh\n\n[Install]\nWantedBy=multi-user.target\n"
},
{
@dm0-
dm0- / build.sh
Created October 26, 2016 23:30
Build an Azure agent ACI using CentOS 7 (WIP)
#!/bin/bash -e
# Build a CentOS system with the configuration file from CoreOS.
config_url='https://raw.githubusercontent.com/coreos/coreos-overlay/master/app-emulation/wa-linux-agent/files/waagent.conf'
mirrorlist='http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os'
mirror=$(
IFS=$'\n' urls=($(curl --location --silent "$mirrorlist"))
echo "${urls[$((RANDOM % ${#urls[@]}))]}"
)
@dm0-
dm0- / noodel.c
Created July 22, 2016 23:56
Run a program without the ability to delete files
/* cc -o noodel -lseccomp noodel.c */
#include <seccomp.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main (int argc, char *argv[])
{
scmp_filter_ctx ctx;

CoreOS Workstation Notes

This is a summary of the system setup used for the demonstration on 2016-07-18.

Goals / Requirements

This was put together with the following intent:

  • It must build upon an unmodified CoreOS user space image.
@dm0-
dm0- / user_data.yml
Created July 18, 2016 21:25
The nightmare config for a CoreOS workstation (messy, unsafe, and wildly incomplete)
#cloud-config
hostname: "set-this"
coreos:
update:
reboot-strategy: "off"
units:
- name: "default.target"
command: "start"
@dm0-
dm0- / fedora-nspawn.service
Created July 18, 2016 21:10
Sample alternate Fedora container service (incomplete, X input fails)
[Unit]
Description=Start the local Fedora installation in a container
[email protected] [email protected] \
boot.mount mnt-fedora.mount opt.mount
[email protected] [email protected]
Requires=mnt-fedora.mount
Wants=boot.mount opt.mount
[Service]
Delegate=yes