You are not logged in.

#1 2017-05-18 14:03:09

buttcake
Member
Registered: 2016-10-16
Posts: 37

[SOLVED] An easy way to manage custom repos inside pacman.conf ?

Is there an easy way to manipulate repos inside /etc/pacman.conf without manually editing the file ? Should I just use sed and friends and make myself a script ?

Last edited by buttcake (2017-05-20 16:10:02)

Offline

#2 2017-05-18 14:07:19

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,422
Website

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

Include = /etc/pacman.d/custom
pacconf --repo=foo --repo=bar (...) > /etc/pacman.d/custom

Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#3 2017-05-18 15:28:31

buttcake
Member
Registered: 2016-10-16
Posts: 37

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

Ohh, sorry for not being more explicit. I was thinking more along the lines of adding and deleting unnoficial repos.

Offline

#4 2017-05-18 15:37:19

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

"without manually editing the file"

Full stop. If something changed pacman.conf automatically, I would be pretty unhappy.

Offline

#5 2017-05-18 16:00:12

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

Scimmia wrote:

"If something changed pacman.conf automatically, I would be pretty unhappy.

Copy that.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#6 2017-05-18 19:47:57

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,422
Website

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

buttcake wrote:

Ohh, sorry for not being more explicit. I was thinking more along the lines of adding and deleting unnoficial repos.

Put all of them in some separate file you point pacconf to, then redirect the output to the include file. But this sounds like an xy problem, so tell us why you're actually trying to do this.

Last edited by Alad (2017-05-18 19:48:18)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#7 2017-05-18 20:09:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,546
Website

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

Definitely an XY Problem.  Why is "manually editting" a file of 1-2 dozen lines a problem?  Instead of just opening it in $EDITOR, you'd rather write some script to edit it for you?  Why??


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2017-05-20 11:28:14

buttcake
Member
Registered: 2016-10-16
Posts: 37

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

I'm trying to make a post install script  which I can run to configure and install most of the stuff I use on a daily basis.
I need vim-tiny from the herecura repo and qt development packages from kde-unstable so at the end I'd have to have [kde-unstable],[herecura-testing],[testing],[herecura],[core],[extra],[community-testing] and [community] enabled in that order.

Offline

#9 2017-05-20 11:31:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,546
Website

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

So just copy a pacman.conf over to the new system.  Or use a heredocument and just overwrite the existing conf.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2017-05-20 11:58:23

buttcake
Member
Registered: 2016-10-16
Posts: 37

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

Yeah but pacman.conf defaults change over time don't they ? Wouldn't it be safer to automatically modify a new one instead of overwriting with an old copy ?

Offline

#11 2017-05-20 12:06:59

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

They usually do not change. Here is the history: https://git.archlinux.org/svntogit/pack … ges/pacman


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#12 2017-05-20 12:16:32

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

You could use awk to delete 3 (or comment 2) lines every time it finds a line beginning with [ (to remove all existing active repos) and then append your repo list to the end of the file.

Last edited by Slithery (2017-05-20 12:18:21)


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#13 2017-05-20 12:40:26

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,546
Website

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

Or just delete all repos, and add back whatever you want in watever order

sed -i '/^\[c/,$d' /etc/pacman.conf
cat <<EOF >> /etc/pacman.conf
[myrepo1]
Server = https://whate.ver/repo

[core]
Include = ...
EOF

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#14 2017-05-20 13:37:32

luceph
Member
From: Ontario, Canada
Registered: 2017-05-06
Posts: 27

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

What other option could you possibly be looking for other than having scripts to add or remove lines from the file? And if you know that answer, then problem solves tongue

Offline

#15 2017-05-20 16:09:22

buttcake
Member
Registered: 2016-10-16
Posts: 37

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

Sorry for making this confusing for everyone. I was just wondering if there's a streamlined tool or an option available in one of the tools available for arch. I will go the sed way, probably the way Trilby suggested. Thank you for the help.

Offline

#16 2017-05-20 16:31:41

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,422
Website

Re: [SOLVED] An easy way to manage custom repos inside pacman.conf ?

Yes, there is... as I indicated already in post #2/6. But nothing prevents you from taking the hard way. wink


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

Board footer

Powered by FluxBB