#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
    更新网易源
    deb http://mirrors.163.com/ubuntu/ lucid main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ lucid-security main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ lucid-updates main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ lucid-proposed main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ lucid-backports main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ lucid main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ lucid-security main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ lucid-updates main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ lucid-proposed main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ lucid-backports main restricted universe multiverse
'''
import os

if not os.path.exists('/etc/apt/sources.list.bak'):
    os.system('cp /etc/apt/sources.list /etc/apt/sources.list.bak')
    if os.path.exists('/etc/apt/sources.list.bak'):
        print 'sources file is bak success .'
    else:
        print 'sources file bak err . exit...'
        exit()

os.system('rm /etc/apt/sources.list && cp 163.sources.list /etc/apt/sources.list')

print('\033[5;32;10m')
print 'set success !'
os.system('cat /etc/apt/sources.list')
print('\033[0m')
os.system('apt-get update')