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

Set sources.list only for Ubuntu

parent 28962625
No related branches found
No related tags found
No related merge requests found
......@@ -5,21 +5,23 @@ DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND
apt-get update
apt-get install -y apt-transport-https gnupg
apt-get install -y apt-transport-https gnupg lsb-release
# move 50unattended-upgrades conf if any
if [ -f /etc/apt/apt.conf.d/50unattended-upgrades.ucf-dist ]; then
mv /etc/apt/apt.conf.d/50unattended-upgrades.ucf-dist /etc/apt/apt.conf.d/50unattended-upgrades
if [ -f '/etc/apt/apt.conf.d/50unattended-upgrades.ucf-dist' ]; then
mv '/etc/apt/apt.conf.d/50unattended-upgrades.ucf-dist' '/etc/apt/apt.conf.d/50unattended-upgrades'
fi
# update sources.list
rm -f /etc/apt/sources.list~
echo "Updating /etc/apt/sources.list file."
cp sources.list /etc/apt/sources.list
if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then
sed -i 's@bionic@trusty@' /etc/apt/sources.list
elif ( rgrep '16.04' /etc/lsb-release >/dev/null ); then
sed -i 's@bionic@xenial@' /etc/apt/sources.list
if ( lsb_release -a | grep 'Ubuntu' >/dev/null 2>&1 ); then
echo "Updating /etc/apt/sources.list file."
cp sources.list /etc/apt/sources.list
if ( lsb_release -a | grep '14.04' >/dev/null 2>&1 ); then
sed -i 's@bionic@trusty@' /etc/apt/sources.list
elif ( lsb_release -a | grep '16.04' >/dev/null 2>&1 ); then
sed -i 's@bionic@xenial@' /etc/apt/sources.list
fi
fi
# modify sources.list to use ubicast cache
......@@ -37,25 +39,6 @@ apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold"
apt-get install -y apt-transport-https
apt-get autoremove -y
# migrate to Ubuntu 16.04 if needed
if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then
echo "Upgrading to Ubuntu 16.04."
sed -i 's@trusty@xenial@' /etc/apt/sources.list
apt-get update
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" || apt-get install -f -y -o Dpkg::Options::="--force-confold"
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" || apt-get install -f -y -o Dpkg::Options::="--force-confold"
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold"
apt-get autoremove -y
echo "16.04 migration ok."
echo "The server is rebooting, please wait at least 2 minutes"
echo " before restarting the script to continue the configuration."
echo "Date: $(date)."
echo "Ignore the following message about reboot problem if any."
reboot
exit 1
fi
systemctl unmask nginx || true
# APT panel
if ( ! test -z ${SKYREACH_APT_TOKEN} ); then
echo "Adding skyreach.list to APT sources."
......
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