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.
modify official-package-repositories.list in script
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
modify official-package-repositories.list in script
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: modify official-package-repositories.list in script
Anything wrong with manually editing the file?
Code: Select all
sudo gedit /etc/apt/sources.list.d/official-repository-packages.list
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
Re: modify official-package-repositories.list in script
The really right way to do this is to run Software Sources (mintSources) and choose a mirror.SMS wrote:What's the really right way to do this?
mintSources always overwrites this file anyway.
Re: modify official-package-repositories.list in script
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.