modify official-package-repositories.list in script

Forum rules
Before you post please read this

modify official-package-repositories.list in script

Postby SMS on Sun May 04, 2014 9:37 am

I am trying to modify the default ubuntu repositories in official-package-repositories.list in a script. I want to put a different mirror in, because archive.ubuntu.com is slow as _.

I've tried sed and awk, but i can't get the syntax right, or some process is not allowing it to be changed, or something.

The only way i've been able to do it is through echo | sudo tee -a, but that just appends the entries, and apt fails to read them, because there is some weird character right above my new entries.

What's the really right way to do this?

Thanks for your help.
SMS
Level 1
Level 1
 
Posts: 10
Joined: Wed Jul 03, 2013 11:28 am

Linux Mint is funded by ads and donations.
 

Re: modify official-package-repositories.list in script

Postby karlchen on Sun May 04, 2014 9:46 am

Anything wrong with manually editing the file?
Code: Select all
sudo gedit /etc/apt/sources.list.d/official-repository-packages.list
User avatar
karlchen
Level 11
Level 11
 
Posts: 3530
Joined: Sat Dec 31, 2011 7:21 am

Re: modify official-package-repositories.list in script

Postby Monsta on Sun May 04, 2014 10:19 am

SMS wrote:What's the really right way to do this?

The really right way to do this is to run Software Sources (mintSources) and choose a mirror.
mintSources always overwrites this file anyway.
Monsta
Level 8
Level 8
 
Posts: 2453
Joined: Fri Aug 19, 2011 3:46 am

Re: modify official-package-repositories.list in script

Postby xenopeek on Sun May 04, 2014 1:23 pm

Either write a script and run that with sudo ("sudo ./myscript"), or run sed or awk with sudo. For sed that would be something like "sudo sed -i 's/search/replace/' file"; the -i makes sed edit the file in place.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14851
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 1 guest