a1a316f22e
Both CentOS and SUSE have pathing and services that are assumed to exist from our previous use of the larger LXC images. This change also ensures netbase is installed across our supported distros. * Imports the "rpm-gpg" packages if the directory exists. * unmasks the "sshd" sevice on SUSE if present and masked or disabled. * Adds the (setup|netbase|netcfg) packages to the base image Change-Id: Idc5caf2030c0e50dfeb84e0648bec08d7f50b6b8 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
41 lines
1.2 KiB
Django/Jinja
41 lines
1.2 KiB
Django/Jinja
#!/usr/bin/env bash
|
|
set -e -x
|
|
|
|
{{ lxc_cache_prep_pre_commands }}
|
|
|
|
{% include 'templates/prep-scripts/_container_sys_setup.sh.j2' %}
|
|
|
|
if [[ -d "/etc/pki/rpm-gpg" ]]; then
|
|
rpm --import /etc/pki/rpm-gpg/* || true
|
|
fi
|
|
|
|
# The containers do not need the LXC repository (only hosts need it).
|
|
rm -f /etc/yum.repos.d/thm-lxc2.0*
|
|
|
|
# Prefer dnf over yum for CentOS.
|
|
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
|
|
|
# Create yum/dnf transaction file and run it all at once
|
|
echo "update" > /tmp/package-transaction.txt
|
|
echo "install {{ lxc_cache_distro_packages | join(' ') }}" >> /tmp/package-transaction.txt
|
|
echo "run" >> /tmp/package-transaction.txt
|
|
$RHT_PKG_MGR -y shell /tmp/package-transaction.txt
|
|
yum-complete-transaction --cleanup-only
|
|
rm -f /tmp/package-transaction.txt
|
|
rm -f /usr/bin/python
|
|
ln -s /usr/bin/python2.7 /usr/bin/python
|
|
rm /etc/machine-id || true
|
|
rm /var/lib/dbus/machine-id || true
|
|
rm /etc/sysctl.d/* || true
|
|
echo '' > /etc/sysctl.conf
|
|
touch /etc/machine-id
|
|
yum clean all
|
|
mkdir -p /var/backup
|
|
chage -I -1 -d -1 -m 0 -M 99999 -E -1 root
|
|
|
|
# Set the IP of the lxcbr0 interface as the DNS server
|
|
echo "nameserver {{ lxc_net_address }}" > /etc/resolv.conf
|
|
systemctl enable systemd-networkd
|
|
|
|
{{ lxc_cache_prep_post_commands }}
|