Skip to content

Instantly share code, notes, and snippets.

@MerlinDMC
Created December 18, 2014 16:15
Show Gist options
  • Save MerlinDMC/0f7932d240683e15a3aa to your computer and use it in GitHub Desktop.
Save MerlinDMC/0f7932d240683e15a3aa to your computer and use it in GitHub Desktop.
setup a SmartOS zone for building pkgsrc packages
#!/bin/bash
# skip if we already have the env set up
if [[ ! -e /content/pkgsrc ]]; then
PKGSRC_REPO_URL=$(awk '{ print $2 }' FS='=' /opt/local/etc/pkg_install.conf)
PKGSRC_BRANCH=$(awk '{ print $(NF-2) }' FS='/' /opt/local/etc/pkg_install.conf)
PKGSRC_BINPKG_SITES=${PKGSRC_REPO_URL%/*}
pkgin -y in gcc47 git-base
mkdir -p /content/{distfiles,packages}
( cd /content
git clone git://github.com/joyent/pkgsrc.git
cd pkgsrc
git checkout joyent/release/${PKGSRC_BRANCH}
git submodule init
git submodule update
)
cat >> /opt/local/etc/mk.conf << EOF
#
#
DISTDIR= /content/distfiles
PACKAGES= /content/packages
WRKOBJDIR= /var/tmp/pkgsrc-build
#
ALLOW_VULNERABLE_PACKAGES= yes
SKIP_LICENSE_CHECK= yes
#
MAKE_JOBS= 8
#
FETCH_USING= curl
#
# Adjust BINPKG_SITES, depending upon the dataset chosen, it should be the URL
# from /opt/local/etc/pkgin/repositories.conf without the trailing 'All'.
#
BINPKG_SITES= ${PKGSRC_BINPKG_SITES}/
DEPENDS_TARGET= bin-install
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment