Add a few small tweaks to mkimage-debootstrap, especially to help with lucid
| ... | ... |
@@ -117,6 +117,11 @@ target="/tmp/docker-rootfs-debootstrap-$suite-$$-$RANDOM" |
| 117 | 117 |
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" |
| 118 | 118 |
returnTo="$(pwd -P)" |
| 119 | 119 |
|
| 120 |
+if [ "$suite" = 'lucid' ]; then |
|
| 121 |
+ # lucid fails and doesn't include gpgv in minbase; "apt-get update" fails |
|
| 122 |
+ include+=',gpgv' |
|
| 123 |
+fi |
|
| 124 |
+ |
|
| 120 | 125 |
set -x |
| 121 | 126 |
|
| 122 | 127 |
# bootstrap |
| ... | ... |
@@ -138,18 +143,26 @@ if [ -z "$strictDebootstrap" ]; then |
| 138 | 138 |
# shrink the image, since apt makes us fat (wheezy: ~157.5MB vs ~120MB) |
| 139 | 139 |
sudo chroot . apt-get clean |
| 140 | 140 |
|
| 141 |
- # while we're at it, apt is unnecessarily slow inside containers |
|
| 142 |
- # this forces dpkg not to call sync() after package extraction and speeds up install |
|
| 143 |
- # the benefit is huge on spinning disks, and the penalty is nonexistent on SSD or decent server virtualization |
|
| 144 |
- echo 'force-unsafe-io' | sudo tee etc/dpkg/dpkg.cfg.d/02apt-speedup > /dev/null |
|
| 145 |
- # we want to effectively run "apt-get clean" after every install to keep images small (see output of "apt-get clean -s" for context) |
|
| 141 |
+ if strings usr/bin/dpkg | grep -q unsafe-io; then |
|
| 142 |
+ # while we're at it, apt is unnecessarily slow inside containers |
|
| 143 |
+ # this forces dpkg not to call sync() after package extraction and speeds up install |
|
| 144 |
+ # the benefit is huge on spinning disks, and the penalty is nonexistent on SSD or decent server virtualization |
|
| 145 |
+ echo 'force-unsafe-io' | sudo tee etc/dpkg/dpkg.cfg.d/02apt-speedup > /dev/null |
|
| 146 |
+ # we have this wrapped up in an "if" because the "force-unsafe-io" |
|
| 147 |
+ # option was added in dpkg 1.15.8.6 |
|
| 148 |
+ # (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584254#82), |
|
| 149 |
+ # and ubuntu lucid/10.04 only has 1.15.5.6 |
|
| 150 |
+ fi |
|
| 151 |
+ |
|
| 152 |
+ # we want to effectively run "apt-get clean" after every install to keep images small (see output of "apt-get clean -s" for context) |
|
| 146 | 153 |
{
|
| 147 | 154 |
aptGetClean='"rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true";' |
| 148 | 155 |
echo "DPkg::Post-Invoke { ${aptGetClean} };"
|
| 149 | 156 |
echo "APT::Update::Post-Invoke { ${aptGetClean} };"
|
| 150 | 157 |
echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' |
| 151 | 158 |
} | sudo tee etc/apt/apt.conf.d/no-cache > /dev/null |
| 152 |
- # and remove the translations, too |
|
| 159 |
+ |
|
| 160 |
+ # and remove the translations, too |
|
| 153 | 161 |
echo 'Acquire::Languages "none";' | sudo tee etc/apt/apt.conf.d/no-languages > /dev/null |
| 154 | 162 |
|
| 155 | 163 |
# helpful undo lines for each the above tweaks (for lack of a better home to keep track of them): |
| ... | ... |
@@ -190,6 +203,9 @@ if [ -z "$strictDebootstrap" ]; then |
| 190 | 190 |
;; |
| 191 | 191 |
esac |
| 192 | 192 |
fi |
| 193 |
+ |
|
| 194 |
+ # make sure our packages lists are as up to date as we can get them |
|
| 195 |
+ sudo chroot . apt-get update |
|
| 193 | 196 |
fi |
| 194 | 197 |
|
| 195 | 198 |
if [ "$justTar" ]; then |