kameleon-builder 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.editorconfig +0 -0
- data/.env +63 -15
- data/.gitignore +1 -0
- data/README.rst +4 -2
- data/Vagrantfile +13 -52
- data/bin/kameleon +5 -0
- data/completion/_kameleon.zsh +18 -0
- data/completion/kameleon.bash +13 -0
- data/completion/kameleon.fish +10 -0
- data/contrib/polipo_env.sh +2 -0
- data/contrib/steps/export/save_as_g5k.yaml +63 -0
- data/contrib/steps/setup/add_to_sudoers.yaml +5 -0
- data/docs/Makefile +10 -6
- data/docs/README.md +17 -0
- data/docs/source/_static/kameleon-logo.png +0 -0
- data/docs/source/_static/kameleon-logo.xcf +0 -0
- data/docs/source/_static/kameleon-long.png +0 -0
- data/docs/source/aliases.rst +4 -2
- data/docs/source/checkpoint.rst +2 -0
- data/docs/source/commands.rst +4 -3
- data/docs/source/conf.py +15 -7
- data/docs/source/context.rst +7 -4
- data/docs/source/faq.rst +39 -1
- data/docs/source/getting_started.rst +227 -1
- data/docs/source/grid5000_tutorial.rst +110 -0
- data/docs/source/index.rst +7 -2
- data/docs/source/installation.rst +12 -4
- data/docs/source/persistent_cache.rst +34 -0
- data/docs/source/recipe.rst +23 -16
- data/docs/source/use_cases.rst +93 -0
- data/docs/source/workspace.rst +2 -0
- data/kameleon-builder.gemspec +7 -1
- data/lib/kameleon.rb +3 -6
- data/lib/kameleon/cli.rb +104 -50
- data/lib/kameleon/compat.rb +39 -0
- data/lib/kameleon/context.rb +43 -13
- data/lib/kameleon/engine.rb +118 -77
- data/lib/kameleon/environment.rb +3 -5
- data/lib/kameleon/error.rb +15 -9
- data/lib/kameleon/logger.rb +7 -4
- data/lib/kameleon/persistent_cache.rb +139 -0
- data/lib/kameleon/recipe.rb +200 -81
- data/lib/kameleon/shell.rb +51 -16
- data/omnibus/.gitignore +11 -0
- data/omnibus/.kitchen.yml +25 -0
- data/omnibus/Berksfile +9 -0
- data/omnibus/Berksfile.lock +25 -0
- data/omnibus/Gemfile +12 -0
- data/omnibus/README.md +94 -0
- data/omnibus/config/projects/kameleon.rb +23 -0
- data/omnibus/config/software/kameleon.rb +24 -0
- data/omnibus/config/software/polipo.rb +30 -0
- data/omnibus/config/software/ruby.rb +158 -0
- data/omnibus/files/mac_dmg/Resources/background.png +0 -0
- data/omnibus/files/mac_dmg/Resources/icon.png +0 -0
- data/omnibus/files/mac_pkg/Resources/background.png +0 -0
- data/omnibus/files/mac_pkg/Resources/license.html +1 -0
- data/omnibus/files/mac_pkg/Resources/welcome.html +9 -0
- data/omnibus/omnibus.rb +27 -0
- data/omnibus/package-scripts/kameleon/makeselfinst +27 -0
- data/omnibus/package-scripts/kameleon/postrm +9 -0
- data/templates/archlinux-desktop.yaml +25 -0
- data/templates/archlinux.yaml +106 -0
- data/templates/debian-testing.yaml +25 -0
- data/templates/debian7-desktop.yaml +25 -0
- data/templates/{debian-wheezy-docker.yaml → debian7-docker.yaml} +30 -16
- data/templates/debian7-g5k.yaml +97 -0
- data/templates/debian7-oar-dev.yaml +51 -0
- data/templates/debian7.yaml +128 -0
- data/templates/extend.erb +23 -0
- data/templates/fedora-rawhide.yaml +30 -0
- data/templates/fedora20-desktop.yaml +21 -0
- data/templates/fedora20.yaml +105 -0
- data/templates/{debian-wheezy-chroot.yaml → old-debian7.yaml} +51 -38
- data/templates/{aliases → steps/aliases}/defaults.yaml +37 -12
- data/templates/steps/bootstrap/archlinux/arch_bootstrap.yaml +219 -0
- data/templates/steps/bootstrap/archlinux/install_bootloader.yaml +46 -0
- data/templates/steps/bootstrap/archlinux/populate_disk.yaml +39 -0
- data/templates/steps/bootstrap/debian/debootstrap.yaml +18 -10
- data/templates/steps/bootstrap/debian/debootstrap_arm.yaml +31 -0
- data/templates/steps/bootstrap/fedora/liveos_bootstrap.yaml +123 -0
- data/templates/steps/bootstrap/g5k_reserv.yaml +70 -0
- data/templates/steps/bootstrap/initialize_disk_chroot.yaml +84 -0
- data/templates/steps/bootstrap/initialize_disk_qemu.yaml +72 -0
- data/templates/steps/bootstrap/install_bootloader.yaml +42 -0
- data/templates/steps/bootstrap/prepare_chroot.yaml +126 -0
- data/templates/steps/bootstrap/prepare_docker.yaml +19 -8
- data/templates/steps/bootstrap/prepare_qemu.yaml +47 -0
- data/templates/steps/bootstrap/start_chroot.yaml +11 -2
- data/templates/steps/bootstrap/start_docker.yaml +2 -2
- data/templates/steps/bootstrap/start_qemu.yaml +75 -0
- data/templates/steps/bootstrap/ubuntu/debootstrap.yaml +27 -0
- data/templates/steps/breakpoint.yaml +2 -0
- data/templates/{checkpoints → steps/checkpoints}/docker.yaml +0 -0
- data/templates/steps/checkpoints/qcow2.yaml +38 -0
- data/templates/steps/checkpoints/qemu.yaml +39 -0
- data/templates/steps/export/clean_appliance.yaml +7 -1
- data/templates/steps/export/compact_qcow_img.yaml +12 -0
- data/templates/steps/export/save_appliance.yaml +58 -0
- data/templates/steps/export/save_appliance_from_g5k.yaml +47 -0
- data/templates/steps/export/save_vagrant_box.yaml +29 -0
- data/templates/steps/setup/archlinux/configure_keyboard.yaml +9 -0
- data/templates/steps/setup/archlinux/configure_network.yaml +9 -0
- data/templates/steps/setup/archlinux/configure_ruby.yaml +7 -0
- data/templates/steps/setup/archlinux/configure_system.yaml +20 -0
- data/templates/steps/setup/archlinux/install_dev_tools.yaml +18 -0
- data/templates/steps/setup/archlinux/install_gnome.yaml +27 -0
- data/templates/steps/setup/archlinux/install_software.yaml +9 -0
- data/templates/steps/setup/archlinux/install_yaourt.yaml +29 -0
- data/templates/steps/setup/autologin.yaml +16 -0
- data/templates/steps/setup/create_group.yaml +12 -0
- data/templates/steps/setup/create_user.yaml +9 -10
- data/templates/steps/setup/debian/configure_apt.yaml +65 -0
- data/templates/steps/setup/debian/configure_kernel.yaml +18 -0
- data/templates/steps/setup/debian/{keyboard_config.yaml → configure_keyboard.yaml} +1 -1
- data/templates/steps/setup/debian/{network_config.yaml → configure_network.yaml} +0 -0
- data/templates/steps/setup/debian/{system_config.yaml → configure_system.yaml} +0 -0
- data/templates/steps/setup/debian/install_gnome.yaml +13 -0
- data/templates/steps/setup/debian/install_kde.yaml +13 -0
- data/templates/steps/setup/debian/install_software.yaml +2 -0
- data/templates/steps/setup/debian/oar/oar_debian_config_frontend.yaml +8 -0
- data/templates/steps/setup/debian/oar/oar_debian_config_node.yaml +5 -0
- data/templates/steps/setup/debian/oar/oar_debian_config_server.yaml +5 -0
- data/templates/steps/setup/debian/oar/oar_prereq_install.yaml +16 -0
- data/templates/steps/setup/debian/setup_vagrant_box.yaml +52 -0
- data/templates/steps/setup/debian/upgrade_system.yaml +15 -0
- data/templates/steps/setup/fedora/configure_network.yaml +30 -0
- data/templates/steps/setup/fedora/configure_system.yaml +59 -0
- data/templates/steps/setup/fedora/install_software.yaml +3 -0
- data/templates/steps/setup/fedora/update_system.yaml +10 -0
- data/templates/steps/setup/oar/oar_config_devel.yaml +21 -0
- data/templates/steps/setup/oar/oar_config_frontend.yaml +38 -0
- data/templates/steps/setup/oar/oar_config_node.yaml +4 -0
- data/templates/steps/setup/oar/oar_config_server.yaml +25 -0
- data/templates/steps/setup/oar/oar_config_system.yaml +34 -0
- data/templates/steps/setup/oar/oar_devel_prereq_install.yaml +5 -0
- data/templates/steps/setup/oar/oar_git_install.yaml +21 -0
- data/templates/steps/setup/ubuntu/configure_apt.yaml +67 -0
- data/templates/ubuntu-12.04-desktop.yaml +25 -0
- data/templates/ubuntu-12.04.yaml +128 -0
- data/templates/ubuntu-14.04-desktop.yaml +27 -0
- data/templates/ubuntu-14.04.yaml +25 -0
- data/templates/vagrant-debian7.yaml +31 -0
- data/version.txt +1 -1
- metadata +155 -28
- checksums.yaml +0 -7
- data/templates/checkpoints/qcow2.yaml +0 -44
- data/templates/fedora-docker.yaml +0 -96
- data/templates/steps/bootstrap/fedora/docker_bootstrap.yaml +0 -25
- data/templates/steps/bootstrap/fedora/yum_bootstrap.yaml +0 -22
- data/templates/steps/bootstrap/prepare_appliance_with_nbd.yaml +0 -93
- data/templates/steps/export/build_appliance_from_docker.yaml +0 -105
- data/templates/steps/export/save_appliance_from_nbd.yaml +0 -54
- data/templates/steps/setup/debian/kernel_install.yaml +0 -20
- data/templates/steps/setup/debian/software_install.yaml +0 -15
- data/templates/steps/setup/fedora/kernel_install.yaml +0 -27
- data/templates/steps/setup/fedora/software_install.yaml +0 -10
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 0da2c2ced91eb366f1c84e507b387531e6a71036
|
4
|
-
data.tar.gz: bb947d9be606eca0d2f5dc4e38d31fa985b7b866
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: affe277bd4a073060f4e3f26a41df509f31a41d92e58e1bc6dfa1e068d619be240a52a426139c0165c507081a07fd2f0971218b97afd7a202f6407849d291772
|
7
|
-
data.tar.gz: 2d4dd5d871d9a7d9f3d64a991adae10fe04e47388a98b491b6fb7cdfb015dbe5b180b60350dd45501dc86c1dc7fa0b9d915ce7055f867b615ceb91afe00f9309
|
@@ -1,44 +0,0 @@
|
|
1
|
-
create: |
|
2
|
-
if [ -e "$$container" ] ; then
|
3
|
-
parent_of_@microstep_id="$(readlink $$container)"
|
4
|
-
mkdir -p checkpoints
|
5
|
-
pushd checkpoints
|
6
|
-
rm -f @microstep_id_$${container}
|
7
|
-
qemu-img create -f qcow2 "@microstep_id_$${container}" \
|
8
|
-
-o backing_file=$(basename "$parent_of_@microstep_id")
|
9
|
-
popd
|
10
|
-
ln -sf checkpoints/@microstep_id_$$container $$container
|
11
|
-
|
12
|
-
lsmod | grep nbd >/dev/null || modprobe nbd max_part=63
|
13
|
-
|
14
|
-
echo "sync" ; sync
|
15
|
-
qemu-nbd -d $$nbd_device
|
16
|
-
qemu-nbd -c $$nbd_device "$(readlink $$container)"
|
17
|
-
fi
|
18
|
-
|
19
|
-
apply: |
|
20
|
-
# apply command use the backing file that represent the real state to restore
|
21
|
-
previous_id=$(qemu-img info "checkpoints/@microstep_id_$${container}" \
|
22
|
-
| grep backing \
|
23
|
-
| sed -e 's/.*checkpoints\/\(.*\)_$${container}\(.*\)/\1/p' \
|
24
|
-
| uniq)
|
25
|
-
|
26
|
-
ln -sf "checkpoints/${previous_id}_$${container}" "$$container"
|
27
|
-
|
28
|
-
lsmod | grep nbd >/dev/null || modprobe nbd max_part=63
|
29
|
-
|
30
|
-
echo "sync" ; sync
|
31
|
-
qemu-nbd -d $$nbd_device
|
32
|
-
qemu-nbd -c $$nbd_device "$(readlink $$container)"
|
33
|
-
|
34
|
-
clear: |
|
35
|
-
if [ -d "checkpoints" ] ; then
|
36
|
-
ls checkpoints/ | \
|
37
|
-
xargs -I {} bash -c "echo Removing checkpoints/{} ; rm checkpoints/{}"
|
38
|
-
rm -f $$container
|
39
|
-
fi
|
40
|
-
|
41
|
-
list: |
|
42
|
-
if [ -d "checkpoints" ] ; then
|
43
|
-
ls checkpoints/ | sed -e 's/\(.*\)_$${container}/\1/p' | uniq
|
44
|
-
fi
|
@@ -1,96 +0,0 @@
|
|
1
|
-
#==============================================================================
|
2
|
-
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
-
#==============================================================================
|
4
|
-
#
|
5
|
-
# RECIPE: <%= recipe_name %>
|
6
|
-
#
|
7
|
-
# DESCRIPTION: Fedora base image [Working progress].
|
8
|
-
#
|
9
|
-
# TEMPLATE: <%= @name %>
|
10
|
-
#
|
11
|
-
#==============================================================================
|
12
|
-
|
13
|
-
---
|
14
|
-
# Loads some helpful aliases
|
15
|
-
aliases: defaults.yaml
|
16
|
-
# Enables qcow2 checkpoint
|
17
|
-
checkpoint: docker.yaml
|
18
|
-
#== Global variables use by Kameleon engine and the steps
|
19
|
-
global:
|
20
|
-
## User varibales : used by the recipe
|
21
|
-
cachedir: /var/cache/kameleon
|
22
|
-
user_name: kameleon
|
23
|
-
arch: x86_64
|
24
|
-
|
25
|
-
distrib: fedora
|
26
|
-
release: 20
|
27
|
-
docker_image: kameleon-$${distrib}-$$release
|
28
|
-
# DNS servers : opendns
|
29
|
-
docker_dns: 208.67.222.222
|
30
|
-
|
31
|
-
## System variables. Required by kameleon engine
|
32
|
-
# Include specific steps
|
33
|
-
include_steps: [$$distrib/$$release, $$distrib]
|
34
|
-
|
35
|
-
# Shell session from where we launch exec_out commands. There is often a
|
36
|
-
# local bash session, but it can be a remote shell on other machines or on
|
37
|
-
# any shell. (eg. bash, chroot, fakechroot, ssh, tmux, lxc...)
|
38
|
-
out_context:
|
39
|
-
cmd: bash
|
40
|
-
workdir: $$kameleon_cwd
|
41
|
-
|
42
|
-
# Shell session that allows us to connect to the building machine in order to
|
43
|
-
# configure it and setup additional programs
|
44
|
-
ssh_options: -o StrictHostKeyChecking=no -o ForwardAgent=yes
|
45
|
-
ssh_port: $(cat MAIN_CONTAINER_PORT)
|
46
|
-
insecure_ssh_key: insecure_ssh_dsa_key
|
47
|
-
in_context:
|
48
|
-
cmd: LC_ALL=POSIX ssh $$ssh_options localhost -p $$ssh_port -i $$insecure_ssh_key -t /bin/bash
|
49
|
-
workdir: /
|
50
|
-
|
51
|
-
#== Bootstrap the new system and create the 'in_context'
|
52
|
-
bootstrap:
|
53
|
-
- docker_bootstrap:
|
54
|
-
- release: $$release
|
55
|
-
- rootfs_archive: $$cachedir/$$distrib/$$release/$$arch/bootstrap.tar.gz
|
56
|
-
- dns: $$docker_dns
|
57
|
-
- prepare_docker:
|
58
|
-
- rootfs_archive: $$cachedir/$$distrib/$$release/$$arch/bootstrap.tar.gz
|
59
|
-
- image: $$docker_image
|
60
|
-
- dns: $$docker_dns
|
61
|
-
- start_docker:
|
62
|
-
- image: $$docker_image
|
63
|
-
- dns: $$docker_dns
|
64
|
-
- hostname: kameleon-$$distrib
|
65
|
-
|
66
|
-
#== Install and configuration steps
|
67
|
-
# WARNING: this part should be independante from the build context (whenever
|
68
|
-
# possible...)
|
69
|
-
setup:
|
70
|
-
# Install
|
71
|
-
- software_install:
|
72
|
-
- packages: >
|
73
|
-
ntp zip unzip rsync sudo less vim bash-completion wget
|
74
|
-
- group_packages: >
|
75
|
-
"Development Tools"
|
76
|
-
- kernel_install
|
77
|
-
# # Configuration
|
78
|
-
# - system_config:
|
79
|
-
# - locales: fr_FR en_US
|
80
|
-
# - lang: fr_FR.UTF-8
|
81
|
-
# - timezone: Europe/Paris
|
82
|
-
# - keyboard_config:
|
83
|
-
# - layout: "fr,us"
|
84
|
-
- create_user:
|
85
|
-
- name: $$user_name
|
86
|
-
- group: admin
|
87
|
-
- password: $$user_name
|
88
|
-
|
89
|
-
#== Export the generated appliance in the format of your choice
|
90
|
-
export:
|
91
|
-
- build_appliance_from_docker:
|
92
|
-
- mountdir: $$kameleon_cwd/rootfs
|
93
|
-
- filename: $$kameleon_recipe_name
|
94
|
-
- filesystem_type: ext4
|
95
|
-
- format: qcow2 # Should be raw, qcow2 or qed format
|
96
|
-
- image_size: 2G
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# # Bootstrap
|
2
|
-
- repository: mattdm/fedora
|
3
|
-
- rootfs: rootfs
|
4
|
-
- include: >
|
5
|
-
yum initscripts passwd rsyslog vim-minimal dhclient chkconfig rootfiles openssh-server
|
6
|
-
policycoreutils fedora-release openssh-server net-tools nc traceroute
|
7
|
-
- create_rootfs:
|
8
|
-
- exec_out: test -f "$$rootfs_archive" || mkdir -p $(dirname "$$rootfs_archive")
|
9
|
-
- exec_out: test -f "$$rootfs_archive" || echo "Pulling image from '$$repository'"
|
10
|
-
- exec_out: test -f "$$rootfs_archive" || docker pull -t f$$release $$repository > /dev/null
|
11
|
-
- exec_out: |
|
12
|
-
echo "Installing core packages : $$include"
|
13
|
-
if [ ! -f "$$rootfs_archive" ]
|
14
|
-
then
|
15
|
-
BASE_CID=$(docker run --dns $$dns -d $$repository:f$${release} \
|
16
|
-
bash -c "yum -y --nogpgcheck update ; \
|
17
|
-
yum -y --nogpgcheck install $$include ; \
|
18
|
-
/usr/bin/ssh-keygen -A")
|
19
|
-
fi
|
20
|
-
- exec_out: test -f "$$rootfs_archive" || bash -c "exit $(docker wait $BASE_CID)"
|
21
|
-
- exec_out: test -f "$$rootfs_archive" || docker export $BASE_CID > "$$rootfs_archive"
|
22
|
-
- on_bootstrap_clean:
|
23
|
-
- exec_out: test -f "$$rootfs_archive" || docker kill "$BASE_CID"
|
24
|
-
- exec_out: test -f "$$rootfs_archive" || docker rm "$BASE_CID"
|
25
|
-
- exec_out: test -f "$$rootfs_archive" || docker rmi $$repository
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# # Bootstrap
|
2
|
-
- include: >
|
3
|
-
yum initscripts passwd rsyslog vim-minimal dhclient chkconfig rootfiles
|
4
|
-
policycoreutils fedora-release openssh-server net-tools nc traceroute
|
5
|
-
- bootstrap_fedora:
|
6
|
-
- check_cmd_out: yum
|
7
|
-
- check_cmd_out: curl
|
8
|
-
- exec_out: test -f "$$rootfs_archive" || mkdir -p $(dirname "$$rootfs_archive")
|
9
|
-
- exec_out: test -f "$$rootfs_archive" || ROOTFS=$(dirname "$$rootfs_archive")/rootfs
|
10
|
-
- exec_out: test -f "$$rootfs_archive" || mkdir -p $ROOTFS
|
11
|
-
- exec_out: test -f "$$rootfs_archive" || echo "Fetching release mirror"
|
12
|
-
- exec_out: test -f "$$rootfs_archive" || MIRROR_URL=$(curl -s -S -f "$$mirrorlist_url" | head -n2 | tail -n1)
|
13
|
-
- exec_out: test -f "$$rootfs_archive" || RELEASE_URL="$MIRROR_URL/Packages/f/fedora-release-$${release}-1.noarch.rpm"
|
14
|
-
- exec_out: test -f "$$rootfs_archive" || echo "Fetching from $RELEASE_URL"
|
15
|
-
- exec_out: test -f "$$rootfs_archive" || curl -sf "$RELEASE_URL" > "$(basename $RELEASE_URL)" 2> /dev/null
|
16
|
-
- exec_out: test -f "$$rootfs_archive" || mkdir -p $ROOTFS/var/lib/rpm
|
17
|
-
- exec_out: test -f "$$rootfs_archive" || rpm --root $ROOTFS --initdb
|
18
|
-
- exec_out: test -f "$$rootfs_archive" || rpm --root $ROOTFS -ivh "$(basename $RELEASE_URL)"
|
19
|
-
- exec_out: test -f "$$rootfs_archive" || yum --installroot $ROOTFS -y --nogpgcheck install $$include
|
20
|
-
- exec_out: test -f "$$rootfs_archive" || cat /etc/resolv.conf > $ROOTFS/etc/resolv.conf
|
21
|
-
- exec_out: test -f "$$rootfs_archive" || tar zcf "$$rootfs_archive" -C "$ROOTFS" --numeric-owner --one-file-system .
|
22
|
-
- exec_out: test -f "$$rootfs_archive" || rm -fr $ROOTFS
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# Prepare Appliance
|
2
|
-
- nbd_device: /dev/nbd0
|
3
|
-
|
4
|
-
- create_raw_image:
|
5
|
-
- check_cmd_out: qemu-img
|
6
|
-
- exec_out: mkdir -p checkpoints
|
7
|
-
- exec_out: |
|
8
|
-
if [ ! -e "$$container" ] ; then
|
9
|
-
qemu-img create -f qcow2 checkpoints/base_$$container $$image_size
|
10
|
-
ln -sf checkpoints/base_$$container $$container
|
11
|
-
fi
|
12
|
-
|
13
|
-
- load_nbd_module:
|
14
|
-
- on_bootstrap_init:
|
15
|
-
- exec_out: |
|
16
|
-
lsmod | grep nbd >/dev/null \
|
17
|
-
|| modprobe nbd max_part=63 \
|
18
|
-
|| fail failed to load nbd module into kernel
|
19
|
-
|
20
|
-
- attach_nbd_device:
|
21
|
-
- on_checkpoint: skip
|
22
|
-
- check_cmd_out: qemu-nbd
|
23
|
-
- exec_out: echo Connecting $$container to nbd device $$nbd_device
|
24
|
-
- exec_out: qemu-nbd -c $$nbd_device "$(readlink $$container)" -n || fail nbd device $$container is unavailable
|
25
|
-
|
26
|
-
|
27
|
-
- detach_nbd_device:
|
28
|
-
- on_checkpoint: redo
|
29
|
-
- on_export_clean:
|
30
|
-
- exec_out: echo "sync" ; sync
|
31
|
-
- exec_out: qemu-nbd -d $$nbd_device
|
32
|
-
- exec_out: "pgrep qemu-nbd | xargs -I {} kill -9 {} || true"
|
33
|
-
|
34
|
-
- partition_disk:
|
35
|
-
- check_cmd_out: sfdisk
|
36
|
-
- exec_out: |
|
37
|
-
echo "Partitioning disk..."
|
38
|
-
sfdisk $${nbd_device} -q -D -uM --force --no-reread <<< '
|
39
|
-
,200,83,*
|
40
|
-
;
|
41
|
-
' 2>&1 || fail cannot partition $$container
|
42
|
-
- exec_out: |
|
43
|
-
echo Creating boot partition...
|
44
|
-
mkfs.$$filesystem_type -q $${nbd_device}p1 || fail cannot create /boot ext4
|
45
|
-
- exec_out: |
|
46
|
-
echo Creating root partition...
|
47
|
-
mkfs.$$filesystem_type -q $${nbd_device}p2 || fail cannot create / ext4
|
48
|
-
|
49
|
-
- mount_mountdir:
|
50
|
-
- on_checkpoint: redo
|
51
|
-
- exec_out: mkdir -p $$mountdir
|
52
|
-
- exec_out: "echo Mounting root partition... ; mount $${nbd_device}p2 $$mountdir || fail cannot mount /"
|
53
|
-
- on_export_clean:
|
54
|
-
- exec_out: "echo try umount $$mountdir... ; mountpoint -q $$mountdir && umount -f -l $$mountdir || true"
|
55
|
-
- exec_out: "test -d $$mountdir && rmdir $$mountdir || true"
|
56
|
-
- exec_out: mkdir -p $$mountdir/boot
|
57
|
-
- exec_out: "echo Mounting boot partition... ; mount $${nbd_device}p1 $$mountdir/boot || fail cannot mount /boot"
|
58
|
-
- on_export_clean:
|
59
|
-
- exec_out: "echo try umount $$mountdir/boot... ; mountpoint -q $$mountdir/boot && umount -f -l $$mountdir/boot || true"
|
60
|
-
- exec_out: "test -d $$mountdir/boot && rmdir $$mountdir/boot || true"
|
61
|
-
|
62
|
-
- copy_rootfs:
|
63
|
-
- exec_out: tar -xf $$rootfs_archive -C $$mountdir
|
64
|
-
- exec_out: echo "sync..." ; sync
|
65
|
-
|
66
|
-
- create_fstab:
|
67
|
-
- write_out:
|
68
|
-
- $$mountdir/etc/fstab
|
69
|
-
- |
|
70
|
-
# /etc/fstab: static file system information.
|
71
|
-
#
|
72
|
-
# Use 'blkid' to print the universally unique identifier for a
|
73
|
-
# device; this may be used with UUID= as a more robust way to name devices
|
74
|
-
# that works even if disks are added and removed. See fstab(5).
|
75
|
-
#
|
76
|
-
# <file system> <mount point> <type> <options> <dump> <pass>
|
77
|
-
UUID=`blkid -s UUID -o value $${nbd_device}p2` / $$filesystem_type errors=remount-ro 0 1
|
78
|
-
UUID=`blkid -s UUID -o value $${nbd_device}p1` /boot $$filesystem_type sync 0 2
|
79
|
-
|
80
|
-
|
81
|
-
- install_bootloader:
|
82
|
-
- on_export_init:
|
83
|
-
- exec_in: extlinux-install $$nbd_device 2>&1
|
84
|
-
- write_in:
|
85
|
-
- /boot/extlinux/extlinux.conf
|
86
|
-
- |
|
87
|
-
default linux
|
88
|
-
timeout 1
|
89
|
-
|
90
|
-
label linux
|
91
|
-
kernel ../`basename /boot/vmlinuz*`
|
92
|
-
append initrd=../`basename /boot/init*` root=UUID=`blkid -s UUID -o value $${nbd_device}p2` ro
|
93
|
-
- exec_out: echo " sync..." ; sync
|
@@ -1,105 +0,0 @@
|
|
1
|
-
- nbd_device: /dev/nbd1
|
2
|
-
|
3
|
-
- export_targz:
|
4
|
-
- on_export_init:
|
5
|
-
- exec_out: echo "Exporting the rootfs..."
|
6
|
-
- exec_out: docker export $(cat MAIN_CONTAINER_ID) > $$filename.tar.gz
|
7
|
-
|
8
|
-
- create_raw_image:
|
9
|
-
- check_cmd_out: qemu-img
|
10
|
-
- exec_out: bash -c "qemu-img create -f $$format $$filename.$$format $$image_size"
|
11
|
-
|
12
|
-
- load_nbd_module:
|
13
|
-
- on_bootstrap_init:
|
14
|
-
- exec_out: |
|
15
|
-
lsmod | grep nbd >/dev/null \
|
16
|
-
|| modprobe nbd max_part=63 \
|
17
|
-
|| fail failed to load nbd module into kernel
|
18
|
-
|
19
|
-
- attach_nbd_device:
|
20
|
-
- on_checkpoint: redo
|
21
|
-
- check_cmd_out: qemu-nbd
|
22
|
-
- exec_out: echo Connecting $$filename.$$format to nbd device $$nbd_device
|
23
|
-
- exec_out: qemu-nbd -c $$nbd_device $$filename.$$format || fail nbd device $$filename.$$format is unavailable
|
24
|
-
- on_export_clean:
|
25
|
-
- exec_out: echo "sync" ; sync
|
26
|
-
- exec_out: qemu-nbd -d $$nbd_device
|
27
|
-
- exec_out: "pgrep qemu-nbd | xargs -I {} kill -9 {} || true"
|
28
|
-
|
29
|
-
- partition_disk:
|
30
|
-
- check_cmd_out: sfdisk
|
31
|
-
- exec_out: |
|
32
|
-
echo "Partitioning disk..."
|
33
|
-
sfdisk $${nbd_device} -q -D -uM --force --no-reread <<< '
|
34
|
-
,200,83,*
|
35
|
-
;
|
36
|
-
' 2>&1 || fail cannot partition $$filename.$$format
|
37
|
-
- exec_out: |
|
38
|
-
echo Creating boot partition...
|
39
|
-
mkfs.$$filesystem_type -q $${nbd_device}p1 || fail cannot create /boot ext4
|
40
|
-
- exec_out: |
|
41
|
-
echo Creating root partition...
|
42
|
-
mkfs.$$filesystem_type -q $${nbd_device}p2 || fail cannot create / ext4
|
43
|
-
|
44
|
-
- mount_mountdir:
|
45
|
-
- on_checkpoint: redo
|
46
|
-
- exec_out: mkdir -p $$mountdir
|
47
|
-
- exec_out: "echo Mounting root partition... ; mount $${nbd_device}p2 $$mountdir || fail cannot mount /"
|
48
|
-
- on_export_clean:
|
49
|
-
- exec_out: "echo try umount $$mountdir... ; mountpoint -q $$mountdir && umount -f -l $$mountdir || true"
|
50
|
-
- exec_out: "test -d $$mountdir && rmdir $$mountdir || true"
|
51
|
-
- exec_out: mkdir -p $$mountdir/boot
|
52
|
-
- exec_out: "echo Mounting boot partition... ; mount $${nbd_device}p1 $$mountdir/boot || fail cannot mount /boot"
|
53
|
-
- on_export_clean:
|
54
|
-
- exec_out: "echo try umount $$mountdir/boot... ; mountpoint -q $$mountdir/boot && umount -f -l $$mountdir/boot || true"
|
55
|
-
- exec_out: "test -d $$mountdir/boot && rmdir $$mountdir/boot || true"
|
56
|
-
|
57
|
-
- copy_rootfs:
|
58
|
-
- exec_out: echo "Copying the rootfs to $$mountdir..."
|
59
|
-
- exec_out: tar -xf $$filename.tar.gz -C $$mountdir
|
60
|
-
- exec_out: rm -f $$mountdir/.dockerinit
|
61
|
-
- exec_out: rm -f $$mountdir/.dockerenv
|
62
|
-
- exec_out: echo "sync..." ; sync
|
63
|
-
|
64
|
-
- create_fstab:
|
65
|
-
- write_out:
|
66
|
-
- $$mountdir/etc/fstab
|
67
|
-
- |
|
68
|
-
# /etc/fstab: static file system information.
|
69
|
-
#
|
70
|
-
# Use 'blkid' to print the universally unique identifier for a
|
71
|
-
# device; this may be used with UUID= as a more robust way to name devices
|
72
|
-
# that works even if disks are added and removed. See fstab(5).
|
73
|
-
#
|
74
|
-
# <file system> <mount point> <type> <options> <dump> <pass>
|
75
|
-
UUID=`blkid -s UUID -o value $${nbd_device}p2` / $$filesystem_type errors=remount-ro 0 1
|
76
|
-
UUID=`blkid -s UUID -o value $${nbd_device}p1` /boot $$filesystem_type sync 0 2
|
77
|
-
- exec_out: echo "sync..." ; sync
|
78
|
-
|
79
|
-
- mount_chroot:
|
80
|
-
- on_checkpoint: redo
|
81
|
-
- check_cmd_out: chroot
|
82
|
-
- exec_out: mount -o bind /dev $$mountdir/dev
|
83
|
-
- exec_out: mount -o bind /dev/pts $$mountdir/dev/pts
|
84
|
-
- exec_out: mount -t proc /proc $$mountdir/proc
|
85
|
-
- exec_out: mount -t sysfs /sys $$mountdir/sys
|
86
|
-
- exec_out: test -f $$mountdir/etc/mtab || cat /proc/mounts > $$mountdir/etc/mtab
|
87
|
-
- on_export_clean:
|
88
|
-
- exec_out: echo try umount $$mountdir/sys... ; mountpoint -q $$mountdir/sys && umount -f -l $$mountdir/sys || true
|
89
|
-
- exec_out: echo try umount $$mountdir/proc... ; mountpoint -q $$mountdir/proc && umount -f -l $$mountdir/proc || true
|
90
|
-
- exec_out: echo try umount $$mountdir/dev/pts... ; mountpoint -q $$mountdir/dev/pts && umount -f -l $$mountdir/dev/pts || true
|
91
|
-
- exec_out: echo try umount $$mountdir/dev... ; mountpoint -q $$mountdir/dev && umount -f -l $$mountdir/dev || true
|
92
|
-
|
93
|
-
- install_bootloader:
|
94
|
-
- check_cmd_out: extlinux-install
|
95
|
-
- exec_out: chroot $$mountdir extlinux-install $$nbd_device 2>&1
|
96
|
-
- write_out:
|
97
|
-
- $$mountdir/boot/extlinux/extlinux.conf
|
98
|
-
- |
|
99
|
-
default linux
|
100
|
-
timeout 1
|
101
|
-
|
102
|
-
label linux
|
103
|
-
kernel ../`basename $$mountdir/boot/vmlinuz*`
|
104
|
-
append initrd=../`basename $$mountdir/boot/init*` root=UUID=`blkid -s UUID -o value $${nbd_device}p2` ro
|
105
|
-
- exec_out: echo "sync..." ; sync
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# # Save Chroot Appliance
|
2
|
-
- save_as_tgz:
|
3
|
-
- exec_out: echo "sync..." ; sync
|
4
|
-
- in2out:
|
5
|
-
- /etc/fstab
|
6
|
-
- ./fstab.bak
|
7
|
-
- on_clean:
|
8
|
-
- exec_out: rm -f ./fstab.bak
|
9
|
-
- write_in:
|
10
|
-
- /etc/fstab
|
11
|
-
- |
|
12
|
-
# UNCONFIGURED FSTAB FOR BASE SYSTEM
|
13
|
-
- pipe:
|
14
|
-
- exec_in: |
|
15
|
-
tar -zcf - --numeric-owner \
|
16
|
-
--exclude=tmp/* \
|
17
|
-
--exclude=dev/* \
|
18
|
-
--exclude=proc/* \
|
19
|
-
--exclude=sys/* \
|
20
|
-
--exclude=run/* \
|
21
|
-
--exclude=mnt/* \
|
22
|
-
--exclude=media/* \
|
23
|
-
--exclude=lost+found/* \
|
24
|
-
-C / .
|
25
|
-
- exec_out: cat > ./$$filename.tar.gz
|
26
|
-
- out2in:
|
27
|
-
- ./fstab.bak
|
28
|
-
- /etc/fstab
|
29
|
-
- exec_out: |
|
30
|
-
echo "Saved tar.gz appliance to $(pwd)/$$filename.tar.gz"
|
31
|
-
|
32
|
-
- save_as_raw:
|
33
|
-
- exec_out: echo "sync..." ; sync
|
34
|
-
- exec_out: |
|
35
|
-
qemu-img convert -O raw $(readlink $$container) $$filename.raw
|
36
|
-
- exec_out: echo "Saved raw appliance to $(pwd)/$$filename.raw"
|
37
|
-
|
38
|
-
- save_as_qcow2:
|
39
|
-
- exec_out: echo "sync..." ; sync
|
40
|
-
- exec_out: |
|
41
|
-
qemu-img convert -O qcow2 $(readlink $$container) $$filename.qcow2
|
42
|
-
- exec_out: echo "Saved qcow2 appliance to $(pwd)/$$filename.qcow2"
|
43
|
-
|
44
|
-
- save_as_vmdk:
|
45
|
-
- exec_out: echo "sync..." ; sync
|
46
|
-
- exec_out: |
|
47
|
-
qemu-img convert -O vmdk $(readlink $$container) $$filename.vmdk
|
48
|
-
- exec_out: echo "Saved vmdk appliance to $(pwd)/$$filename.vmdk"
|
49
|
-
|
50
|
-
- save_as_vdi:
|
51
|
-
- exec_out: echo "sync..." ; sync
|
52
|
-
- exec_out: |
|
53
|
-
qemu-img convert -O vdi $(readlink $$container) $$filename.vdi
|
54
|
-
- exec_out: echo "Saved vdi appliance to $(pwd)/$$filename.vdi"
|