Skip to content

Instantly share code, notes, and snippets.

View AlainODea's full-sized avatar

Alain O'Dea AlainODea

View GitHub Profile
@AlainODea
AlainODea / 0001-BUGFIX-Handle-eROFS-as-permission-denied.patch
Created February 6, 2014 02:42
Patch for defect in System.Posix.fileAccess on a read-only file system.
From 5c5ea6bb96522a42634c9e803f387a617c70238e Mon Sep 17 00:00:00 2001
From: Alain O'Dea <alain.odea@verafin.com>
Date: Wed, 5 Feb 2014 21:24:28 +0000
Subject: [PATCH] BUGFIX: Handle eROFS as permission denied
---
System/Posix/Files.hsc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc
@AlainODea
AlainODea / fix_haskell_unix_package.sh
Last active August 29, 2015 13:58
Working around Cabal install getting "setup: /usr/bin/ld: permission denied" on SmartOS
#!/usr/bin/env bash
# assuming: pkgin -y install build-essential haskell-platform
git clone https://github.com/ghc/packages-unix.git
cd packages-unix/
git checkout -b smartos-fix-ghc-7.6.3 ghc-7.6.3-release
git apply ../patch-System-Posix-Files.hsc
autoreconf -i
cabal configure
cabal build
# this is an ugly hack
@AlainODea
AlainODea / ghc-builder-client.xml
Last active August 29, 2015 13:58
WIP: SMF manifest for GHC builder client (aka build slave)
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="ghc-builder-client">
<service name="site/ghc-builder-client" type="service" version="1">
<create_default_instance enabled="false" />
<single_instance />
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default' />
</dependency>
<dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
@AlainODea
AlainODea / teamcity
Created April 16, 2014 18:17
sysv init.d script for TeamCity (tested on Ubuntu)
#!/bin/bash
#
# chkconfig: 235 10 90
# description: TeamCity startup script
#
TEAMCITY_USER=teamcity
TEAMCITY_DIR=/home/teamcity/TeamCity/
TEAMCITY_SERVER=bin/teamcity-server.sh
@AlainODea
AlainODea / read-errno.d
Created May 6, 2014 01:18
DTrace syscall read(2) errno when non-zero
#!/usr/sbin/dtrace -s
syscall::read:return
/errno != 0/
{
trace(execname);
printf("errno=%d\n", errno);
ustack();
}
@AlainODea
AlainODea / read-eagain.d
Last active August 29, 2015 14:01
DTrace EAGAIN returns from read(2)
#!/usr/sbin/dtrace -s
syscall::open:entry
/arg0 != NULL/
{
self->pathptr = arg0;
self->oflag = arg1;
}
syscall::open:return
@AlainODea
AlainODea / diagnostics.md
Last active August 29, 2015 14:01
Diagnostics for EAGAIN error in GHC Builder on SmartOS
@AlainODea
AlainODea / README.md
Created May 21, 2014 04:44
Chef knife bootstrap distro template for Joyent SmartMachines

joyent-smartmachine.erb

Chef knife bootstrap distro template for Joyent SmartMachines

Usage

Place in .chef/bootstrap/ Add --distro joyent-smartmachine to your knife bootstrap command.

@AlainODea
AlainODea / Issues.md
Created June 7, 2014 21:10
Haskell builder issues WIP

EPoll is now available, but epoll.h is missing #include <sys/stdint.h>

wesolows suggested that a lofs mount would let me alter the content of that file.

I could create a corrected epoll.h and lofs mount it into my builder zones.

20140501T225642Z and 20140515T211957Z are the only affected platform images. Hopefully the next release will include a fix for this.

@AlainODea
AlainODea / install-git-annex.sh
Last active August 29, 2015 14:02
Install git-annex on SmartOS (works on base64 14.1.0)
pkgin -y update
pkgin -y full-upgrade
pkgin -y install haskell-platform build-essential pkg-config gsasl gnutls xml2 zlib
export PATH=~/.cabal/bin:$PATH
cabal update
cabal install cabal-install
cabal update
cabal install c2hs -j8
cabal install git-annex -j8
git-annex help