Initial commit
This commit is contained in:
commit
e5ace863c5
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "docker-brew-devuan"]
|
||||
path = docker-brew-devuan
|
||||
url = ssh://git@git.ring-zero.co.uk:10022/docker/docker-brew-devuan.git
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
We use docker-brew-devuan as a submodule and the files in this directory do operations upon its contents.
|
||||
|
||||
The concept is that we keep the master clean of artifacts of the build by creating a branch and switching to it before starting a build. Each release name has its own branch in the style of:
|
||||
dist-oldoldstable
|
||||
dist-oldstable
|
||||
dist-stable
|
||||
dist-testing
|
||||
dist-unstable
|
||||
|
||||
update-devuan.sh
|
||||
|
||||
Takes arguments:
|
||||
$1: jessie, ascii, beowulf, chimaera, ceres
|
||||
$2:
|
||||
|
||||
Sets the repo to: "devuan"
|
||||
Sets the mirror to: "pkgmaster.devian.org/merged"
|
||||
Sets the include: "inetutils-ping,iproute2"
|
||||
|
||||
change-mkimage-link.sh
|
||||
|
||||
When we pulling in from upstream the symlink pointed to the maintainers home directory so we had to change the symlink to the local copy of mkimage.sh.
|
||||
|
||||
Since the project has been archived we have those files in this repo under bin.
|
||||
|
||||
|
||||
clean-devuan.sh
|
||||
copy-in-dockerfiles.sh
|
||||
copy-out-dockerfiles.sh
|
||||
fetch-bfg.sh
|
||||
git-prune.files
|
||||
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
mkimg="$(basename "$0")"
|
||||
|
||||
usage() {
|
||||
echo >&2 "usage: $mkimg [-d dir] [-t tag] [--compression algo| --no-compression] script [script-args]"
|
||||
echo >&2 " ie: $mkimg -t someuser/debian debootstrap --variant=minbase jessie"
|
||||
echo >&2 " $mkimg -t someuser/ubuntu debootstrap --include=ubuntu-minimal --components=main,universe trusty"
|
||||
echo >&2 " $mkimg -t someuser/busybox busybox-static"
|
||||
echo >&2 " $mkimg -t someuser/centos:5 rinse --distribution centos-5"
|
||||
echo >&2 " $mkimg -t someuser/mageia:4 mageia-urpmi --version=4"
|
||||
echo >&2 " $mkimg -t someuser/mageia:4 mageia-urpmi --version=4 --mirror=http://somemirror/"
|
||||
echo >&2 " $mkimg -t someuser/solaris solaris"
|
||||
exit 1
|
||||
}
|
||||
|
||||
scriptDir="$(dirname "$(readlink -f "$BASH_SOURCE")")/mkimage"
|
||||
|
||||
os=
|
||||
os=$(uname -o)
|
||||
|
||||
# set up path to gnu tools if solaris
|
||||
[[ $os == "Solaris" ]] && export PATH=/usr/gnu/bin:$PATH
|
||||
# TODO check for gnu-tar, gnu-getopt
|
||||
|
||||
# TODO requires root/sudo due to some pkg operations. sigh.
|
||||
[[ $os == "Solaris" && $EUID != "0" ]] && echo >&2 "image create on Solaris requires superuser privilege"
|
||||
|
||||
optTemp=$(getopt --options '+d:t:c:hC' --longoptions 'dir:,tag:,compression:,no-compression,help' --name "$mkimg" -- "$@")
|
||||
eval set -- "$optTemp"
|
||||
unset optTemp
|
||||
|
||||
dir=
|
||||
tag=
|
||||
compression="auto"
|
||||
while true; do
|
||||
case "$1" in
|
||||
-d|--dir) dir="$2" ; shift 2 ;;
|
||||
-t|--tag) tag="$2" ; shift 2 ;;
|
||||
--compression) compression="$2" ; shift 2 ;;
|
||||
--no-compression) compression="none" ; shift 1 ;;
|
||||
-h|--help) usage ;;
|
||||
--) shift ; break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
script="$1"
|
||||
[ "$script" ] || usage
|
||||
shift
|
||||
|
||||
if [ "$compression" == 'auto' ] || [ -z "$compression" ]
|
||||
then
|
||||
compression='xz'
|
||||
fi
|
||||
|
||||
[ "$compression" == 'none' ] && compression=''
|
||||
|
||||
if [ ! -x "$scriptDir/$script" ]; then
|
||||
echo >&2 "error: $script does not exist or is not executable"
|
||||
echo >&2 " see $scriptDir for possible scripts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# don't mistake common scripts like .febootstrap-minimize as image-creators
|
||||
if [[ "$script" == .* ]]; then
|
||||
echo >&2 "error: $script is a script helper, not a script"
|
||||
echo >&2 " see $scriptDir for possible scripts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
delDir=
|
||||
if [ -z "$dir" ]; then
|
||||
dir="$(mktemp -d ${TMPDIR:-/var/tmp}/docker-mkimage.XXXXXXXXXX)"
|
||||
delDir=1
|
||||
fi
|
||||
|
||||
rootfsDir="$dir/rootfs"
|
||||
( set -x; mkdir -p "$rootfsDir" )
|
||||
|
||||
# pass all remaining arguments to $script
|
||||
"$scriptDir/$script" "$rootfsDir" "$@"
|
||||
|
||||
# Docker mounts tmpfs at /dev and procfs at /proc so we can remove them
|
||||
rm -rf "$rootfsDir/dev" "$rootfsDir/proc"
|
||||
mkdir -p "$rootfsDir/dev" "$rootfsDir/proc"
|
||||
|
||||
# make sure /etc/resolv.conf has something useful in it
|
||||
mkdir -p "$rootfsDir/etc"
|
||||
cat > "$rootfsDir/etc/resolv.conf" <<'EOF'
|
||||
nameserver 8.8.8.8
|
||||
nameserver 8.8.4.4
|
||||
EOF
|
||||
|
||||
tarFile="$dir/rootfs.tar${compression:+.$compression}"
|
||||
touch "$tarFile"
|
||||
|
||||
(
|
||||
set -x
|
||||
tar --numeric-owner --create --auto-compress --file "$tarFile" --directory "$rootfsDir" --transform='s,^./,,' .
|
||||
)
|
||||
|
||||
echo >&2 "+ cat > '$dir/Dockerfile'"
|
||||
cat > "$dir/Dockerfile" <<EOF
|
||||
FROM scratch
|
||||
ADD $(basename "$tarFile") /
|
||||
EOF
|
||||
|
||||
# if our generated image has a decent shell, let's set a default command
|
||||
for shell in /bin/bash /usr/bin/fish /usr/bin/zsh /bin/sh; do
|
||||
if [ -x "$rootfsDir/$shell" ]; then
|
||||
( set -x; echo 'CMD ["'"$shell"'"]' >> "$dir/Dockerfile" )
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
( set -x; rm -rf "$rootfsDir" )
|
||||
|
||||
if [ "$tag" ]; then
|
||||
( set -x; docker build -t "$tag" "$dir" )
|
||||
elif [ "$delDir" ]; then
|
||||
# if we didn't specify a tag and we're going to delete our dir, let's just build an untagged image so that we did _something_
|
||||
( set -x; docker build "$dir" )
|
||||
fi
|
||||
|
||||
if [ "$delDir" ]; then
|
||||
( set -x; rm -rf "$dir" )
|
||||
fi
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
rootfsDir="$1"
|
||||
shift
|
||||
|
||||
(
|
||||
cd "$rootfsDir"
|
||||
|
||||
# effectively: febootstrap-minimize --keep-zoneinfo --keep-rpmdb --keep-services "$target"
|
||||
# locales
|
||||
rm -rf usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive}
|
||||
# docs and man pages
|
||||
rm -rf usr/share/{man,doc,info,gnome/help}
|
||||
# cracklib
|
||||
rm -rf usr/share/cracklib
|
||||
# i18n
|
||||
rm -rf usr/share/i18n
|
||||
# yum cache
|
||||
rm -rf var/cache/yum
|
||||
mkdir -p --mode=0755 var/cache/yum
|
||||
# sln
|
||||
rm -rf sbin/sln
|
||||
# ldconfig
|
||||
#rm -rf sbin/ldconfig
|
||||
rm -rf etc/ld.so.cache var/cache/ldconfig
|
||||
mkdir -p --mode=0755 var/cache/ldconfig
|
||||
)
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
rootfsDir="$1"
|
||||
shift
|
||||
|
||||
busybox="$(which busybox 2>/dev/null || true)"
|
||||
if [ -z "$busybox" ]; then
|
||||
echo >&2 'error: busybox: not found'
|
||||
echo >&2 ' install it with your distribution "busybox-static" package'
|
||||
exit 1
|
||||
fi
|
||||
if ! ldd "$busybox" 2>&1 | grep -q 'not a dynamic executable'; then
|
||||
echo >&2 "error: '$busybox' appears to be a dynamic executable"
|
||||
echo >&2 ' you should install your distribution "busybox-static" package instead'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$rootfsDir/bin"
|
||||
rm -f "$rootfsDir/bin/busybox" # just in case
|
||||
cp "$busybox" "$rootfsDir/bin/busybox"
|
||||
|
||||
(
|
||||
cd "$rootfsDir"
|
||||
|
||||
IFS=$'\n'
|
||||
modules=( $(bin/busybox --list-modules) )
|
||||
unset IFS
|
||||
|
||||
for module in "${modules[@]}"; do
|
||||
mkdir -p "$(dirname "$module")"
|
||||
ln -sf /bin/busybox "$module"
|
||||
done
|
||||
)
|
||||
|
|
@ -0,0 +1,249 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
rootfsDir="$1"
|
||||
shift
|
||||
|
||||
# we have to do a little fancy footwork to make sure "rootfsDir" becomes the second non-option argument to debootstrap
|
||||
|
||||
before=()
|
||||
while [ $# -gt 0 ] && [[ "$1" == -* ]]; do
|
||||
before+=( "$1" )
|
||||
shift
|
||||
done
|
||||
|
||||
suite="$1"
|
||||
shift
|
||||
|
||||
# get path to "chroot" in our current PATH
|
||||
chrootPath="$(type -P chroot)"
|
||||
rootfs_chroot() {
|
||||
# "chroot" doesn't set PATH, so we need to set it explicitly to something our new debootstrap chroot can use appropriately!
|
||||
|
||||
# set PATH and chroot away!
|
||||
PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' \
|
||||
"$chrootPath" "$rootfsDir" "$@"
|
||||
}
|
||||
|
||||
# allow for DEBOOTSTRAP=qemu-debootstrap ./mkimage.sh ...
|
||||
: ${DEBOOTSTRAP:=debootstrap}
|
||||
|
||||
(
|
||||
set -x
|
||||
$DEBOOTSTRAP "${before[@]}" "$suite" "$rootfsDir" "$@"
|
||||
)
|
||||
|
||||
# now for some Docker-specific tweaks
|
||||
|
||||
# prevent init scripts from running during install/update
|
||||
echo >&2 "+ echo exit 101 > '$rootfsDir/usr/sbin/policy-rc.d'"
|
||||
cat > "$rootfsDir/usr/sbin/policy-rc.d" <<-'EOF'
|
||||
#!/bin/sh
|
||||
|
||||
# For most Docker users, "apt-get install" only happens during "docker build",
|
||||
# where starting services doesn't work and often fails in humorous ways. This
|
||||
# prevents those failures by stopping the services from attempting to start.
|
||||
|
||||
exit 101
|
||||
EOF
|
||||
chmod +x "$rootfsDir/usr/sbin/policy-rc.d"
|
||||
|
||||
# prevent upstart scripts from running during install/update
|
||||
(
|
||||
set -x
|
||||
rootfs_chroot dpkg-divert --local --rename --add /sbin/initctl
|
||||
cp -a "$rootfsDir/usr/sbin/policy-rc.d" "$rootfsDir/sbin/initctl"
|
||||
sed -i 's/^exit.*/exit 0/' "$rootfsDir/sbin/initctl"
|
||||
)
|
||||
|
||||
# shrink a little, since apt makes us cache-fat (wheezy: ~157.5MB vs ~120MB)
|
||||
( set -x; rootfs_chroot apt-get clean )
|
||||
|
||||
# this file is one APT creates to make sure we don't "autoremove" our currently
|
||||
# in-use kernel, which doesn't really apply to debootstraps/Docker images that
|
||||
# don't even have kernels installed
|
||||
rm -f "$rootfsDir/etc/apt/apt.conf.d/01autoremove-kernels"
|
||||
|
||||
# Ubuntu 10.04 sucks... :)
|
||||
if strings "$rootfsDir/usr/bin/dpkg" | grep -q unsafe-io; then
|
||||
# force dpkg not to call sync() after package extraction (speeding up installs)
|
||||
echo >&2 "+ echo force-unsafe-io > '$rootfsDir/etc/dpkg/dpkg.cfg.d/docker-apt-speedup'"
|
||||
cat > "$rootfsDir/etc/dpkg/dpkg.cfg.d/docker-apt-speedup" <<-'EOF'
|
||||
# For most Docker users, package installs happen during "docker build", which
|
||||
# doesn't survive power loss and gets restarted clean afterwards anyhow, so
|
||||
# this minor tweak gives us a nice speedup (much nicer on spinning disks,
|
||||
# obviously).
|
||||
|
||||
force-unsafe-io
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ -d "$rootfsDir/etc/apt/apt.conf.d" ]; then
|
||||
# _keep_ us lean by effectively running "apt-get clean" after every install
|
||||
aptGetClean='"rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true";'
|
||||
echo >&2 "+ cat > '$rootfsDir/etc/apt/apt.conf.d/docker-clean'"
|
||||
cat > "$rootfsDir/etc/apt/apt.conf.d/docker-clean" <<-EOF
|
||||
# Since for most Docker users, package installs happen in "docker build" steps,
|
||||
# they essentially become individual layers due to the way Docker handles
|
||||
# layering, especially using CoW filesystems. What this means for us is that
|
||||
# the caches that APT keeps end up just wasting space in those layers, making
|
||||
# our layers unnecessarily large (especially since we'll normally never use
|
||||
# these caches again and will instead just "docker build" again and make a brand
|
||||
# new image).
|
||||
|
||||
# Ideally, these would just be invoking "apt-get clean", but in our testing,
|
||||
# that ended up being cyclic and we got stuck on APT's lock, so we get this fun
|
||||
# creation that's essentially just "apt-get clean".
|
||||
DPkg::Post-Invoke { ${aptGetClean} };
|
||||
APT::Update::Post-Invoke { ${aptGetClean} };
|
||||
|
||||
Dir::Cache::pkgcache "";
|
||||
Dir::Cache::srcpkgcache "";
|
||||
|
||||
# Note that we do realize this isn't the ideal way to do this, and are always
|
||||
# open to better suggestions (https://github.com/docker/docker/issues).
|
||||
EOF
|
||||
|
||||
# remove apt-cache translations for fast "apt-get update"
|
||||
echo >&2 "+ echo Acquire::Languages 'none' > '$rootfsDir/etc/apt/apt.conf.d/docker-no-languages'"
|
||||
cat > "$rootfsDir/etc/apt/apt.conf.d/docker-no-languages" <<-'EOF'
|
||||
# In Docker, we don't often need the "Translations" files, so we're just wasting
|
||||
# time and space by downloading them, and this inhibits that. For users that do
|
||||
# need them, it's a simple matter to delete this file and "apt-get update". :)
|
||||
|
||||
Acquire::Languages "none";
|
||||
EOF
|
||||
|
||||
echo >&2 "+ echo Acquire::GzipIndexes 'true' > '$rootfsDir/etc/apt/apt.conf.d/docker-gzip-indexes'"
|
||||
cat > "$rootfsDir/etc/apt/apt.conf.d/docker-gzip-indexes" <<-'EOF'
|
||||
# Since Docker users using "RUN apt-get update && apt-get install -y ..." in
|
||||
# their Dockerfiles don't go delete the lists files afterwards, we want them to
|
||||
# be as small as possible on-disk, so we explicitly request "gz" versions and
|
||||
# tell Apt to keep them gzipped on-disk.
|
||||
|
||||
# For comparison, an "apt-get update" layer without this on a pristine
|
||||
# "debian:wheezy" base image was "29.88 MB", where with this it was only
|
||||
# "8.273 MB".
|
||||
|
||||
Acquire::GzipIndexes "true";
|
||||
Acquire::CompressionTypes::Order:: "gz";
|
||||
EOF
|
||||
|
||||
# update "autoremove" configuration to be aggressive about removing suggests deps that weren't manually installed
|
||||
echo >&2 "+ echo Apt::AutoRemove::SuggestsImportant 'false' > '$rootfsDir/etc/apt/apt.conf.d/docker-autoremove-suggests'"
|
||||
cat > "$rootfsDir/etc/apt/apt.conf.d/docker-autoremove-suggests" <<-'EOF'
|
||||
# Since Docker users are looking for the smallest possible final images, the
|
||||
# following emerges as a very common pattern:
|
||||
|
||||
# RUN apt-get update \
|
||||
# && apt-get install -y <packages> \
|
||||
# && <do some compilation work> \
|
||||
# && apt-get purge -y --auto-remove <packages>
|
||||
|
||||
# By default, APT will actually _keep_ packages installed via Recommends or
|
||||
# Depends if another package Suggests them, even and including if the package
|
||||
# that originally caused them to be installed is removed. Setting this to
|
||||
# "false" ensures that APT is appropriately aggressive about removing the
|
||||
# packages it added.
|
||||
|
||||
# https://aptitude.alioth.debian.org/doc/en/ch02s05s05.html#configApt-AutoRemove-SuggestsImportant
|
||||
Apt::AutoRemove::SuggestsImportant "false";
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ -z "$DONT_TOUCH_SOURCES_LIST" ]; then
|
||||
# tweak sources.list, where appropriate
|
||||
lsbDist=
|
||||
if [ -z "$lsbDist" -a -r "$rootfsDir/etc/os-release" ]; then
|
||||
lsbDist="$(. "$rootfsDir/etc/os-release" && echo "$ID")"
|
||||
fi
|
||||
if [ -z "$lsbDist" -a -r "$rootfsDir/etc/lsb-release" ]; then
|
||||
lsbDist="$(. "$rootfsDir/etc/lsb-release" && echo "$DISTRIB_ID")"
|
||||
fi
|
||||
if [ -z "$lsbDist" -a -r "$rootfsDir/etc/debian_version" ]; then
|
||||
lsbDist='Debian'
|
||||
fi
|
||||
# normalize to lowercase for easier matching
|
||||
lsbDist="$(echo "$lsbDist" | tr '[:upper:]' '[:lower:]')"
|
||||
case "$lsbDist" in
|
||||
debian)
|
||||
# updates and security!
|
||||
if [ "$suite" != 'sid' -a "$suite" != 'unstable' ]; then
|
||||
(
|
||||
set -x
|
||||
sed -i "
|
||||
p;
|
||||
s/ $suite / ${suite}-updates /
|
||||
" "$rootfsDir/etc/apt/sources.list"
|
||||
echo "deb http://security.debian.org $suite/updates main" >> "$rootfsDir/etc/apt/sources.list"
|
||||
)
|
||||
fi
|
||||
;;
|
||||
devuan)
|
||||
# add the updates and security repositories
|
||||
echo "--------------------------------------------------------------------------"
|
||||
echo $suite
|
||||
echo "--------------------------------------------------------------------------"
|
||||
if [ "$suite" = 'ceres' -a "$suite" = 'unstable' ]; then
|
||||
(
|
||||
set -x
|
||||
echo "deb http://auto.mirrors.devuan.org/merged $suite main" > "$rootfsDir/etc/apt/sources.list"
|
||||
echo "deb-src http://auto.mirrors.devuan.org/merged $suite main" >> "$rootfsDir/etc/apt/sources.list"
|
||||
)
|
||||
elif [ "$suite" != 'ceres' -a "$suite" != 'unstable' ]; then
|
||||
(
|
||||
set -x
|
||||
echo "deb http://auto.mirrors.devuan.org/merged $suite main" > "$rootfsDir/etc/apt/sources.list"
|
||||
echo "deb-src http://auto.mirrors.devuan.org/merged $suite main" >> "$rootfsDir/etc/apt/sources.list"
|
||||
echo "deb http://auto.mirrors.devuan.org/merged $suite-updates main" >> "$rootfsDir/etc/apt/sources.list"
|
||||
echo "deb-src http://auto.mirrors.devuan.org/merged $suite-updates main" >> "$rootfsDir/etc/apt/sources.list"
|
||||
echo "deb http://auto.mirrors.devuan.org/merged $suite-security main" >> "$rootfsDir/etc/apt/sources.list"
|
||||
echo "deb-src http://auto.mirrors.devuan.org/merged $suite-security main" >> "$rootfsDir/etc/apt/sources.list"
|
||||
)
|
||||
fi
|
||||
;;
|
||||
ubuntu)
|
||||
# add the updates and security repositories
|
||||
(
|
||||
set -x
|
||||
sed -i "
|
||||
p;
|
||||
s/ $suite / ${suite}-updates /; p;
|
||||
s/ $suite-updates / ${suite}-security /
|
||||
" "$rootfsDir/etc/apt/sources.list"
|
||||
)
|
||||
;;
|
||||
tanglu)
|
||||
# add the updates repository
|
||||
if [ "$suite" != 'devel' ]; then
|
||||
(
|
||||
set -x
|
||||
sed -i "
|
||||
p;
|
||||
s/ $suite / ${suite}-updates /
|
||||
" "$rootfsDir/etc/apt/sources.list"
|
||||
)
|
||||
fi
|
||||
;;
|
||||
steamos)
|
||||
# add contrib and non-free if "main" is the only component
|
||||
(
|
||||
set -x
|
||||
sed -i "s/ $suite main$/ $suite main contrib non-free/" "$rootfsDir/etc/apt/sources.list"
|
||||
)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
(
|
||||
set -x
|
||||
|
||||
# make sure we're fully up-to-date
|
||||
rootfs_chroot sh -xc 'apt-get update && apt-get dist-upgrade -y'
|
||||
|
||||
# delete all the apt list files since they're big and get stale quickly
|
||||
rm -rf "$rootfsDir/var/lib/apt/lists"/*
|
||||
# this forces "apt-get update" in dependent images, which is also good
|
||||
|
||||
mkdir "$rootfsDir/var/lib/apt/lists/partial" # Lucid... "E: Lists directory /var/lib/apt/lists/partial is missing."
|
||||
)
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Needs to be run from Mageia 4 or greater for kernel support for docker.
|
||||
#
|
||||
# Mageia 4 does not have docker available in official repos, so please
|
||||
# install and run the docker binary manually.
|
||||
#
|
||||
# Tested working versions are for Mageia 2 onwards (inc. cauldron).
|
||||
#
|
||||
set -e
|
||||
|
||||
rootfsDir="$1"
|
||||
shift
|
||||
|
||||
optTemp=$(getopt --options '+v:,m:' --longoptions 'version:,mirror:' --name mageia-urpmi -- "$@")
|
||||
eval set -- "$optTemp"
|
||||
unset optTemp
|
||||
|
||||
installversion=
|
||||
mirror=
|
||||
while true; do
|
||||
case "$1" in
|
||||
-v|--version) installversion="$2" ; shift 2 ;;
|
||||
-m|--mirror) mirror="$2" ; shift 2 ;;
|
||||
--) shift ; break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z $installversion ]; then
|
||||
# Attempt to match host version
|
||||
if [ -r /etc/mageia-release ]; then
|
||||
installversion="$(sed 's/^[^0-9\]*\([0-9.]\+\).*$/\1/' /etc/mageia-release)"
|
||||
else
|
||||
echo "Error: no version supplied and unable to detect host mageia version"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z $mirror ]; then
|
||||
# No mirror provided, default to mirrorlist
|
||||
mirror="--mirrorlist https://mirrors.mageia.org/api/mageia.$installversion.x86_64.list"
|
||||
fi
|
||||
|
||||
(
|
||||
set -x
|
||||
urpmi.addmedia --distrib \
|
||||
$mirror \
|
||||
--urpmi-root "$rootfsDir"
|
||||
urpmi basesystem-minimal urpmi \
|
||||
--auto \
|
||||
--no-suggests \
|
||||
--urpmi-root "$rootfsDir" \
|
||||
--root "$rootfsDir"
|
||||
)
|
||||
|
||||
"$(dirname "$BASH_SOURCE")/.febootstrap-minimize" "$rootfsDir"
|
||||
|
||||
if [ -d "$rootfsDir/etc/sysconfig" ]; then
|
||||
# allow networking init scripts inside the container to work without extra steps
|
||||
echo 'NETWORKING=yes' > "$rootfsDir/etc/sysconfig/network"
|
||||
fi
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
rootfsDir="$1"
|
||||
shift
|
||||
|
||||
# specifying --arch below is safe because "$@" can override it and the "latest" one wins :)
|
||||
|
||||
(
|
||||
set -x
|
||||
rinse --directory "$rootfsDir" --arch amd64 "$@"
|
||||
)
|
||||
|
||||
"$(dirname "$BASH_SOURCE")/.febootstrap-minimize" "$rootfsDir"
|
||||
|
||||
if [ -d "$rootfsDir/etc/sysconfig" ]; then
|
||||
# allow networking init scripts inside the container to work without extra steps
|
||||
echo 'NETWORKING=yes' > "$rootfsDir/etc/sysconfig/network"
|
||||
fi
|
||||
|
||||
# make sure we're fully up-to-date, too
|
||||
(
|
||||
set -x
|
||||
chroot "$rootfsDir" yum update -y
|
||||
)
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Solaris 12 base image build script.
|
||||
#
|
||||
set -e
|
||||
|
||||
# TODO add optional package publisher origin
|
||||
|
||||
rootfsDir="$1"
|
||||
shift
|
||||
|
||||
# base install
|
||||
(
|
||||
set -x
|
||||
|
||||
pkg image-create --full --zone \
|
||||
--facet facet.locale.*=false \
|
||||
--facet facet.locale.POSIX=true \
|
||||
--facet facet.doc=false \
|
||||
--facet facet.doc.*=false \
|
||||
"$rootfsDir"
|
||||
|
||||
pkg -R "$rootfsDir" set-property use-system-repo true
|
||||
|
||||
pkg -R "$rootfsDir" set-property flush-content-cache-on-success true
|
||||
|
||||
pkg -R "$rootfsDir" install core-os
|
||||
)
|
||||
|
||||
# Lay in stock configuration, set up milestone
|
||||
# XXX This all may become optional in a base image
|
||||
(
|
||||
# faster to build repository database on tmpfs
|
||||
REPO_DB=/system/volatile/repository.$$
|
||||
export SVCCFG_REPOSITORY=${REPO_DB}
|
||||
export SVCCFG_DOOR_PATH=$rootfsDir/system/volatile/tmp_repo_door
|
||||
|
||||
# Import base manifests. NOTE These are a combination of basic requirement
|
||||
# and gleaned from container milestone manifest. They may change.
|
||||
for m in $rootfsDir/lib/svc/manifest/system/environment.xml \
|
||||
$rootfsDir/lib/svc/manifest/system/svc/global.xml \
|
||||
$rootfsDir/lib/svc/manifest/system/svc/restarter.xml \
|
||||
$rootfsDir/lib/svc/manifest/network/dns/client.xml \
|
||||
$rootfsDir/lib/svc/manifest/system/name-service/switch.xml \
|
||||
$rootfsDir/lib/svc/manifest/system/name-service/cache.xml \
|
||||
$rootfsDir/lib/svc/manifest/milestone/container.xml ; do
|
||||
svccfg import $m
|
||||
done
|
||||
|
||||
# Apply system layer profile, deleting unnecessary dependencies
|
||||
svccfg apply $rootfsDir/etc/svc/profile/generic_container.xml
|
||||
|
||||
# XXX Even if we keep a repo in the base image, this is definitely optional
|
||||
svccfg apply $rootfsDir/etc/svc/profile/sysconfig/container_sc.xml
|
||||
|
||||
for s in svc:/system/svc/restarter \
|
||||
svc:/system/environment \
|
||||
svc:/network/dns/client \
|
||||
svc:/system/name-service/switch \
|
||||
svc:/system/name-service/cache \
|
||||
svc:/system/svc/global \
|
||||
svc:/milestone/container ;do
|
||||
svccfg -s $s refresh
|
||||
done
|
||||
|
||||
# now copy the built up repository into the base rootfs
|
||||
mv $REPO_DB $rootfsDir/etc/svc/repository.db
|
||||
)
|
||||
|
||||
# pkg(1) needs the zoneproxy-client running in the container.
|
||||
# use a simple wrapper to run it as needed.
|
||||
# XXX maybe we go back to running this in SMF?
|
||||
mv "$rootfsDir/usr/bin/pkg" "$rootfsDir/usr/bin/wrapped_pkg"
|
||||
cat > "$rootfsDir/usr/bin/pkg" <<-'EOF'
|
||||
#!/bin/sh
|
||||
#
|
||||
# THIS FILE CREATED DURING DOCKER BASE IMAGE CREATION
|
||||
#
|
||||
# The Solaris base image uses the sysrepo proxy mechanism. The
|
||||
# IPS client pkg(1) requires the zoneproxy-client to reach the
|
||||
# remote publisher origins through the host. This wrapper script
|
||||
# enables and disables the proxy client as needed. This is a
|
||||
# temporary solution.
|
||||
|
||||
/usr/lib/zones/zoneproxy-client -s localhost:1008
|
||||
PKG_SYSREPO_URL=http://localhost:1008 /usr/bin/wrapped_pkg "$@"
|
||||
pkill -9 zoneproxy-client
|
||||
EOF
|
||||
chmod +x "$rootfsDir/usr/bin/pkg"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#ln -sf ../../docker_upstream/docker/contrib/mkimage.sh ./docker-brew-debian/mkimage.sh
|
||||
ln -sf ./bin/mkimage.sh ./docker-brew-debian/mkimage.sh
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
echo "" > ./docker-brew-devuan/latest
|
||||
echo "" > ./docker-brew-devuan/repo
|
||||
echo "" > ./docker-brew-devuan/mirror
|
||||
echo main > ./docker-brew-devuan/components
|
||||
|
||||
mkdir -p ./docker-brew-devuan/$1
|
||||
#echo 1 > ./docker-brew-devuan/$1/merged-usr
|
||||
echo "inetutils-ping,iproute2" > ./docker-brew-devuan/$1/include
|
||||
|
||||
./docker-brew-devuan/update.sh $1
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
cp ../../dockerfiles/dockerfiles/devuan/ceres/Dockerfile docker-brew-devuan/ceres/
|
||||
cp ../../dockerfiles/dockerfiles/devuan/chimaera/Dockerfile docker-brew-devuan/chimaera/
|
||||
cp ../../dockerfiles/dockerfiles/devuan/beowulf/Dockerfile docker-brew-devuan/beowulf/
|
||||
cp ../../dockerfiles/dockerfiles/devuan/ascii/Dockerfile docker-brew-devuan/ascii/
|
||||
cp ../../dockerfiles/dockerfiles/devuan/jessie/Dockerfile docker-brew-devuan/jessie/
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
mkdir -p ../../dockerfiles/dockerfiles/devuan/ceres
|
||||
mkdir -p ../../dockerfiles/dockerfiles/devuan/chimaera
|
||||
mkdir -p ../../dockerfiles/dockerfiles/devuan/beowulf
|
||||
mkdir -p ../../dockerfiles/dockerfiles/devuan/ascii
|
||||
mkdir -p ../../dockerfiles/dockerfiles/devuan/jessie
|
||||
cp docker-brew-devuan/ceres/Dockerfile ../../dockerfiles/dockerfiles/devuan/ceres
|
||||
cp docker-brew-devuan/chimaera/Dockerfile ../../dockerfiles/dockerfiles/devuan/chimaera
|
||||
cp docker-brew-devuan/beowulf/Dockerfile ../../dockerfiles/dockerfiles/devuan/beowulf
|
||||
cp docker-brew-devuan/ascii/Dockerfile ../../dockerfiles/dockerfiles/devuan/ascii
|
||||
cp docker-brew-devuan/jessie/Dockerfile ../../dockerfiles/dockerfiles/devuan/jessie
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# NB the latest tag is attached to quite an old release (v1.12.5)
|
||||
LATEST="$(curl https://api.github.com/repos/rtyley/bfg-repo-cleaner/releases/latest | jq '.tag_name')" # returns v1.13.0
|
||||
CURRENT="$(curl https://api.github.com/repos/rtyley/bfg-repo-cleaner/releases | jq '.[0]' | {tag_name})"
|
||||
wget -c --directory-prefix ./bin/"${CURRENT}"
|
||||
|
||||
# https://github.com/rtyley/bfg-repo-cleaner/releases/tag/v1.12.16 # 29 Sep 2017
|
||||
# https://github.com/rtyley/bfg-repo-cleaner/releases/tag/v1.12.5 # 1 Oct 2015
|
||||
# https://search.maven.org/remote_content?g=com.madgag&a=bfg&v=LATEST
|
||||
# https://search.maven.org/remotecontent?filepath=com/madgag/bfg/1.12.16/bfg-1.12.16.jar
|
||||
# https://search.maven.org/#artifactdetails|com.madgag|bfg|1.12.16|ja://search.maven.org/#artifactdetails|com.madgag|bfg|1.12.16|jar
|
||||
# http://central.maven.org/maven2/com/madgag/bfg-library_2.11/1.12.16/bfg-library_2.11-1.12.16.jar
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#git clone git@git.devuan.org:cyteen/docker-brew-debian.git
|
||||
git clone http://git.ring-zero.co.uk/docker/docker-brew-devuan.git
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
set -o errexit
|
||||
|
||||
# Author: David Underhill
|
||||
# Script to permanently delete files/folders from your git repository. To use
|
||||
# it, cd to your repository's root and then run the script with a list of paths
|
||||
# you want to delete, e.g., git-delete-history path1 path2
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# make sure we're at the root of git repo
|
||||
if [ ! -d .git ]; then
|
||||
echo "Error: must run this script from the root of a git repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# remove all paths passed as arguments from the history of the repo
|
||||
files=$@
|
||||
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD
|
||||
|
||||
# remove the temporary history git-filter-branch otherwise leaves behind for a long time
|
||||
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/bin/bash
|
||||
set -x
|
||||
# Each update should apply to a different branch:
|
||||
# dist-oldoldstable jessie
|
||||
# dist-oldstable ascii
|
||||
# dist-stable beowulf
|
||||
# dist-testing chimaera
|
||||
# dist-unstable ceres
|
||||
#
|
||||
# So git checkout each in turn. This keeps master free for development
|
||||
# Run current stable last so that it gets marked as lastest
|
||||
# For the generate-stackbrew-library.sh to work the images have to be commited locally
|
||||
# and to github
|
||||
#
|
||||
|
||||
# ARCHIVED: The original upstream: git remote add origin git@github.com:tianon/docker-brew-debian.git
|
||||
# DELETED: The github fork: git remote add origin git@github.com:cyteen/docker-brew-devuan.git
|
||||
# DELETED: The devuan fork upstream: git remote add origin git@git.devuan.org:cyteen/docker-brew-debian.git
|
||||
|
||||
# To set multiple push
|
||||
# git remote set-url --add --push origin git@github.com:cyteen/docker-brew-debian.git
|
||||
# git remote set-url --add --push origin ssh://cyteen@github.com:443/cyteen/docker-brew-debian.git
|
||||
# git remote set-url --add --push origin git@git.devuan.org:cyteen/docker-brew-debian.git
|
||||
|
||||
master='master'
|
||||
#master='devuan'
|
||||
|
||||
MIRROR=http://pkgmaster.devuan.org/merged
|
||||
|
||||
|
||||
## We fix the 'binary in a git repo' issue with git-lfs:
|
||||
# git lfs install # initialize the Git LFS project
|
||||
# git lfs track "*.tar.xz" # select the file extensions that you want to treat as large files
|
||||
# git add . # add the large file to the project
|
||||
# git commit -am "Added devuan root tarball." # commit the file meta data
|
||||
# git push origin master # sync the git repo and large file to the GitLab server
|
||||
# git add .gitattributes
|
||||
|
||||
build_image () {
|
||||
cd docker-brew-devuan
|
||||
git branch -d "$2"
|
||||
git checkout --orphan "$2"
|
||||
echo devuan > ./repo
|
||||
echo ${MIRROR} > ./mirror
|
||||
echo main > ./components
|
||||
|
||||
mkdir -p ./"$1"
|
||||
#echo 1 > ./$1/merged-usr
|
||||
echo "inetutils-ping,iproute2" > ./"$1"/include
|
||||
|
||||
bash "${PWD}"/update.sh "$1"
|
||||
git add .
|
||||
git commit -m "Commit after build of $1 in $2"
|
||||
#git push -u origin $2
|
||||
}
|
||||
|
||||
if [ "$1" == "jessie" ]
|
||||
then
|
||||
BRANCH="dist-oldoldstable"
|
||||
build_image "$1" ${BRANCH}
|
||||
elif [ "$1" == "ascii" ]
|
||||
then
|
||||
BRANCH="dist-oldstable"
|
||||
build_image "$1" ${BRANCH}
|
||||
elif [ "$1" == "beowulf" ]
|
||||
then
|
||||
BRANCH="dist-stable"
|
||||
build_image "$1" ${BRANCH}
|
||||
elif [ "$1" == "chimaera" ]
|
||||
then
|
||||
BRANCH="dist-testing"
|
||||
build_image "$1" ${BRANCH}
|
||||
elif [ "$1" == "ceres" ]
|
||||
then
|
||||
BRANCH="dist-unstable"
|
||||
build_image "$1" ${BRANCH}
|
||||
else
|
||||
echo "The given release is not one of jessie, ascii, beowulf, chimaera, ceres."
|
||||
fi
|
||||
Loading…
Reference in New Issue