From 53e2e8209fd882a3b4f073ce30dec444cc9c7cc0 Mon Sep 17 00:00:00 2001 From: jpetazzo Date: Mon, 11 Mar 2013 19:03:22 -0700 Subject: [PATCH 1/6] Add missing shebang cloud-init expects a shebang in the beginning of the script --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index af5c214d78..52cd3c0a08 100644 --- a/install.sh +++ b/install.sh @@ -1,4 +1,5 @@ -# This script is meant for quick & easy install via 'curl URL-OF-SCRIPPT | bash' +#!/bin/sh +# This script is meant for quick & easy install via 'curl URL-OF-SCRIPT | bash' # Courtesy of Jeff Lindsay cd /tmp From af2aac8736d71fe79492f9abf3a16fba97857eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Mon, 11 Mar 2013 23:07:16 -0700 Subject: [PATCH 2/6] Stream and unpack the tarball on the fly We don't need temporary files. Also, get the tarball from get.docker.io instead of Dropbox. --- install.sh | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/install.sh b/install.sh index 52cd3c0a08..2ecb8b47ae 100644 --- a/install.sh +++ b/install.sh @@ -2,18 +2,13 @@ # This script is meant for quick & easy install via 'curl URL-OF-SCRIPT | bash' # Courtesy of Jeff Lindsay -cd /tmp - echo "Ensuring dependencies are installed..." apt-get --yes install lxc wget bsdtar 2>&1 > /dev/null -echo "Downloading docker binary..." -wget -q https://dl.dropbox.com/u/20637798/docker.tar.gz 2>&1 > /dev/null -tar -xf docker.tar.gz 2>&1 > /dev/null - -echo "Installing into /usr/local/bin..." -mv docker/docker /usr/local/bin -mv dockerd/dockerd /usr/local/bin +echo "Downloading docker binary and uncompressing into /usr/local/bin..." +curl -s http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz | +tar -C /usr/local/bin --strip-components=1 -zxf- \ +docker-master/docker docker-master/dockerd if [[ -f /etc/init/dockerd.conf ]] then @@ -26,10 +21,5 @@ fi echo "Restarting dockerd..." restart dockerd > /dev/null -echo "Cleaning up..." -rmdir docker -rmdir dockerd -rm docker.tar.gz - echo "Finished!" echo From fda456b82e51224fe4e7ae6c0bc2b0f0812729ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Mon, 11 Mar 2013 23:08:21 -0700 Subject: [PATCH 3/6] Use "start" instead of "restart" Because when the job isn't running, "restart" won't work. --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 2ecb8b47ae..43e8ecce1e 100644 --- a/install.sh +++ b/install.sh @@ -18,8 +18,8 @@ else echo "exec /usr/local/bin/dockerd" > /etc/init/dockerd.conf fi -echo "Restarting dockerd..." -restart dockerd > /dev/null +echo "Starting dockerd..." +start dockerd > /dev/null echo "Finished!" echo From c1fa4efad66a1ae8cbccd7c55bc195be03d94b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Mon, 11 Mar 2013 23:09:19 -0700 Subject: [PATCH 4/6] Try to load, or install, AUFS modules When running precise or quantal, installing the matching -extra kernel will install the required file. --- install.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 43e8ecce1e..4e592e5dcf 100644 --- a/install.sh +++ b/install.sh @@ -2,8 +2,34 @@ # This script is meant for quick & easy install via 'curl URL-OF-SCRIPT | bash' # Courtesy of Jeff Lindsay -echo "Ensuring dependencies are installed..." -apt-get --yes install lxc wget bsdtar 2>&1 > /dev/null +echo "Ensuring basic dependencies are installed..." +apt-get -qq update +apt-get -qq install lxc wget bsdtar + +echo "Looking in /proc/filesystems to see if we have AUFS support..." +if grep -q aufs /proc/filesystems +then + echo "Found." +else + echo "Ahem, it looks like the current kernel does not support AUFS." + echo "Let's see if we can load the AUFS module with modprobe..." + if modprobe aufs + then + echo "Module loaded." + else + echo "Ahem, things didn't turn out as expected." + KPKG=linux-image-extra-$(uname -r) + echo "Trying to install $KPKG..." + if apt-get -qq install $KPKG + then + echo "Installed." + else + echo "Oops, we couldn't install the -extra kernel." + echo "Are you sure you are running a supported version of Ubuntu?" + echo "Proceeding anyway, but Docker will probably NOT WORK!" + fi + fi +fi echo "Downloading docker binary and uncompressing into /usr/local/bin..." curl -s http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz | From f90f6a0b9248489c43188ca79b9e0dfc306fd8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Mon, 11 Mar 2013 23:13:08 -0700 Subject: [PATCH 5/6] Get rid of bashism --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 4e592e5dcf..f8dca17476 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -# This script is meant for quick & easy install via 'curl URL-OF-SCRIPT | bash' +# This script is meant for quick & easy install via 'curl URL-OF-SCRIPT | sh' # Courtesy of Jeff Lindsay echo "Ensuring basic dependencies are installed..." @@ -36,7 +36,7 @@ curl -s http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz | tar -C /usr/local/bin --strip-components=1 -zxf- \ docker-master/docker docker-master/dockerd -if [[ -f /etc/init/dockerd.conf ]] +if [ -f /etc/init/dockerd.conf ] then echo "Upstart script already exists." else From b728c1a81fbb441442d635788e814d47436c613f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Mon, 11 Mar 2013 23:37:38 -0700 Subject: [PATCH 6/6] Add script upload instructions --- install.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index f8dca17476..0cfba4ddc3 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,10 @@ #!/bin/sh # This script is meant for quick & easy install via 'curl URL-OF-SCRIPT | sh' -# Courtesy of Jeff Lindsay +# Original version by Jeff Lindsay +# Revamped by Jerome Petazzoni +# +# This script canonical location is http://get.docker.io/; to update it, run: +# s3cmd put -m text/x-shellscript -P install.sh s3://get.docker.io/index echo "Ensuring basic dependencies are installed..." apt-get -qq update @@ -47,5 +51,5 @@ fi echo "Starting dockerd..." start dockerd > /dev/null -echo "Finished!" +echo "Done." echo