f63abfa921
The 'apt-get upgrade' does not set confdef and confold currently, so an upgrade which requires user input can break the cache build[1]. [1] http://paste.openstack.org/raw/733076/ Change-Id: Ic6689387a28539b7eb341d55a9db08f078e8e975
47 lines
1.6 KiB
Django/Jinja
47 lines
1.6 KiB
Django/Jinja
#!/usr/bin/env bash
|
|
set -e -x
|
|
|
|
{{ lxc_cache_prep_pre_commands }}
|
|
|
|
{% include 'templates/prep-scripts/_container_sys_setup.sh.j2' %}
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get remove -y --purge snap* lxc* lxd* resolvconf* || true
|
|
|
|
# Update base distribution
|
|
apt-get update
|
|
apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes
|
|
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes {{ lxc_cache_distro_packages | join(' ') }}
|
|
apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes
|
|
rm -f /usr/bin/python
|
|
rm /etc/machine-id || true
|
|
rm /var/lib/dbus/machine-id || true
|
|
touch /etc/machine-id
|
|
rm /etc/sysctl.d/* || true
|
|
echo '' > /etc/sysctl.conf
|
|
ln -s /usr/bin/python2.7 /usr/bin/python
|
|
mkdir -p /root/.ssh
|
|
chmod 700 /root/.ssh
|
|
userdel --force --remove ubuntu || true
|
|
apt-get clean
|
|
mkdir -p /var/backup
|
|
mkdir -p /etc/network/interfaces.d
|
|
chage -I -1 -d -1 -m 0 -M 99999 -E -1 root
|
|
for action in disable mask; do
|
|
systemctl ${action} resolvconf.service || true
|
|
systemctl ${action} systemd-networkd-resolvconf-update.path || true
|
|
systemctl ${action} systemd-networkd-resolvconf-update.service || true
|
|
done
|
|
|
|
{% for locale in lxc_cache_locales %}
|
|
locale-gen {{ locale }}
|
|
{% if loop.first | bool %}
|
|
update-locale LANG={{ locale }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
# 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 }}
|