Fixing Ubuntu apt-get sources

#Ubuntu

Table of Contents

This script makes use of the mirror protocol.\\

 1#!/bin/bash
 2
 3UbuntuCodeName=`lsb_release -c | cut -f 2`
 4if [ ! -f /etc/apt/sources.list.Original ];
 5then
 6    mv /etc/apt/sources.list /etc/apt/sources.list.Original
 7 echo "deb     mirror://mirrors.ubuntu.com/mirrors.txt $UbuntuCodeName main restricted universe multiverse
 8deb-src mirror://mirrors.ubuntu.com/mirrors.txt $UbuntuCodeName main restricted universe multiverse
 9
10deb     mirror://mirrors.ubuntu.com/mirrors.txt $UbuntuCodeName-updates main restricted universe multiverse
11deb-src mirror://mirrors.ubuntu.com/mirrors.txt $UbuntuCodeName-updates main restricted universe multiverse
12
13deb     mirror://mirrors.ubuntu.com/mirrors.txt $UbuntuCodeName-backports main restricted universe multiverse
14deb-src mirror://mirrors.ubuntu.com/mirrors.txt $UbuntuCodeName-backports main restricted universe multiverse
15
16deb     http://security.ubuntu.com/ubuntu $UbuntuCodeName-security main restricted universe multiverse
17deb-src http://security.ubuntu.com/ubuntu $UbuntuCodeName-security main restricted universe multiverse
18
19deb     http://archive.canonical.com/ubuntu $UbuntuCodeName partner
20deb-src http://archive.canonical.com/ubuntu $UbuntuCodeName partner
21
22deb     http://extras.ubuntu.com/ubuntu $UbuntuCodeName main
23deb-src http://extras.ubuntu.com/ubuntu $UbuntuCodeName main" >> /etc/apt/sources.list
24else
25 echo "This script has been run already. Exiting"
26fi

\\ Alternatively, you can run the following commands to update the sources automatically\\

1wget -O UpdateAptSources.sh http://ideone.com/plain/UgsBel
2chmod 555 UpdateAptSources.sh
3sudo ./UpdateAptSources.sh