Skip to content

Instantly share code, notes, and snippets.

View darkmuggle's full-sized avatar
🏠
Always WFH

Ben Howard darkmuggle

🏠
Always WFH
  • Upbound.io
  • 24° 25' 12.126'' N 77° 2' 54.3948'' W
  • 21:53 (UTC -06:00)
View GitHub Profile
@darkmuggle
darkmuggle / easy_vendor-data.sh
Created September 10, 2015 15:15
Example of Cloud-init Vendor data to conditionally write a per-distro mirror configuration.
#cloud-boothook
#!/bin/sh
# Make sure that we can determine if this Ubuntu or Debian
lsbrelease="/usr/bin/lsb_release"
if [ ! -e "${lsbrelease}" ]; then
exit 0
fi
# Find out if this Ubuntu
#!/bin/bash
local_img="/tmp/squasher.qcow2"
mountpoint="/mnt/new_mnt"
url="<URL>"
bash <<EOM
mkdir -p /run/old_root
mkdir -p $mountpoint
apt-get -y update
apt-get -y install qemu-utils cloud-utils
#!/bin/bash
# Copyright 2016, DigitalOcean
# Author: Ben Howard <bh@do.co>
#
# Fetch the latest version of doctl
#
work_d=$(mktemp --directory)
trap "rm -rf ${work_d}" EXIT
# dmidecode 2.12
SMBIOS 2.4 present.
13 structures occupying 404 bytes.
Table at 0x000F18A0.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: DigitalOcean
Version: 20160425
Release Date: 04/25/2016
# These are DigitalOCean recommended settings. You can unapply them
# by removing this file and rebooting, or by using different values
# in a higher-numbered file (i.e. /etc/systctl.d/99-custom.conf)
# Set the network write/read buffers
net.core.wmem_max= 12582912
net.core.rmem_max= 12582912
net.ipv4.tcp_rmem= 10240 87380 12582912
net.ipv4.tcp_wmem= 10240 87380 12582912
# This configures the server to use the canonical IPV6 address instead of
# using the privacy extensions. Servers generally are expected to use
16:48:02
16:48:02 ++ sha256sum Fedora-Cloud-Base-24-20160607.n.0.x86_64.raw.xz
16:48:02 ++ cut -d ' ' -f 1
16:48:02 + imgsum=2d25103fa43b5dc94c70f45be3975e9fd2a3801bc5bb503aa2183660796fe2b1
16:48:02 + '[' 2d25103fa43b5dc94c70f45be3975e9fd2a3801bc5bb503aa2183660796fe2b1 '!=' 9b419360991c4044127a1c4d3d938b43d9ae247c5b5a7490fadfc295cb89347a ']'
16:48:02 + echo 'Checksum doesn'\''t match: 2d25103fa43b5dc94c70f45be3975e9fd2a3801bc5bb503aa2183660796fe2b1'
16:48:02 + exit 1
16:48:02 Checksum doesn't match: 2d25103fa43b5dc94c70f45be3975e9fd2a3801bc5bb503aa2183660796fe2b1
16:48:03 + tar --sparse -zcvf /tmp/output.tar.gz '/tmp/doimg/*'
16:48:03 tar: Removing leading `/' from member names
root@utl-89394:~# parted --script /dev/vda print
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
15 1049kB 2097kB 1049kB bios_grub
1 2097kB 42.9GB 42.9GB ext4 DOROOT
=== modified file 'cloudinit/sources/DataSourceAltCloud.py'
--- cloudinit/sources/DataSourceAltCloud.py 2016-06-16 03:03:11 +0000
+++ cloudinit/sources/DataSourceAltCloud.py 2016-08-01 20:22:09 +0000
@@ -110,12 +110,6 @@
'''
- uname_arch = os.uname()[4]
- if uname_arch.startswith("arm") or uname_arch == "aarch64":
- # Disabling because dmi data is not available on ARM processors
#cloud-boothook
#!/bin/sh
# See the random number generator
base64 -d <STRING> \
> /dev/urandom
### Keybase proof
I hereby claim:
* I am utlemming on github.
* I am darkmuggle (https://keybase.io/darkmuggle) on keybase.
* I have a public key ASBnfQG4JC7A07EgobqxU4KqR_80oTZ2feBTYjWpzs558wo
To claim this, I am signing this object: