Skip to content

Instantly share code, notes, and snippets.

View drscream's full-sized avatar
🕶️
Focusing

Thomas Merkel drscream

🕶️
Focusing
View GitHub Profile
@drscream
drscream / bash_completion_vdz
Created July 17, 2015 09:30
Small hack and workaround to provide some small deploy zone build virtual environment on your local bash environment
# ~/.bash_completion.d/vdz
_vdz() {
local cur
local envs=$( cat ~/.dz/env.json | jq -r '.environments | keys[]' )
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "${envs} --deactivate" -- ${cur}) )
}
complete -F _vdz vdz
=> Running PRE-INSTALL script actions
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 755 -d /opt/tools/man/man5
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 755 -d /opt/tools/man/man7
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 444 pkg_summary.5 /opt/tools/man/man5/pkg_summary.5
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 444 pkg_install.conf.5 /opt/tools/man/man5/pkg_install.conf.5
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 444 pkgsrc.7 /opt/tools/man/man7/pkgsrc.7
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 755 -d /opt/tools/man/cat5
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 755 -d /opt/tools/man/cat7
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 444 pkg_summary.cat /opt/tools/man/cat5/pkg_summary.5
/tmp/pkgsrc-trunk-tools/bin/install-sh -c -o root -g root -m 444 pkg_install.conf.cat /opt/tools/man/cat5/pkg_install.conf.5
#!/usr/bin/bash
# Thomas Merkel <[email protected]>
# Script created in 5 minutes to check if a snapshot exists on
# the machine that is created with the timestamp from yesterday.
# Which datasets would we check
ADMIN_MAIL="[email protected]"
CHECK_DATASETS="
zones/2510db0b-81ef-46bc-b38e-c5ffcbe48403/data/mbox-01
"
@drscream
drscream / migrate-datasets-to-imgapi.sh
Created May 28, 2015 09:54
As most migration scripts it's ugly and run only one and thrown to trash after an successful run. Please be careful and run it in an save environment / folder. I run it on the new IMGAPI server so localhost:8080 could be used for the connection.
#!/bin/bash
# Thomas Merkel <[email protected]>
# Migrate from datasets to IMGAPI. This script is build to migrate
# from the old datasets.at server to the new Joyent IMGAPI server.
# On other scripts you find the joyent-imgapi tool. I recommend using
# the imgapi-cli because it provides the feature of basic auth to the
# IMGAPI server.
IMGAPI_CLI='/opt/local/lib/node_modules/imgapi-cli/bin/imgapi-cli'
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3NmusYmbW3vkpW0EOcQEbdOLUCu+ke1mhgi3GNKw+7te/kyHaQ45v/orag1rPwtj1YXZlcAeaNxzARUV+ykvl8wTPscvtWua1QNJONM+TPQgPDvYCFgpwBeaMx/sj2DDy4MINaA+6FnOnsqXmZNTG7EjtMxbU9AUbjpmrAm/2botA7hTLAtazx26u2dKhg92FJBL/EZmR+EqvfAa/W9w3UHERuW4hK6NLbCzkvELLeQXCSXPDdqeeJru6AydoeIlcmAqYU10fIors9235dul8317cbYUvTr8MQOidBXlXeyEfLILiAyMsOl27CK1AJUZreKMKz0v0LxmKLkNwNoiWjM+YBz4cDoqf45BXhMk9eGVAu+kmBcsZATIh+TxusL7rWy973tiFBTjDvI8THivBoPxt19oX8Smr14uajQ9ZLpCDZUpmKmXGzm3Tcgccnsju+LvSLTliDAHTnR6Go6ZhYMihircamzKkFySXn3V9hYXKZMmkByzYNkkmnTWdheLppj7A9buRghbkFtlW2T7nmAZpbqRO7MvujZqC4bbU5j6j6MuhjEr0r9iUSXkSAWjCpd673uWw+P/hav0epifQ6iMK5Fonp8FrV+dSjqUEjZzd0tawK3abqxHkIo5UjFgXsyy8Sr0podS/ztN/cUOmu+7fK70+aXV5DvJZUaEn7w== tm@havanna
#!/bin/bash
# Thomas Merkel <[email protected]>
#
# use small bash script to update customer_metadata on all machines
# from global zone. Allow to run command after update. Example used
# for new munin node IPs.
key='munin_master_allow'
value='127.0.0.1 198.51.100.1 203.0.113.200'
cmd='bash /opt/core/var/mdata-setup/includes/50-munin-node.sh && svcadm restart munin-node'
[global]
# security = share # no usable with samba4
security = user # works with samba4
map to guest = Bad User # works with samba4
load printers = no
guest account = nobody
[share]
path = /share
public = yes
#! /bin/sh -e
if [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch) patch -f --no-backup-if-mismatch -p1 < $0;;
-unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"

Use GnuPG to sign pkgsrc packages on SmartOS

I hope you have an public an private key already. If not there a lot of manuals out there who explain that very well.

Install the requirements

I would like to use gpg version 2 which supports gpg agent.

pkgin in gnupg2
#!/bin/ksh
## Disable DAD for Solaris
## http://wiki.hetzner.de/index.php/Solaris_DAD
# IPv4
/sbin/ipadm set-prop -p _arp_probe_count=0 ip
/sbin/ipadm set-prop -p _arp_fastprobe_count=0 ip
/sbin/ipadm set-prop -p _arp_defend_interval=0 ip
# IPv6
/sbin/ipadm set-prop -p _dad_announce_interval=0 ipv4