kameleon-builder 2.2.5 → 2.3.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.rst +21 -0
- data/{templates → contrib}/steps/bootstrap/debian/debootstrap_arm.yaml +1 -1
- data/{templates → contrib}/steps/export/clean_appliance.yaml +0 -0
- data/{templates → contrib}/steps/export/compact_qcow_img.yaml +0 -0
- data/{templates → contrib}/steps/setup/archlinux/configure_ruby.yaml +0 -0
- data/{templates → contrib}/steps/setup/archlinux/install_dev_tools.yaml +0 -0
- data/{templates → contrib}/steps/setup/archlinux/install_gnome.yaml +0 -0
- data/{templates → contrib}/steps/setup/archlinux/install_yaourt.yaml +0 -0
- data/{templates → contrib}/steps/setup/centos/6.5/configure_repo.yaml +0 -0
- data/{templates → contrib}/steps/setup/debian/install_gnome.yaml +0 -0
- data/{templates → contrib}/steps/setup/debian/install_kde.yaml +0 -0
- data/{templates → erb}/extend.erb +2 -2
- data/erb/userconf.erb +5 -0
- data/kameleon-builder.gemspec +6 -1
- data/lib/kameleon.rb +53 -3
- data/lib/kameleon/cli.rb +146 -99
- data/lib/kameleon/engine.rb +20 -8
- data/lib/kameleon/environment.rb +11 -10
- data/lib/kameleon/persistent_cache.rb +1 -9
- data/lib/kameleon/recipe.rb +52 -24
- data/lib/kameleon/repository.rb +46 -0
- data/lib/kameleon/utils.rb +49 -0
- data/{templates → tests/recipes}/steps/aliases/defaults.yaml +0 -0
- data/tests/recipes/steps/bootstrap/linux/bootstrap.yaml +2 -0
- data/tests/recipes/steps/checkpoints/test.yaml +14 -0
- data/tests/recipes/steps/enable_something.yaml +2 -0
- data/tests/recipes/steps/export/save_appliance.yaml +10 -0
- data/tests/recipes/steps/setup/linux/software_install.yaml +7 -0
- data/tests/recipes/test_recipe.yaml +41 -0
- data/version.txt +1 -1
- metadata +34 -139
- data/templates/COPYRIGHT +0 -21
- data/templates/chroot/debian7-amd64.yaml +0 -119
- data/templates/docker/debian7.yaml +0 -107
- data/templates/grid5000/debian7.yaml +0 -97
- data/templates/qemu/archlinux-desktop-i686.yaml +0 -25
- data/templates/qemu/archlinux-desktop-x86_64.yaml +0 -25
- data/templates/qemu/archlinux-i686.yaml +0 -25
- data/templates/qemu/archlinux-x86_64.yaml +0 -109
- data/templates/qemu/centos6.5-x86_64.yaml +0 -122
- data/templates/qemu/centos7-x86_64.yaml +0 -122
- data/templates/qemu/debian7-amd64.yaml +0 -134
- data/templates/qemu/debian7-desktop-amd64.yaml +0 -24
- data/templates/qemu/debian7-kameleon-amd64.yaml +0 -40
- data/templates/qemu/debian7-oar-amd64.yaml +0 -51
- data/templates/qemu/debian8-amd64.yaml +0 -25
- data/templates/qemu/fedora20-desktop-x86_64.yaml +0 -21
- data/templates/qemu/fedora20-x86_64.yaml +0 -119
- data/templates/qemu/ubuntu-12.04-amd64.yaml +0 -132
- data/templates/qemu/ubuntu-12.04-desktop-amd64.yaml +0 -25
- data/templates/qemu/ubuntu-14.04-amd64.yaml +0 -25
- data/templates/qemu/ubuntu-14.04-desktop-amd64.yaml +0 -27
- data/templates/steps/bootstrap/archlinux/arch_bootstrap.yaml +0 -211
- data/templates/steps/bootstrap/centos/6.5/yum_bootstrap.yaml +0 -67
- data/templates/steps/bootstrap/debian/debootstrap.yaml +0 -20
- data/templates/steps/bootstrap/fedora/init_pxeboot.yaml +0 -13
- data/templates/steps/bootstrap/fedora/yum_bootstrap.yaml +0 -45
- data/templates/steps/bootstrap/g5k_reserv.yaml +0 -70
- data/templates/steps/bootstrap/initialize_disk.yaml +0 -16
- data/templates/steps/bootstrap/initialize_disk_chroot.yaml +0 -80
- data/templates/steps/bootstrap/install_requirements.yaml +0 -3
- data/templates/steps/bootstrap/prepare_chroot.yaml +0 -126
- data/templates/steps/bootstrap/prepare_docker.yaml +0 -51
- data/templates/steps/bootstrap/prepare_qemu.yaml +0 -41
- data/templates/steps/bootstrap/prepare_virtualbox.yaml +0 -67
- data/templates/steps/bootstrap/start_chroot.yaml +0 -51
- data/templates/steps/bootstrap/start_docker.yaml +0 -16
- data/templates/steps/bootstrap/start_qemu.yaml +0 -74
- data/templates/steps/bootstrap/start_virtualbox.yaml +0 -38
- data/templates/steps/bootstrap/switch_context_qemu.yaml +0 -84
- data/templates/steps/bootstrap/switch_context_virtualbox.yaml +0 -86
- data/templates/steps/breakpoint.yaml +0 -3
- data/templates/steps/checkpoints/docker.yaml +0 -17
- data/templates/steps/checkpoints/qcow2.yaml +0 -40
- data/templates/steps/checkpoints/qemu.yaml +0 -33
- data/templates/steps/checkpoints/virtualbox.yaml +0 -21
- data/templates/steps/disable_checkpoint.yaml +0 -3
- data/templates/steps/enable_checkpoint.yaml +0 -5
- data/templates/steps/export/qemu_save_appliance.yaml +0 -52
- data/templates/steps/export/save_appliance_from_g5k.yaml +0 -47
- data/templates/steps/export/vagrant_save_appliance.yaml +0 -14
- data/templates/steps/export/virtualbox_save_appliance.yaml +0 -61
- data/templates/steps/setup/archlinux/configure_keyboard.yaml +0 -9
- data/templates/steps/setup/archlinux/configure_network.yaml +0 -9
- data/templates/steps/setup/archlinux/configure_system.yaml +0 -20
- data/templates/steps/setup/archlinux/install_bootloader.yaml +0 -23
- data/templates/steps/setup/archlinux/install_software.yaml +0 -9
- data/templates/steps/setup/autologin.yaml +0 -16
- data/templates/steps/setup/centos/6.5/configure_network.yaml +0 -33
- data/templates/steps/setup/centos/6.5/configure_system.yaml +0 -46
- data/templates/steps/setup/centos/6.5/minimal_install.yaml +0 -3
- data/templates/steps/setup/centos/6.5/setup_vagrant_box.yaml +0 -77
- data/templates/steps/setup/create_group.yaml +0 -12
- data/templates/steps/setup/create_user.yaml +0 -11
- data/templates/steps/setup/debian/configure_apt.yaml +0 -73
- data/templates/steps/setup/debian/configure_kernel.yaml +0 -13
- data/templates/steps/setup/debian/configure_keyboard.yaml +0 -10
- data/templates/steps/setup/debian/configure_network.yaml +0 -30
- data/templates/steps/setup/debian/configure_system.yaml +0 -12
- data/templates/steps/setup/debian/install_bootloader.yaml +0 -36
- data/templates/steps/setup/debian/install_software.yaml +0 -2
- data/templates/steps/setup/debian/oar/oar_debian_config_frontend.yaml +0 -8
- data/templates/steps/setup/debian/oar/oar_debian_config_node.yaml +0 -5
- data/templates/steps/setup/debian/oar/oar_debian_config_server.yaml +0 -5
- data/templates/steps/setup/debian/oar/oar_prereq_install.yaml +0 -16
- data/templates/steps/setup/debian/setup_vagrant_box.yaml +0 -80
- data/templates/steps/setup/debian/upgrade_system.yaml +0 -10
- data/templates/steps/setup/fedora/configure_kernel.yaml +0 -9
- data/templates/steps/setup/fedora/configure_keyboard.yaml +0 -12
- data/templates/steps/setup/fedora/configure_network.yaml +0 -38
- data/templates/steps/setup/fedora/configure_system.yaml +0 -52
- data/templates/steps/setup/fedora/install_bootloader.yaml +0 -53
- data/templates/steps/setup/fedora/install_software.yaml +0 -3
- data/templates/steps/setup/fedora/minimal_install.yaml +0 -3
- data/templates/steps/setup/fedora/update_system.yaml +0 -16
- data/templates/steps/setup/oar/oar_config_devel.yaml +0 -21
- data/templates/steps/setup/oar/oar_config_frontend.yaml +0 -38
- data/templates/steps/setup/oar/oar_config_node.yaml +0 -4
- data/templates/steps/setup/oar/oar_config_server.yaml +0 -25
- data/templates/steps/setup/oar/oar_config_system.yaml +0 -34
- data/templates/steps/setup/oar/oar_devel_prereq_install.yaml +0 -5
- data/templates/steps/setup/oar/oar_git_install.yaml +0 -21
- data/templates/steps/setup/ubuntu/configure_apt.yaml +0 -62
- data/templates/virtualbox/archlinux-desktop-i686.yaml +0 -25
- data/templates/virtualbox/archlinux-desktop-x86_64.yaml +0 -28
- data/templates/virtualbox/archlinux-i686.yaml +0 -28
- data/templates/virtualbox/archlinux-x86_64.yaml +0 -108
- data/templates/virtualbox/centos6.5-i386.yaml +0 -39
- data/templates/virtualbox/centos6.5-vagrant-x86_64.yaml +0 -33
- data/templates/virtualbox/centos6.5-x86_64.yaml +0 -121
- data/templates/virtualbox/centos7-x86_64.yaml +0 -118
- data/templates/virtualbox/debian7-amd64.yaml +0 -128
- data/templates/virtualbox/debian7-desktop-amd64.yaml +0 -25
- data/templates/virtualbox/debian7-i386.yaml +0 -31
- data/templates/virtualbox/debian7-kameleon-amd64.yaml +0 -38
- data/templates/virtualbox/debian7-oar-amd64.yaml +0 -51
- data/templates/virtualbox/debian7-vagrant-amd64.yaml +0 -32
- data/templates/virtualbox/debian8-amd64.yaml +0 -25
- data/templates/virtualbox/debian8-i386.yaml +0 -31
- data/templates/virtualbox/fedora20-x86_64.yaml +0 -118
- data/templates/virtualbox/ubuntu-12.04-amd64.yaml +0 -128
- data/templates/virtualbox/ubuntu-12.04-desktop-amd64.yaml +0 -25
- data/templates/virtualbox/ubuntu-14.04-amd64.yaml +0 -25
- data/templates/virtualbox/ubuntu-14.04-desktop-amd64.yaml +0 -27
- data/tests/recipes/dummy_recipe.yaml +0 -48
- data/tests/recipes/steps/bootstrap/dummy_distro/dummy_bootstrap_static.yaml +0 -4
- data/tests/recipes/steps/export/dummy_save_appliance.yaml +0 -9
- data/tests/recipes/steps/setup/default/dummy_root_passwd.yaml +0 -8
- data/tests/recipes/steps/setup/dummy_distro/dummy_software_install.yaml +0 -7
@@ -1,132 +0,0 @@
|
|
1
|
-
#==============================================================================
|
2
|
-
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
-
#==============================================================================
|
4
|
-
#
|
5
|
-
# DESCRIPTION: Ubuntu 12.04 LTS (Precise Pangolin) base system (amd64).
|
6
|
-
#
|
7
|
-
#==============================================================================
|
8
|
-
|
9
|
-
---
|
10
|
-
# Loads some helpful aliases
|
11
|
-
aliases: defaults.yaml
|
12
|
-
# Enables qemu checkpoint
|
13
|
-
checkpoint: qemu.yaml
|
14
|
-
#== Global variables use by Kameleon engine and the steps
|
15
|
-
global:
|
16
|
-
## User varibales : used by the recipe
|
17
|
-
user_name: kameleon
|
18
|
-
user_password: $$user_name
|
19
|
-
|
20
|
-
# Distribution
|
21
|
-
distrib: ubuntu
|
22
|
-
release: precise
|
23
|
-
arch: amd64
|
24
|
-
kernel_arch: $$arch
|
25
|
-
hostname: kameleon-$$distrib
|
26
|
-
|
27
|
-
## QEMU options
|
28
|
-
qemu_enable_kvm: "$(egrep '(vmx|svm)' /proc/cpuinfo > /dev/null && echo true)"
|
29
|
-
qemu_cpu: 2
|
30
|
-
qemu_memory_size: 768
|
31
|
-
qemu_monitor_socket: $$kameleon_cwd/qemu_monitor.socket
|
32
|
-
qemu_ssh_port: 55423
|
33
|
-
qemu_arch: x86_64
|
34
|
-
qemu_image_size: 10G
|
35
|
-
qemu_image_disk: $$kameleon_cwd/base_$$kameleon_recipe_name.qcow2
|
36
|
-
qemu_pidfile: $$kameleon_cwd/qemu.pid
|
37
|
-
|
38
|
-
## Kameleon iso bootstrap
|
39
|
-
boot2kameleon_url: http://kameleon.imag.fr/iso/boot2debian/debian-jessie-$${qemu_arch}-insecure.iso
|
40
|
-
insecure_ssh_key_url: http://kameleon.imag.fr/iso/boot2debian/keys/insecure_id_rsa
|
41
|
-
|
42
|
-
# rootfs options
|
43
|
-
disk_device: /dev/vda
|
44
|
-
rootfs: /rootfs
|
45
|
-
filesystem_type: ext4
|
46
|
-
|
47
|
-
# rootfs options
|
48
|
-
rootfs: /rootfs
|
49
|
-
|
50
|
-
# Apt options
|
51
|
-
apt_repository: http://archive.ubuntu.com/ubuntu/
|
52
|
-
apt_enable_restricted: true
|
53
|
-
|
54
|
-
## System variables. Required by kameleon engine
|
55
|
-
# Include specific steps
|
56
|
-
include_steps:
|
57
|
-
- $$distrib/$$release
|
58
|
-
- $$distrib
|
59
|
-
- debian
|
60
|
-
|
61
|
-
ssh_config_file: $$kameleon_cwd/ssh_config
|
62
|
-
out_context:
|
63
|
-
cmd: ssh -F $$ssh_config_file $${kameleon_recipe_name} -t /bin/bash
|
64
|
-
workdir: /root/kameleon_workdir
|
65
|
-
proxy_cache: 10.0.2.2
|
66
|
-
|
67
|
-
in_context:
|
68
|
-
cmd: ssh -F $$ssh_config_file $${kameleon_recipe_name} -t /bin/bash
|
69
|
-
workdir: /root/kameleon_workdir
|
70
|
-
proxy_cache: 10.0.2.2
|
71
|
-
|
72
|
-
#== Bootstrap the new system and create the 'in_context'
|
73
|
-
bootstrap:
|
74
|
-
- prepare_qemu
|
75
|
-
- start_qemu
|
76
|
-
- install_requirements:
|
77
|
-
- packages: parted e2fsprogs debootstrap extlinux
|
78
|
-
- enable_checkpoint
|
79
|
-
- initialize_disk
|
80
|
-
- debootstrap:
|
81
|
-
- include_pkg: >
|
82
|
-
apt-transport-https ca-certificates less acpid acpi-support kbd bzip2 udev
|
83
|
-
locales psmisc linux-image-generic ifupdown iptables iputils-ping
|
84
|
-
iproute pciutils isc-dhcp-client openssh-server
|
85
|
-
- release: $$release
|
86
|
-
- arch: $$arch
|
87
|
-
- repository: $$apt_repository
|
88
|
-
- variant: minbase
|
89
|
-
- switch_context_qemu
|
90
|
-
|
91
|
-
|
92
|
-
#== Install and configuration steps
|
93
|
-
setup:
|
94
|
-
# Install
|
95
|
-
- configure_apt:
|
96
|
-
- repository: $$apt_repository
|
97
|
-
- enable_restricted: $$apt_enable_restricted
|
98
|
-
- upgrade_system:
|
99
|
-
- dist_upgrade: true
|
100
|
-
- install_software:
|
101
|
-
- packages: >
|
102
|
-
bash-completion curl nano vim language-pack-en extlinux sudo
|
103
|
-
- configure_kernel:
|
104
|
-
- arch: $$arch
|
105
|
-
- install_bootloader
|
106
|
-
# Configuration
|
107
|
-
- configure_system:
|
108
|
-
- locales: POSIX C en_US fr_FR de_DE
|
109
|
-
- lang: en_US.UTF-8
|
110
|
-
- timezone: UTC
|
111
|
-
- configure_keyboard:
|
112
|
-
- layout: "us,fr,de"
|
113
|
-
- configure_network
|
114
|
-
- create_group:
|
115
|
-
- name: admin
|
116
|
-
- create_user:
|
117
|
-
- name: $$user_name
|
118
|
-
- groups: sudo admin
|
119
|
-
- password: $$user_password
|
120
|
-
|
121
|
-
#== Export the generated appliance in the format of your choice
|
122
|
-
export:
|
123
|
-
- disable_checkpoint
|
124
|
-
- qemu_save_appliance:
|
125
|
-
- input: $$qemu_image_disk
|
126
|
-
- output: $$kameleon_cwd/$$kameleon_recipe_name
|
127
|
-
- save_as_qcow2
|
128
|
-
# - save_as_qed
|
129
|
-
# - save_as_tgz
|
130
|
-
# - save_as_raw
|
131
|
-
# - save_as_vmdk
|
132
|
-
# - save_as_vdi
|
@@ -1,25 +0,0 @@
|
|
1
|
-
#==============================================================================
|
2
|
-
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
-
#==============================================================================
|
4
|
-
#
|
5
|
-
# DESCRIPTION: Ubuntu 12.04 LTS (Precise Pangolin) Desktop edition (amd64).
|
6
|
-
#
|
7
|
-
#==============================================================================
|
8
|
-
|
9
|
-
---
|
10
|
-
extend: ubuntu-12.04-amd64
|
11
|
-
|
12
|
-
global:
|
13
|
-
# Apt options
|
14
|
-
virtualbox_memory_size: 1024
|
15
|
-
|
16
|
-
bootstrap:
|
17
|
-
- "@base"
|
18
|
-
|
19
|
-
setup:
|
20
|
-
- "@base"
|
21
|
-
- install_software:
|
22
|
-
- packages: ubuntu-desktop
|
23
|
-
|
24
|
-
export:
|
25
|
-
- "@base"
|
@@ -1,25 +0,0 @@
|
|
1
|
-
#==============================================================================
|
2
|
-
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
-
#==============================================================================
|
4
|
-
#
|
5
|
-
# DESCRIPTION: Ubuntu 14.04 LTS (Trusty Tahr) base system (amd64).
|
6
|
-
#
|
7
|
-
#==============================================================================
|
8
|
-
|
9
|
-
---
|
10
|
-
extend: ubuntu-12.04-amd64
|
11
|
-
|
12
|
-
global:
|
13
|
-
# Distribution
|
14
|
-
distrib: ubuntu
|
15
|
-
release: trusty
|
16
|
-
arch: amd64
|
17
|
-
|
18
|
-
bootstrap:
|
19
|
-
- "@base"
|
20
|
-
|
21
|
-
setup:
|
22
|
-
- "@base"
|
23
|
-
|
24
|
-
export:
|
25
|
-
- "@base"
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#==============================================================================
|
2
|
-
# vim: softtabstop=2 shiftwidth=2 expandtab fenc=utf-8 cc=81 tw=80
|
3
|
-
#==============================================================================
|
4
|
-
#
|
5
|
-
# DESCRIPTION: Ubuntu 14.04 LTS (Trusty Tahr) Desktop edition (amd64).
|
6
|
-
#
|
7
|
-
#==============================================================================
|
8
|
-
|
9
|
-
---
|
10
|
-
extend: ubuntu-14.04-amd64
|
11
|
-
|
12
|
-
global:
|
13
|
-
# Distribution
|
14
|
-
distrib: ubuntu
|
15
|
-
release: trusty
|
16
|
-
arch: amd64
|
17
|
-
|
18
|
-
bootstrap:
|
19
|
-
- "@base"
|
20
|
-
|
21
|
-
setup:
|
22
|
-
- "@base"
|
23
|
-
- install_software:
|
24
|
-
- packages: ubuntu-desktop
|
25
|
-
|
26
|
-
export:
|
27
|
-
- "@base"
|
@@ -1,211 +0,0 @@
|
|
1
|
-
# Arch-bootstrap
|
2
|
-
#
|
3
|
-
# Call the arch-bootstrap.sh script to bootstrap an archlinux distro from
|
4
|
-
# any GNU system
|
5
|
-
|
6
|
-
# You can choose any group from https://www.archlinux.org/groups/
|
7
|
-
# It's recommended to use 'base' (default) or 'base-devel' (with dev tools)
|
8
|
-
|
9
|
-
- pkg_group: base
|
10
|
-
|
11
|
-
- import_script:
|
12
|
-
- exec_out: |
|
13
|
-
cat > $KAMELEON_WORKDIR/arch-bootstrap.sh <<'EOF'
|
14
|
-
#!/bin/bash
|
15
|
-
#
|
16
|
-
# arch-bootstrap: Bootstrap a base Arch Linux system using any GNU distribution.
|
17
|
-
#
|
18
|
-
# Dependencies: bash >= 4, coreutils, wget, sed, gawk, tar, gzip, chroot, xz.
|
19
|
-
# Project: https://github.com/tokland/arch-bootstrap
|
20
|
-
#
|
21
|
-
# Install:
|
22
|
-
#
|
23
|
-
# # install -m 755 arch-bootstrap.sh /usr/local/bin/arch-bootstrap
|
24
|
-
#
|
25
|
-
# Some examples:
|
26
|
-
#
|
27
|
-
# # arch-bootstrap destination
|
28
|
-
# # arch-bootstrap -a x86_64 -r ftp://ftp.archlinux.org destination-x86_64
|
29
|
-
#
|
30
|
-
# And then you can chroot to the destination directory (root/root):
|
31
|
-
#
|
32
|
-
# # chroot destination
|
33
|
-
|
34
|
-
set -e -u -o pipefail
|
35
|
-
|
36
|
-
# Packages needed by pacman (see get-pacman-dependencies.sh)
|
37
|
-
PACMAN_PACKAGES=(
|
38
|
-
acl archlinux-keyring attr bzip2 curl expat glibc gpgme libarchive
|
39
|
-
libassuan libgpg-error libssh2 lzo2 openssl pacman pacman-mirrorlist xz
|
40
|
-
zlib krb5 e2fsprogs keyutils
|
41
|
-
)
|
42
|
-
BASIC_PACKAGES=(${PACMAN_PACKAGES[*]} filesystem)
|
43
|
-
EXTRA_PACKAGES=(
|
44
|
-
$$pkg_group haveged
|
45
|
-
)
|
46
|
-
DEFAULT_REPO_URL="http://mirrors.kernel.org/archlinux"
|
47
|
-
DEFAULT_ARCH=`uname -m`
|
48
|
-
|
49
|
-
# Output to standard error
|
50
|
-
stderr() { echo "$@" >&2; }
|
51
|
-
|
52
|
-
# Output debug message to standard error
|
53
|
-
debug() { echo "--- $@"; }
|
54
|
-
|
55
|
-
# Extract href attribute from HTML link
|
56
|
-
extract_href() { sed -n '/<a / s/^.*<a [^>]*href="\([^\"]*\)".*$/\1/p'; }
|
57
|
-
|
58
|
-
# Simple wrapper around wget
|
59
|
-
fetch() { wget -c --passive-ftp --quiet "$@"; }
|
60
|
-
|
61
|
-
# Extract FILEPATH gz/xz archive to DEST directory
|
62
|
-
uncompress() {
|
63
|
-
local FILEPATH=$1 DEST=$2
|
64
|
-
|
65
|
-
case "$FILEPATH" in
|
66
|
-
*.gz) tar xzf "$FILEPATH" -C "$DEST";;
|
67
|
-
*.xz) xz -dc "$FILEPATH" | tar x -C "$DEST";;
|
68
|
-
*) debug "Error: unknown package format: $FILEPATH"
|
69
|
-
return 1;;
|
70
|
-
esac
|
71
|
-
}
|
72
|
-
|
73
|
-
###
|
74
|
-
|
75
|
-
configure_pacman() {
|
76
|
-
local DEST=$1 ARCH=$2
|
77
|
-
debug "configure DNS and pacman"
|
78
|
-
cp "/etc/resolv.conf" "$DEST/etc/resolv.conf"
|
79
|
-
echo "Server = $REPO_URL/\$repo/os/$ARCH" >> "$DEST/etc/pacman.d/mirrorlist"
|
80
|
-
}
|
81
|
-
|
82
|
-
configure_minimal_system() {
|
83
|
-
local DEST=$1
|
84
|
-
|
85
|
-
mkdir -p "$DEST/dev"
|
86
|
-
echo "root:x:0:0:root:/root:/bin/bash" > "$DEST/etc/passwd"
|
87
|
-
echo 'root:$1$GT9AUpJe$oXANVIjIzcnmOpY07iaGi/:14657::::::' > "$DEST/etc/shadow"
|
88
|
-
touch "$DEST/etc/group"
|
89
|
-
echo "bootstrap" > "$DEST/etc/hostname"
|
90
|
-
|
91
|
-
test -e "$DEST/etc/mtab" || echo "rootfs / rootfs rw 0 0" > "$DEST/etc/mtab"
|
92
|
-
test -e "$DEST/dev/null" || mknod "$DEST/dev/null" c 1 3
|
93
|
-
test -e "$DEST/dev/random" || mknod -m 0644 "$DEST/dev/random" c 1 8
|
94
|
-
test -e "$DEST/dev/urandom" || mknod -m 0644 "$DEST/dev/urandom" c 1 9
|
95
|
-
|
96
|
-
sed -i "s/^[[:space:]]*\(CheckSpace\)/# \1/" "$DEST/etc/pacman.conf"
|
97
|
-
sed -i "s/^[[:space:]]*SigLevel[[:space:]]*=.*$/SigLevel = Never/" "$DEST/etc/pacman.conf"
|
98
|
-
}
|
99
|
-
|
100
|
-
fetch_packages_list() {
|
101
|
-
local REPO=$1
|
102
|
-
|
103
|
-
debug "fetch packages list: $REPO/"
|
104
|
-
# Force trailing '/' needed by FTP servers.
|
105
|
-
fetch -O - "$REPO/" | extract_href | awk -F"/" '{print $NF}' | sort -rn ||
|
106
|
-
{ debug "Error: cannot fetch packages list: $REPO"; return 1; }
|
107
|
-
}
|
108
|
-
|
109
|
-
install_pacman_packages() {
|
110
|
-
local BASIC_PACKAGES=$1 DEST=$2 LIST=$3 PACKDIR=$4
|
111
|
-
debug "pacman package and dependencies: $BASIC_PACKAGES"
|
112
|
-
|
113
|
-
for PACKAGE in $BASIC_PACKAGES; do
|
114
|
-
local FILE=$(echo "$LIST" | grep -m1 "^$PACKAGE-[[:digit:]].*\(\.gz\|\.xz\)$")
|
115
|
-
test "$FILE" || { debug "Error: cannot find package: $PACKAGE"; return 1; }
|
116
|
-
local FILEPATH="$PACKDIR/$FILE"
|
117
|
-
|
118
|
-
debug "download package: $REPO/$FILE"
|
119
|
-
fetch -O "$FILEPATH" "$REPO/$FILE"
|
120
|
-
debug "uncompress package: $FILEPATH"
|
121
|
-
uncompress "$FILEPATH" "$DEST"
|
122
|
-
done
|
123
|
-
}
|
124
|
-
|
125
|
-
install_packages() {
|
126
|
-
local ARCH=$1 DEST=$2 PACKAGES=$3
|
127
|
-
debug "install packages: $PACKAGES"
|
128
|
-
mount -t proc /proc $DEST/proc
|
129
|
-
mount /dev $DEST/dev -o bind
|
130
|
-
LC_ALL=C chroot "$DEST" /usr/bin/pacman \
|
131
|
-
--noconfirm --arch $ARCH -Sy --force $PACKAGES
|
132
|
-
sync
|
133
|
-
umount $DEST/{proc,dev}
|
134
|
-
}
|
135
|
-
|
136
|
-
show_usage() {
|
137
|
-
stderr "show_usage: $(basename "$0") [-a i686|x86_64] [-r REPO_URL] DIRECTORY"
|
138
|
-
}
|
139
|
-
|
140
|
-
main() {
|
141
|
-
# Process arguments and options
|
142
|
-
test $# -eq 0 && set -- "-h"
|
143
|
-
local ARCH=$DEFAULT_ARCH
|
144
|
-
local REPO_URL=$DEFAULT_REPO_URL
|
145
|
-
|
146
|
-
while getopts "a:r:h" ARG; do
|
147
|
-
case "$ARG" in
|
148
|
-
a) ARCH=$OPTARG;;
|
149
|
-
r) REPO_URL=$OPTARG;;
|
150
|
-
*) show_usage; return 1;;
|
151
|
-
esac
|
152
|
-
done
|
153
|
-
shift $(($OPTIND-1))
|
154
|
-
test $# -eq 1 || { show_usage; return 1; }
|
155
|
-
|
156
|
-
local DEST=$1
|
157
|
-
local REPO="${REPO_URL%/}/core/os/$ARCH"
|
158
|
-
local PACKDIR=$(mktemp -d)
|
159
|
-
trap "rm -rf '$PACKDIR'" KILL TERM EXIT
|
160
|
-
debug "destination directory: $DEST"
|
161
|
-
debug "core repository: $REPO"
|
162
|
-
debug "temporary directory: $PACKDIR"
|
163
|
-
|
164
|
-
# Fetch packages, install and do a minimal system configuration
|
165
|
-
mkdir -p "$DEST"
|
166
|
-
local LIST=$(fetch_packages_list $REPO)
|
167
|
-
install_pacman_packages "${BASIC_PACKAGES[*]}" "$DEST" "$LIST" "$PACKDIR"
|
168
|
-
configure_pacman "$DEST" "$ARCH"
|
169
|
-
configure_minimal_system "$DEST"
|
170
|
-
install_packages "$ARCH" "$DEST" "${BASIC_PACKAGES[*]} ${EXTRA_PACKAGES[*]}"
|
171
|
-
configure_pacman "$DEST" "$ARCH" # Pacman must be re-configured
|
172
|
-
rm -rf "$PACKDIR"
|
173
|
-
|
174
|
-
debug "done"
|
175
|
-
}
|
176
|
-
|
177
|
-
main "$@"
|
178
|
-
EOF
|
179
|
-
|
180
|
-
- call_arch_boostrap:
|
181
|
-
- exec_out: bash $KAMELEON_WORKDIR/arch-bootstrap.sh -a $$arch -r $$mirror $$rootfs
|
182
|
-
- on_clean:
|
183
|
-
- umount_out: $$rootfs/proc
|
184
|
-
- umount_out: $$rootfs/dev
|
185
|
-
|
186
|
-
- enable_sshd_service:
|
187
|
-
- exec_out: |
|
188
|
-
chroot $$rootfs \
|
189
|
-
ln -sf \
|
190
|
-
'/usr/lib/systemd/system/sshd.service' \
|
191
|
-
'/etc/systemd/system/multi-user.target.wants/sshd.service'
|
192
|
-
|
193
|
-
- enable_dhcp_service:
|
194
|
-
- exec_out: |
|
195
|
-
chroot $$rootfs \
|
196
|
-
ln -sf \
|
197
|
-
'/usr/lib/systemd/system/dhcpcd.service' \
|
198
|
-
'/etc/systemd/system/multi-user.target.wants/dhcpcd.service'
|
199
|
-
|
200
|
-
- add_nobody_user: ## To allow sshd to run correctly
|
201
|
-
- exec_out: echo "nobody:x:99:99:nobody:/:/bin/false" >> $$rootfs/etc/passwd
|
202
|
-
- exec_out: echo "nobody:x:99:" >> $$rootfs/etc/group
|
203
|
-
- exec_out: echo "nobody:x:14871::::::" >> $$rootfs/etc/shadow
|
204
|
-
|
205
|
-
- configure_pacman:
|
206
|
-
- on_setup_init:
|
207
|
-
# init pacman keyring
|
208
|
-
- exec_in: haveged -w 1024
|
209
|
-
- exec_in: pacman-key --init
|
210
|
-
- exec_in: pkill haveged
|
211
|
-
- exec_in: pacman-key --populate archlinux
|
@@ -1,67 +0,0 @@
|
|
1
|
-
- fix_yum:
|
2
|
-
- check_cmd_out: yum
|
3
|
-
- exec_out: sed -i "s/opts.ssl_verify_host/2/g" /usr/lib/pymodules/python2.7/urlgrabber/grabber.py
|
4
|
-
|
5
|
-
- init_rpm_db:
|
6
|
-
- check_cmd_out: rpm
|
7
|
-
- exec_out: mkdir -p $$rootfs/var/lib/rpm
|
8
|
-
- exec_out: rpm --root $$rootfs --initdb
|
9
|
-
|
10
|
-
- fetch_release_package:
|
11
|
-
- check_cmd_out: lynx
|
12
|
-
- exec_out: RELEASE_PACKAGE_URL=$(lynx $$mirror_packages_url -dump -listonly -nonumbers | grep $${distrib}-release | head -1)
|
13
|
-
- exec_out: |
|
14
|
-
if [ -z "${RELEASE_PACKAGE_URL-unset}" ]; then
|
15
|
-
fail "$${distrib}-release package not found!"
|
16
|
-
fi
|
17
|
-
|
18
|
-
- install_distrib_release:
|
19
|
-
- download_file_out:
|
20
|
-
- $RELEASE_PACKAGE_URL
|
21
|
-
- $KAMELEON_WORKDIR/$${distrib}-release.rpm
|
22
|
-
- exec_out: rpm --root $$rootfs -ivh --force-debian --nodeps $KAMELEON_WORKDIR/$${distrib}-release.rpm
|
23
|
-
|
24
|
-
- install_yum:
|
25
|
-
- exec_out: ln -sf $$rootfs/etc/pki/ /etc/pki
|
26
|
-
- exec_out: yum --installroot $$rootfs -y install yum
|
27
|
-
- exec_out: echo $${release} > $$rootfs/etc/yum/vars/releasever
|
28
|
-
|
29
|
-
- mount_chroot:
|
30
|
-
- exec_out: mount -o bind /dev $$rootfs/dev
|
31
|
-
- exec_out: mount -o bind /dev/pts $$rootfs/dev/pts
|
32
|
-
- exec_out: mount -t proc /proc $$rootfs/proc
|
33
|
-
- exec_out: mount -t sysfs /sys $$rootfs/sys
|
34
|
-
- exec_out: cp /etc/resolv.conf $$rootfs/etc/resolv.conf
|
35
|
-
|
36
|
-
- install_packages:
|
37
|
-
- exec_out: chroot $$rootfs yum install --releasever=$$release -y $$include_pkgs
|
38
|
-
|
39
|
-
- enable_services:
|
40
|
-
- exec_out: chroot $$rootfs chkconfig network on
|
41
|
-
- exec_out: chroot $$rootfs chkconfig sshd on
|
42
|
-
|
43
|
-
- set_interface:
|
44
|
-
- write_out:
|
45
|
-
- $$rootfs/etc/sysconfig/network-scripts/ifcfg-eth0
|
46
|
-
- |
|
47
|
-
DEVICE="eth0"
|
48
|
-
BOOTPROTO="dhcp"
|
49
|
-
HOSTNAME="$$hostname"
|
50
|
-
IPV6INIT="yes"
|
51
|
-
NM_CONTROLLED="yes"
|
52
|
-
ONBOOT="yes"
|
53
|
-
TYPE="Ethernet"
|
54
|
-
- write_out:
|
55
|
-
- $$rootfs/etc/sysconfig/network
|
56
|
-
- |
|
57
|
-
NETWORKING=yes
|
58
|
-
HOSTNAME=$$hostname
|
59
|
-
RES_OPTIONS="single-request-reopen"
|
60
|
-
|
61
|
-
- umount_chroot:
|
62
|
-
- on_clean:
|
63
|
-
- umount_out: $$rootfs/sys
|
64
|
-
- umount_out: $$rootfs/proc
|
65
|
-
- umount_out: $$rootfs/dev/pts
|
66
|
-
- umount_out: $$rootfs/dev
|
67
|
-
- exec_out: rm -f $$rootfs/etc/resolv.conf
|