2013-09-09 21:45:40 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
DEST=$1
|
|
|
|
|
|
|
|
PKGVERSION="$VERSION"
|
|
|
|
if test -n "$(git status --porcelain)"
|
|
|
|
then
|
|
|
|
PKGVERSION="$PKGVERSION-$(date +%Y%m%d%H%M%S)-$GITCOMMIT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
PACKAGE_ARCHITECTURE="$(dpkg-architecture -qDEB_HOST_ARCH)"
|
|
|
|
PACKAGE_URL="http://www.docker.io/"
|
|
|
|
PACKAGE_MAINTAINER="docker@dotcloud.com"
|
|
|
|
PACKAGE_DESCRIPTION="lxc-docker is a Linux container runtime
|
|
|
|
Docker complements LXC with a high-level API which operates at the process
|
|
|
|
level. It runs unix processes with strong guarantees of isolation and
|
|
|
|
repeatability across servers.
|
|
|
|
Docker is a great building block for automating distributed systems:
|
|
|
|
large-scale web deployments, database clusters, continuous deployment systems,
|
|
|
|
private PaaS, service-oriented architectures, etc."
|
|
|
|
|
|
|
|
# Build docker as an ubuntu package using FPM and REPREPRO (sue me).
|
|
|
|
# bundle_binary must be called first.
|
|
|
|
bundle_ubuntu() {
|
|
|
|
DIR=$DEST/build
|
|
|
|
|
2013-10-15 11:38:02 -04:00
|
|
|
# Include our init scripts
|
|
|
|
mkdir -p $DIR/etc
|
|
|
|
cp -R contrib/init/upstart $DIR/etc/init
|
|
|
|
cp -R contrib/init/sysvinit $DIR/etc/init.d
|
|
|
|
mkdir -p $DIR/lib/systemd
|
|
|
|
cp -R contrib/init/systemd $DIR/lib/systemd/system
|
2013-09-09 21:45:40 -04:00
|
|
|
|
|
|
|
# Copy the binary
|
|
|
|
# This will fail if the binary bundle hasn't been built
|
|
|
|
mkdir -p $DIR/usr/bin
|
|
|
|
# Copy the binary
|
|
|
|
# This will fail if the binary bundle hasn't been built
|
|
|
|
cp $DEST/../binary/docker-$VERSION $DIR/usr/bin/docker
|
|
|
|
|
2013-10-15 11:38:02 -04:00
|
|
|
# Generate postinst/prerm scripts
|
|
|
|
cat >/tmp/postinst <<'EOF'
|
2013-09-09 21:45:40 -04:00
|
|
|
#!/bin/sh
|
2013-10-15 11:38:02 -04:00
|
|
|
service docker stop || true
|
|
|
|
grep -q '^docker:' /etc/group || groupadd --system docker || true
|
|
|
|
service docker start
|
2013-09-09 21:45:40 -04:00
|
|
|
EOF
|
2013-10-15 11:38:02 -04:00
|
|
|
cat >/tmp/prerm <<'EOF'
|
2013-09-09 21:45:40 -04:00
|
|
|
#!/bin/sh
|
2013-10-15 11:38:02 -04:00
|
|
|
service docker stop || true
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
purge|remove|abort-install)
|
|
|
|
groupdel docker || true
|
|
|
|
;;
|
|
|
|
|
|
|
|
upgrade|failed-upgrade|abort-upgrade)
|
|
|
|
# don't touch docker group
|
|
|
|
;;
|
|
|
|
esac
|
2013-09-09 21:45:40 -04:00
|
|
|
EOF
|
2013-10-15 11:38:02 -04:00
|
|
|
chmod +x /tmp/postinst /tmp/prerm
|
2013-09-09 21:45:40 -04:00
|
|
|
|
|
|
|
(
|
|
|
|
cd $DEST
|
|
|
|
fpm -s dir -C $DIR \
|
|
|
|
--name lxc-docker-$VERSION --version $PKGVERSION \
|
2013-10-15 11:38:02 -04:00
|
|
|
--after-install /tmp/postinst \
|
2013-09-09 21:45:40 -04:00
|
|
|
--before-remove /tmp/prerm \
|
|
|
|
--architecture "$PACKAGE_ARCHITECTURE" \
|
|
|
|
--prefix / \
|
2013-10-15 11:38:02 -04:00
|
|
|
--depends lxc \
|
|
|
|
--depends aufs-tools \
|
|
|
|
--depends iptables \
|
2013-09-09 21:45:40 -04:00
|
|
|
--description "$PACKAGE_DESCRIPTION" \
|
|
|
|
--maintainer "$PACKAGE_MAINTAINER" \
|
|
|
|
--conflicts lxc-docker-virtual-package \
|
|
|
|
--provides lxc-docker \
|
|
|
|
--provides lxc-docker-virtual-package \
|
|
|
|
--replaces lxc-docker \
|
|
|
|
--replaces lxc-docker-virtual-package \
|
|
|
|
--url "$PACKAGE_URL" \
|
|
|
|
--vendor "$PACKAGE_VENDOR" \
|
2013-09-26 16:56:59 -04:00
|
|
|
--config-files /etc/init/docker.conf \
|
2013-10-15 11:38:02 -04:00
|
|
|
--config-files /etc/init.d/docker \
|
2013-09-09 21:45:40 -04:00
|
|
|
-t deb .
|
|
|
|
mkdir empty
|
|
|
|
fpm -s dir -C empty \
|
|
|
|
--name lxc-docker --version $PKGVERSION \
|
|
|
|
--architecture "$PACKAGE_ARCHITECTURE" \
|
|
|
|
--depends lxc-docker-$VERSION \
|
|
|
|
--description "$PACKAGE_DESCRIPTION" \
|
|
|
|
--maintainer "$PACKAGE_MAINTAINER" \
|
|
|
|
--url "$PACKAGE_URL" \
|
|
|
|
--vendor "$PACKAGE_VENDOR" \
|
|
|
|
-t deb .
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
bundle_ubuntu
|