You are not logged in.

#1 2023-01-02 08:03:49

fatpenguin
Member
Registered: 2022-03-13
Posts: 17

[SOLVED] Editing source files in PKGBUILD

Hi, I want to make a PKGBUILD where the source is downloaded from url and has its own conf file. The problem is that at every new release I should replace just ONE world in the source conf file (something like "default - >custom"). Is there an instruction to do this automatically? Should i need to create a patch and, if yes, how? Thanks in advance.

Last edited by fatpenguin (2023-01-02 15:08:57)

Offline

#2 2023-01-02 12:27:12

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: [SOLVED] Editing source files in PKGBUILD

A patch is an option but I would just use sed in the prepare() function.

Reference: https://wiki.archlinux.org/title/Patching_packages


Jin, Jîyan, Azadî

Offline

#3 2023-01-02 12:32:20

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: [SOLVED] Editing source files in PKGBUILD

I do not see your point. If the given PKGBUILD isn't a vcs-package, you will edit the PKGBUILD manually anyway (at least version number and hash-sums). Why not edit just another file (the conf file) manually?

Offline

#4 2023-01-02 15:07:12

fatpenguin
Member
Registered: 2022-03-13
Posts: 17

Re: [SOLVED] Editing source files in PKGBUILD

Stefan Husmann wrote:

Why not edit just another file (the conf file) manually?

Because I should download the source package everytime and edit it, i want something to do this automatically as soon as the source is downloaded.

Offline

#5 2023-01-02 15:08:16

fatpenguin
Member
Registered: 2022-03-13
Posts: 17

Re: [SOLVED] Editing source files in PKGBUILD

Head_on_a_Stick wrote:

A patch is an option but I would just use sed in the prepare() function.

Reference: https://wiki.archlinux.org/title/Patching_packages

That's fine thanks, sed - i with the c function is what i needed. Issue solved.

Offline

#6 2023-01-03 06:04:53

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: [SOLVED] Editing source files in PKGBUILD

Stefan Husmann wrote:

I do not see your point. If the given PKGBUILD isn't a vcs-package, you will edit the PKGBUILD manually anyway (at least version number and hash-sums). Why not edit just another file (the conf file) manually?

Because PKGBUILDs are designed to be shared and you don't want to visit everyone who uses it in person to edit their copy of the downloaded configuration file? PKGBUILDs are not supposed to depend on users editing the source they download.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB