Skip to content

Instantly share code, notes, and snippets.

View bdrewery's full-sized avatar

Bryan Drewery bdrewery

  • Seattle, Washington
View GitHub Profile
#! /bin/sh
. ${SCRIPTSDIR}/functions.sh
MOVE_FILES=$(mktemp -t tar_files)
PLIST_FILES=$(mktemp -t plist_files)
PLIST_DIRS=/dev/null
SED_FILE=$(mktemp -t sed_file)
PARSE_COMMENTS=1
parse_plist "${PREFIX}" ${PARSE_COMMENTS} < "${TMPPLIST}" 3>${PLIST_DIRS} \
@bdrewery
bdrewery / convert.sh
Created April 12, 2014 02:55
pkg_install conversion script
#! /bin/sh
#
# Copyright (c) 2014 Bryan Drewery <bdrewery@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@bdrewery
bdrewery / mfc.sh
Last active June 25, 2018 12:57
FreeBSD MFC script
#! /bin/sh
#
# Copyright (c) 2014 Bryan Drewery <bdrewery@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.

Keybase proof

I hereby claim:

  • I am bdrewery on github.
  • I am bdrewery (https://keybase.io/bdrewery) on keybase.
  • I have a public key whose fingerprint is F917 3CB2 C3AA EA7A 5C8A 1F09 35D7 71BB 6E46 97CF

To claim this, I am signing this object:

@bdrewery
bdrewery / bulk.sh
Last active July 6, 2018 17:37
Hook to upload packages to S3 after bulk is successful.
#! /bin/sh
#
# Copyright (c) 2013-2014 Bryan Drewery <bdrewery@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@bdrewery
bdrewery / poudriere-irc.sh
Last active October 19, 2018 09:53
IRC bot written in POSIX Shell using netcat
#! /bin/sh
#
# Copyright (c) 2013 Bryan Drewery <bdrewery@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@bdrewery
bdrewery / gist:6479394
Last active December 22, 2015 13:29
Poudriere atomic repository updating

This allows for atomic package repository updates and dry-runs. It will allow the repository to be usable during a package build session without a wrapper to do symlinks with latest or clones etc.

  1. On first build, repository is converted to symlinked structure
  2. On build startup, all of .real is hardlink-copied to .shadow
  3. Package building treats .shadow as the PACKAGES directory
  4. Because the top-level files and directories are symlinked to .real, the build leaves all existing files alone during the build. Hardlinks are safe as package building only overwrites. The repo files are explicitly copied to prevent accidental incremental updates to the production repo.
  5. Once build completes, the top-level .shadow is renamed to .real_TIMESTAMP and the .current symlink is atomically moved to the new package directory.

View during build

@bdrewery
bdrewery / be-upgrade.sh
Last active December 17, 2015 22:49
FreeBSD beadm upgrade script (requires sysutils/beadm)
#! /bin/sh
#
# Copyright (c) 2013 Bryan Drewery <bryan@shatow.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
devel/svn2git git-1.8.0.2
ports-mgmt/portshaker git-1.8.0.2
shells/bash-completion bash-static-4.2.37
www/wgetpaste bash-static-4.2.37
local/base-meta bash-static-4.2.37
local/base-meta git-1.8.0.2
local/bootstrap-meta bash-static-4.2.37
local/bootstrap-meta git-1.8.0.2
local/dev-meta git-1.8.0.2
local/dev-ports-meta git-1.8.0.2
@bdrewery
bdrewery / build.sh
Created October 15, 2012 17:31
My poudriere build script
#! /bin/sh
[ ${_FLOCKED:-0} -eq 0 ] && _FLOCKED=1 exec lockf -s -t0 /tmp/${0##*/}.lock $0 "$@" # Lock so it can only run once
which screen>/dev/null 2>&1 && test -z "${STY}" && exec screen -h 10000 -S ${0##*/} $0 "$@" # Ensure running in a screen
# Ensure the latest poudriere-devel is installed
portsnap fetch update
make -C /usr/ports/ports-mgmt/poudriere-devel/ build deinstall install clean > /dev/null
# Update poudriere ports checkout, and copy in my changes
poudriere ports -u -p default