浏览代码

Merge pull request #33776 from thaJeztah/remove-deprecated-mkimage

Remove deprecated contrib/mkimage-xyz scripts
Sebastiaan van Stijn 8 年之前
父节点
当前提交
5f0062f0fa
共有 3 个文件被更改,包括 0 次插入463 次删除
  1. 0 43
      contrib/mkimage-busybox.sh
  2. 0 297
      contrib/mkimage-debootstrap.sh
  3. 0 123
      contrib/mkimage-rinse.sh

+ 0 - 43
contrib/mkimage-busybox.sh

@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-# Generate a very minimal filesystem based on busybox-static,
-# and load it into the local docker under the name "busybox".
-
-echo >&2
-echo >&2 'warning: this script is deprecated - see mkimage.sh and mkimage/busybox-static'
-echo >&2
-
-BUSYBOX=$(which busybox)
-[ "$BUSYBOX" ] || {
-    echo "Sorry, I could not locate busybox."
-    echo "Try 'apt-get install busybox-static'?"
-    exit 1
-}
-
-set -e
-ROOTFS=${TMPDIR:-/var/tmp}/rootfs-busybox-$$-$RANDOM
-mkdir $ROOTFS
-cd $ROOTFS
-
-mkdir bin etc dev dev/pts lib proc sys tmp
-touch etc/resolv.conf
-cp /etc/nsswitch.conf etc/nsswitch.conf
-echo root:x:0:0:root:/:/bin/sh > etc/passwd
-echo root:x:0: > etc/group
-ln -s lib lib64
-ln -s bin sbin
-cp $BUSYBOX bin
-for X in $(busybox --list)
-do
-    ln -s busybox bin/$X
-done
-rm bin/init
-ln bin/busybox bin/init
-cp /lib/x86_64-linux-gnu/lib{pthread,c,dl,nsl,nss_*}.so.* lib
-cp /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 lib
-for X in console null ptmx random stdin stdout stderr tty urandom zero
-do
-    cp -a /dev/$X dev
-done
-
-tar --numeric-owner -cf- . | docker import - busybox
-docker run -i -u root busybox /bin/echo Success.

+ 0 - 297
contrib/mkimage-debootstrap.sh

@@ -1,297 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-echo >&2
-echo >&2 'warning: this script is deprecated - see mkimage.sh and mkimage/debootstrap'
-echo >&2
-
-variant='minbase'
-include='iproute,iputils-ping'
-arch='amd64' # intentionally undocumented for now
-skipDetection=
-strictDebootstrap=
-justTar=
-
-usage() {
-	echo >&2
-
-	echo >&2 "usage: $0 [options] repo suite [mirror]"
-
-	echo >&2
-	echo >&2 'options: (not recommended)'
-	echo >&2 "  -p set an http_proxy for debootstrap"
-	echo >&2 "  -v $variant # change default debootstrap variant"
-	echo >&2 "  -i $include # change default package includes"
-	echo >&2 "  -d # strict debootstrap (do not apply any docker-specific tweaks)"
-	echo >&2 "  -s # skip version detection and tagging (ie, precise also tagged as 12.04)"
-	echo >&2 "     # note that this will also skip adding universe and/or security/updates to sources.list"
-	echo >&2 "  -t # just create a tarball, especially for dockerbrew (uses repo as tarball name)"
-
-	echo >&2
-	echo >&2 "   ie: $0 username/debian squeeze"
-	echo >&2 "       $0 username/debian squeeze http://ftp.uk.debian.org/debian/"
-
-	echo >&2
-	echo >&2 "   ie: $0 username/ubuntu precise"
-	echo >&2 "       $0 username/ubuntu precise http://mirrors.melbourne.co.uk/ubuntu/"
-
-	echo >&2
-	echo >&2 "   ie: $0 -t precise.tar.bz2 precise"
-	echo >&2 "       $0 -t wheezy.tgz wheezy"
-	echo >&2 "       $0 -t wheezy-uk.tar.xz wheezy http://ftp.uk.debian.org/debian/"
-
-	echo >&2
-}
-
-# these should match the names found at http://www.debian.org/releases/
-debianStable=wheezy
-debianUnstable=sid
-# this should match the name found at http://releases.ubuntu.com/
-ubuntuLatestLTS=trusty
-# this should match the name found at http://releases.tanglu.org/
-tangluLatest=aequorea
-
-while getopts v:i:a:p:dst name; do
-	case "$name" in
-		p)
-			http_proxy="$OPTARG"
-			;;
-		v)
-			variant="$OPTARG"
-			;;
-		i)
-			include="$OPTARG"
-			;;
-		a)
-			arch="$OPTARG"
-			;;
-		d)
-			strictDebootstrap=1
-			;;
-		s)
-			skipDetection=1
-			;;
-		t)
-			justTar=1
-			;;
-		?)
-			usage
-			exit 0
-			;;
-	esac
-done
-shift $(($OPTIND - 1))
-
-repo="$1"
-suite="$2"
-mirror="${3:-}" # stick to the default debootstrap mirror if one is not provided
-
-if [ ! "$repo" ] || [ ! "$suite" ]; then
-	usage
-	exit 1
-fi
-
-# some rudimentary detection for whether we need to "sudo" our docker calls
-docker=''
-if docker version > /dev/null 2>&1; then
-	docker='docker'
-elif sudo docker version > /dev/null 2>&1; then
-	docker='sudo docker'
-elif command -v docker > /dev/null 2>&1; then
-	docker='docker'
-else
-	echo >&2 "warning: either docker isn't installed, or your current user cannot run it;"
-	echo >&2 "         this script is not likely to work as expected"
-	sleep 3
-	docker='docker' # give us a command-not-found later
-fi
-
-# make sure we have an absolute path to our final tarball so we can still reference it properly after we change directory
-if [ "$justTar" ]; then
-	if [ ! -d "$(dirname "$repo")" ]; then
-		echo >&2 "error: $(dirname "$repo") does not exist"
-		exit 1
-	fi
-	repo="$(cd "$(dirname "$repo")" && pwd -P)/$(basename "$repo")"
-fi
-
-# will be filled in later, if [ -z "$skipDetection" ]
-lsbDist=''
-
-target="${TMPDIR:-/var/tmp}/docker-rootfs-debootstrap-$suite-$$-$RANDOM"
-
-cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
-returnTo="$(pwd -P)"
-
-if [ "$suite" = 'lucid' ]; then
-	# lucid fails and doesn't include gpgv in minbase; "apt-get update" fails
-	include+=',gpgv'
-fi
-
-set -x
-
-# bootstrap
-mkdir -p "$target"
-sudo http_proxy=$http_proxy debootstrap --verbose --variant="$variant" --include="$include" --arch="$arch" "$suite" "$target" "$mirror"
-
-cd "$target"
-
-if [ -z "$strictDebootstrap" ]; then
-	# prevent init scripts from running during install/update
-	#  policy-rc.d (for most scripts)
-	echo $'#!/bin/sh\nexit 101' | sudo tee usr/sbin/policy-rc.d > /dev/null
-	sudo chmod +x usr/sbin/policy-rc.d
-	#  initctl (for some pesky upstart scripts)
-	sudo chroot . dpkg-divert --local --rename --add /sbin/initctl
-	sudo ln -sf /bin/true sbin/initctl
-	# see https://github.com/docker/docker/issues/446#issuecomment-16953173
-
-	# shrink the image, since apt makes us fat (wheezy: ~157.5MB vs ~120MB)
-	sudo chroot . apt-get clean
-
-	if strings usr/bin/dpkg | grep -q unsafe-io; then
-		# while we're at it, apt is unnecessarily slow inside containers
-		#  this forces dpkg not to call sync() after package extraction and speeds up install
-		#    the benefit is huge on spinning disks, and the penalty is nonexistent on SSD or decent server virtualization
-		echo 'force-unsafe-io' | sudo tee etc/dpkg/dpkg.cfg.d/02apt-speedup > /dev/null
-		# we have this wrapped up in an "if" because the "force-unsafe-io"
-		# option was added in dpkg 1.15.8.6
-		# (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584254#82),
-		# and ubuntu lucid/10.04 only has 1.15.5.6
-	fi
-
-	# we want to effectively run "apt-get clean" after every install to keep images small (see output of "apt-get clean -s" for context)
-	{
-		aptGetClean='"rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true";'
-		echo "DPkg::Post-Invoke { ${aptGetClean} };"
-		echo "APT::Update::Post-Invoke { ${aptGetClean} };"
-		echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";'
-	} | sudo tee etc/apt/apt.conf.d/no-cache > /dev/null
-
-	# and remove the translations, too
-	echo 'Acquire::Languages "none";' | sudo tee etc/apt/apt.conf.d/no-languages > /dev/null
-
-	# helpful undo lines for each the above tweaks (for lack of a better home to keep track of them):
-	#  rm /usr/sbin/policy-rc.d
-	#  rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl
-	#  rm /etc/dpkg/dpkg.cfg.d/02apt-speedup
-	#  rm /etc/apt/apt.conf.d/no-cache
-	#  rm /etc/apt/apt.conf.d/no-languages
-
-	if [ -z "$skipDetection" ]; then
-		# see also rudimentary platform detection in hack/install.sh
-		lsbDist=''
-		if [ -r etc/lsb-release ]; then
-			lsbDist="$(. etc/lsb-release && echo "$DISTRIB_ID")"
-		fi
-		if [ -z "$lsbDist" ] && [ -r etc/debian_version ]; then
-			lsbDist='Debian'
-		fi
-
-		case "$lsbDist" in
-			Debian)
-				# add the updates and security repositories
-				if [ "$suite" != "$debianUnstable" -a "$suite" != 'unstable' ]; then
-					# ${suite}-updates only applies to non-unstable
-					sudo sed -i "p; s/ $suite main$/ ${suite}-updates main/" etc/apt/sources.list
-
-					# same for security updates
-					echo "deb http://security.debian.org/ $suite/updates main" | sudo tee -a etc/apt/sources.list > /dev/null
-				fi
-				;;
-			Ubuntu)
-				# add the universe, updates, and security repositories
-				sudo sed -i "
-					s/ $suite main$/ $suite main universe/; p;
-					s/ $suite main/ ${suite}-updates main/; p;
-					s/ $suite-updates main/ ${suite}-security main/
-				" etc/apt/sources.list
-				;;
-			Tanglu)
-				# add the updates repository
-				if [ "$suite" = "$tangluLatest" ]; then
-					# ${suite}-updates only applies to stable Tanglu versions
-					sudo sed -i "p; s/ $suite main$/ ${suite}-updates main/" etc/apt/sources.list
-				fi
-				;;
-			SteamOS)
-				# add contrib and non-free
-				sudo sed -i "s/ $suite main$/ $suite main contrib non-free/" etc/apt/sources.list
-				;;
-		esac
-	fi
-
-	# make sure our packages lists are as up to date as we can get them
-	sudo chroot . apt-get update
-	sudo chroot . apt-get dist-upgrade -y
-fi
-
-if [ "$justTar" ]; then
-	# create the tarball file so it has the right permissions (ie, not root)
-	touch "$repo"
-
-	# fill the tarball
-	sudo tar --numeric-owner -caf "$repo" .
-else
-	# create the image (and tag $repo:$suite)
-	sudo tar --numeric-owner -c . | $docker import - $repo:$suite
-
-	# test the image
-	$docker run -i -t $repo:$suite echo success
-
-	if [ -z "$skipDetection" ]; then
-		case "$lsbDist" in
-			Debian)
-				if [ "$suite" = "$debianStable" -o "$suite" = 'stable' ] && [ -r etc/debian_version ]; then
-					# tag latest
-					$docker tag $repo:$suite $repo:latest
-
-					if [ -r etc/debian_version ]; then
-						# tag the specific debian release version (which is only reasonable to tag on debian stable)
-						ver=$(cat etc/debian_version)
-						$docker tag $repo:$suite $repo:$ver
-					fi
-				fi
-				;;
-			Ubuntu)
-				if [ "$suite" = "$ubuntuLatestLTS" ]; then
-					# tag latest
-					$docker tag $repo:$suite $repo:latest
-				fi
-				if [ -r etc/lsb-release ]; then
-					lsbRelease="$(. etc/lsb-release && echo "$DISTRIB_RELEASE")"
-					if [ "$lsbRelease" ]; then
-						# tag specific Ubuntu version number, if available (12.04, etc.)
-						$docker tag $repo:$suite $repo:$lsbRelease
-					fi
-				fi
-				;;
-			Tanglu)
-				if [ "$suite" = "$tangluLatest" ]; then
-					# tag latest
-					$docker tag $repo:$suite $repo:latest
-				fi
-				if [ -r etc/lsb-release ]; then
-					lsbRelease="$(. etc/lsb-release && echo "$DISTRIB_RELEASE")"
-					if [ "$lsbRelease" ]; then
-						# tag specific Tanglu version number, if available (1.0, 2.0, etc.)
-						$docker tag $repo:$suite $repo:$lsbRelease
-					fi
-				fi
-				;;
-			SteamOS)
-				if [ -r etc/lsb-release ]; then
-					lsbRelease="$(. etc/lsb-release && echo "$DISTRIB_RELEASE")"
-					if [ "$lsbRelease" ]; then
-						# tag specific SteamOS version number, if available (1.0, 2.0, etc.)
-						$docker tag $repo:$suite $repo:$lsbRelease
-					fi
-				fi
-				;;
-		esac
-	fi
-fi
-
-# cleanup
-cd "$returnTo"
-sudo rm -rf "$target"

+ 0 - 123
contrib/mkimage-rinse.sh

@@ -1,123 +0,0 @@
-#!/usr/bin/env bash
-#
-# Create a base CentOS Docker image.
-
-# This script is useful on systems with rinse available (e.g.,
-# building a CentOS image on Debian).  See contrib/mkimage-yum.sh for
-# a way to build CentOS images on systems with yum installed.
-
-set -e
-
-echo >&2
-echo >&2 'warning: this script is deprecated - see mkimage.sh and mkimage/rinse'
-echo >&2
-
-repo="$1"
-distro="$2"
-mirror="$3"
-
-if [ ! "$repo" ] || [ ! "$distro" ]; then
-	self="$(basename $0)"
-	echo >&2 "usage: $self repo distro [mirror]"
-	echo >&2
-	echo >&2 "   ie: $self username/centos centos-5"
-	echo >&2 "       $self username/centos centos-6"
-	echo >&2
-	echo >&2 "   ie: $self username/slc slc-5"
-	echo >&2 "       $self username/slc slc-6"
-	echo >&2
-	echo >&2 "   ie: $self username/centos centos-5 http://vault.centos.org/5.8/os/x86_64/CentOS/"
-	echo >&2 "       $self username/centos centos-6 http://vault.centos.org/6.3/os/x86_64/Packages/"
-	echo >&2
-	echo >&2 'See /etc/rinse for supported values of "distro" and for examples of'
-	echo >&2 '  expected values of "mirror".'
-	echo >&2
-	echo >&2 'This script is tested to work with the original upstream version of rinse,'
-	echo >&2 '  found at http://www.steve.org.uk/Software/rinse/ and also in Debian at'
-	echo >&2 '  http://packages.debian.org/wheezy/rinse -- as always, YMMV.'
-	echo >&2
-	exit 1
-fi
-
-target="${TMPDIR:-/var/tmp}/docker-rootfs-rinse-$distro-$$-$RANDOM"
-
-cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
-returnTo="$(pwd -P)"
-
-rinseArgs=( --arch amd64 --distribution "$distro" --directory "$target" )
-if [ "$mirror" ]; then
-	rinseArgs+=( --mirror "$mirror" )
-fi
-
-set -x
-
-mkdir -p "$target"
-
-sudo rinse "${rinseArgs[@]}"
-
-cd "$target"
-
-# rinse fails a little at setting up /dev, so we'll just wipe it out and create our own
-sudo rm -rf dev
-sudo mkdir -m 755 dev
-(
-	cd dev
-	sudo ln -sf /proc/self/fd ./
-	sudo mkdir -m 755 pts
-	sudo mkdir -m 1777 shm
-	sudo mknod -m 600 console c 5 1
-	sudo mknod -m 600 initctl p
-	sudo mknod -m 666 full c 1 7
-	sudo mknod -m 666 null c 1 3
-	sudo mknod -m 666 ptmx c 5 2
-	sudo mknod -m 666 random c 1 8
-	sudo mknod -m 666 tty c 5 0
-	sudo mknod -m 666 tty0 c 4 0
-	sudo mknod -m 666 urandom c 1 9
-	sudo mknod -m 666 zero c 1 5
-)
-
-# effectively: febootstrap-minimize --keep-zoneinfo --keep-rpmdb --keep-services "$target"
-#  locales
-sudo rm -rf usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive}
-#  docs and man pages
-sudo rm -rf usr/share/{man,doc,info,gnome/help}
-#  cracklib
-sudo rm -rf usr/share/cracklib
-#  i18n
-sudo rm -rf usr/share/i18n
-#  yum cache
-sudo rm -rf var/cache/yum
-sudo mkdir -p --mode=0755 var/cache/yum
-#  sln
-sudo rm -rf sbin/sln
-#  ldconfig
-#sudo rm -rf sbin/ldconfig
-sudo rm -rf etc/ld.so.cache var/cache/ldconfig
-sudo mkdir -p --mode=0755 var/cache/ldconfig
-
-# allow networking init scripts inside the container to work without extra steps
-echo 'NETWORKING=yes' | sudo tee etc/sysconfig/network > /dev/null
-
-# to restore locales later:
-#  yum reinstall glibc-common
-
-version=
-if [ -r etc/redhat-release ]; then
-	version="$(sed -E 's/^[^0-9.]*([0-9.]+).*$/\1/' etc/redhat-release)"
-elif [ -r etc/SuSE-release ]; then
-	version="$(awk '/^VERSION/ { print $3 }' etc/SuSE-release)"
-fi
-
-if [ -z "$version" ]; then
-	echo >&2 "warning: cannot autodetect OS version, using $distro as tag"
-	sleep 20
-	version="$distro"
-fi
-
-sudo tar --numeric-owner -c . | docker import - $repo:$version
-
-docker run -i -t $repo:$version echo success
-
-cd "$returnTo"
-sudo rm -rf "$target"