39 lines
1.5 KiB
Bash
39 lines
1.5 KiB
Bash
|
#!/bin/bash
|
||
|
set -e
|
||
|
set -u
|
||
|
set -x
|
||
|
# questo coso assume che si usa machinectl
|
||
|
|
||
|
# questa macchina e' una debian pulita
|
||
|
sourcemachine=jessie-amd64-base
|
||
|
# questa macchina ha alcune cose di base installate/configurate
|
||
|
# come Apache, PHP, eccetera
|
||
|
intermediate=wwwd8-base
|
||
|
testmachine=wwwd8-test-$(date +%y%m%d%H%M%S)
|
||
|
|
||
|
conf="$(dirname $0)/../config.sh"
|
||
|
[[ -f "$conf" ]] && . "$conf"
|
||
|
|
||
|
machineexists() {
|
||
|
machinectl list-images|awk '{ print $1 }'|egrep -q "^${1}\$"
|
||
|
}
|
||
|
|
||
|
# intermediate creation END {{{1
|
||
|
if ! machineexists "$intermediate"; then
|
||
|
if ! machineexists "$sourcemachine"; then
|
||
|
debootstrap "/var/lib/machines/${sourcemachine}"
|
||
|
fi
|
||
|
machinectl clone "${sourcemachine}" "${intermediate}"
|
||
|
fi
|
||
|
# those are idempotent, so...
|
||
|
systemd-nspawn --setenv='DEBIAN_FRONTEND=noninteractive' -D "/var/lib/machines/${intermediate}" /usr/bin/apt-get -y install apache2 libapache2-mod-php5 php5-gd mariadb-server
|
||
|
systemd-nspawn --setenv='DEBIAN_FRONTEND=noninteractive' -D "/var/lib/machines/${intermediate}" /usr/sbin/a2enmod rewrite
|
||
|
systemd-nspawn --setenv='DEBIAN_FRONTEND=noninteractive' -D "/var/lib/machines/${intermediate}" /usr/sbin/a2enmod php5
|
||
|
systemd-nspawn --setenv='DEBIAN_FRONTEND=noninteractive' -D "/var/lib/machines/${intermediate}" /bin/mkdir -p /mig
|
||
|
# intermediate creation END }}}1
|
||
|
|
||
|
machinectl clone "${intermediate}" "${testmachine}"
|
||
|
systemd-nspawn -D "/var/lib/machines/${testmachine}" --bind-ro="$(readlink -f $(dirname $0)/../):/mig" /mig/deploy/deploy.sh
|
||
|
|
||
|
# vim: set fdm=marker:
|