parent
044b8da55a
commit
d5a822884f
288 changed files with 13040 additions and 1 deletions
78
bots/images/scripts/lib/atomic.setup
Executable file
78
bots/images/scripts/lib/atomic.setup
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This file is part of Cockpit.
|
||||
#
|
||||
# Copyright (C) 2015 Red Hat, Inc.
|
||||
#
|
||||
# Cockpit is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Cockpit is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -ex
|
||||
|
||||
# The docker pool should grow automatically as needed, but we grow it
|
||||
# explicitly here anyway. This is hopefully more reliable.
|
||||
# Newer Fedora versions configure docker to use the root LV
|
||||
# HACK: docker falls over regularly, print its log if it does
|
||||
systemctl start docker || journalctl -u docker
|
||||
lvresize atomicos/root -l+60%FREE -r
|
||||
if lvs atomicos/docker-pool 2>/dev/null; then
|
||||
lvresize atomicos/docker-pool -l+100%FREE
|
||||
elif lvs atomicos/docker-root-lv; then
|
||||
lvresize atomicos/docker-root-lv -l+100%FREE
|
||||
fi
|
||||
|
||||
# docker images that we need for integration testing
|
||||
/var/lib/testvm/docker-images.setup
|
||||
|
||||
# Download the libssh RPM plus dependencies which we'll use for
|
||||
# package overlay. The only way to do this is via a container
|
||||
. /etc/os-release
|
||||
REPO="updates"
|
||||
if [ "$ID" = "rhel" ]; then
|
||||
subscription-manager repos --enable rhel-7-server-extras-rpms
|
||||
REPO="rhel-7-server-extras-rpms"
|
||||
ID="rhel7"
|
||||
fi
|
||||
docker run --rm --volume=/etc/yum.repos.d:/etc/yum.repos.d:z --volume=/root/rpms:/tmp/rpms:rw,z "$ID:$VERSION_ID" /bin/sh -cex "yum install -y findutils createrepo yum-utils && (cd /tmp/; yumdownloader --enablerepo=$REPO libssh) && find /tmp -name '*.$(uname -m).*rpm' | while read rpm; do mv -v \$rpm /tmp/rpms; done; createrepo /tmp/rpms"
|
||||
rm -f /etc/yum.repos.d/*
|
||||
cat >/etc/yum.repos.d/deps.repo <<EOF
|
||||
[deps]
|
||||
baseurl=file:///root/rpms
|
||||
enabled=1
|
||||
EOF
|
||||
|
||||
# fully upgrade host. Anything past this point can't touch /etc
|
||||
# Upgrade host if there is a valid upgrade available (we might be on a RC)
|
||||
if rpm-ostree upgrade --check; then
|
||||
atomic host upgrade
|
||||
# HACK - Find a better way to compute the ref.
|
||||
# https://lists.projectatomic.io/projectatomic-archives/atomic-devel/2016-July/msg00015.html
|
||||
|
||||
checkout=$(atomic host status --json | python -c 'import json; import sys; j = json.loads(sys.stdin.readline()); print j["deployments"][0]["origin"]')
|
||||
else
|
||||
checkout=$(atomic host status --json | python -c 'import json; import sys; j = json.loads(sys.stdin.readline()); print [x for x in j["deployments"] if x["booted"]][0]["checksum"]')
|
||||
fi
|
||||
|
||||
# Checkout the just upgraded os branch since we'll use it every time
|
||||
# we build a new tree.
|
||||
|
||||
ostree checkout "$checkout" /var/local-tree
|
||||
|
||||
# reduce image size
|
||||
/var/lib/testvm/zero-disk.setup
|
||||
|
||||
# Prevent SSH from hanging for a long time when no external network access
|
||||
echo 'UseDNS no' >> /etc/ssh/sshd_config
|
||||
|
||||
# Final tweaks
|
||||
rm -rf /var/log/journal/*
|
||||
Loading…
Add table
Add a link
Reference in a new issue