Skip to content
Snippets Groups Projects
Commit 14481177 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Changed APT setup.

parent 1b0ebf19
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
source /root/envsetup/global-conf.sh
# migrate to Ubuntu 16.04 / apply sources.list
if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then
echo "Upgrading to Ubuntu 16.04."
apt-get update
apt-get dist-upgrade -y
cp sources16.list /etc/apt/sources.list
apt-get update
DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get dist-upgrade -o Dpkg::Options::="--force-confold" --force-yes -y
apt-get install -f -y
apt-get dist-upgrade -y
else
echo "Updating Ubuntu 16.04 sources.list."
cp sources16.list /etc/apt/sources.list
fi
# update
apt-get update
apt-get install -y apt-transport-https
# resolvconf
apt-get purge -y resolvconf
# modify sources.list to use ubicast cache
if ( ! test -z ${APT_CACHE_HOST} ); then
......@@ -36,8 +20,8 @@ if ( ! test -z ${SKYREACH_API_KEY} ); then
fi
# APT proxy
if [ ${PROXY} = "1" ]; then
if [ ${PROXY_AUTHENTICATION} = "1" ]; then
if [ "${PROXY}" = "1" ]; then
if [ "${PROXY_AUTHENTICATION}" = "1" ]; then
# general settings
echo "Proxy: http://${PROXY_USER}:${PROXY_PWD}@${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
else
......@@ -46,7 +30,25 @@ if [ ${PROXY} = "1" ]; then
fi
fi
# update
apt-get update
apt-get install -y apt-transport-https
apt-get dist-upgrade -y
# migrate to Ubuntu 16.04 / apply sources.list
if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then
echo "Upgrading to Ubuntu 16.04."
cp sources16.list /etc/apt/sources.list
apt-get update
DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get dist-upgrade -o Dpkg::Options::="--force-confold" --force-yes -y
apt-get install -f -y
apt-get dist-upgrade -y
else
echo "Updating Ubuntu 16.04 sources.list file."
cp sources16.list /etc/apt/sources.list
apt-get update
apt-get dist-upgrade -y
fi
# unattended-upgrades
echo "Installing and configuring unattended-upgrades."
......@@ -54,13 +56,3 @@ apt-get install -y unattended-upgrades
sed -i 's@//Unattended-Upgrade::Mail "root";@Unattended-Upgrade::Mail "root";@' /etc/apt/apt.conf.d/50unattended-upgrades
sed -i 's@//*.*"vim";@"mysql-server";@' /etc/apt/apt.conf.d/50unattended-upgrades
sed -i 's@//*.*"libc6";@"mysql-client";@' /etc/apt/apt.conf.d/50unattended-upgrades
# configure frequence
cat > /etc/apt/apt.conf.d/10periodic << EOF
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";
EOF
# resolvconf
apt-get purge -y resolvconf
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment