Skip to content

Instantly share code, notes, and snippets.

@ambakshi
Created July 25, 2014 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ambakshi/c99dbb553bd61731f42f to your computer and use it in GitHub Desktop.
Save ambakshi/c99dbb553bd61731f42f to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
## requires running as root because filesystem package won't install otherwise,
## giving a cryptic error about /proc, cpio, and utime. As a result, /tmp
## doesn't exist.
[ $( id -u ) -eq 0 ] || { echo "must be root"; exit 1; }
tmpdir=$( mktemp -d )
trap "echo removing ${tmpdir}; rm -rf ${tmpdir}" EXIT
febootstrap \
-u http://mirrors.mit.edu/centos/6.5/updates/x86_64/ \
-i centos-release \
-i yum \
-i iputils \
-i tar \
-i which \
-i http://mirror.pnl.gov/epel/6/i386/epel-release-6-8.noarch.rpm \
centos65 \
${tmpdir} \
http://mirrors.mit.edu/centos/6.5/os/x86_64/
febootstrap-run ${tmpdir} -- sh -c 'echo "NETWORKING=yes" > /etc/sysconfig/network'
## set timezone of container to UTC
febootstrap-run ${tmpdir} -- ln -f /usr/share/zoneinfo/Etc/UTC /etc/localtime
febootstrap-run ${tmpdir} -- yum clean all
## xz gives the smallest size by far, compared to bzip2 and gzip, by like 50%!
febootstrap-run ${tmpdir} -- tar -cf - . | xz > centos65.tar.xz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment