You are not logged in.

#1 2023-11-30 06:54:44

Markus.N2
Member
From: Germany
Registered: 2013-08-22
Posts: 99

mkarchiso: is it possible to overwrite files from installed packages?

Hi,
I'm currently experimenting with mkarchiso to create my individual rescue USB stick. Creating the ISO and running it works.

However, I'd like to use my own version of /usr/share/nano/sh.nanorc and I don't know how to put it on the resulting image.

  • If I put it in the "archiso" directory at the desired location, it conflicts with the file from the "nano" package and the build fails.

  • On the other hand, I could not find a way to write a file to the target after installing the packages.

Is there a way to do that?

Offline

#2 2023-11-30 10:20:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,900

Re: mkarchiso: is it possible to overwrite files from installed packages?

Multiple, some suggestions:

I'd probably go with the first approach

Offline

#3 2023-11-30 11:55:35

Markus.N2
Member
From: Germany
Registered: 2013-08-22
Posts: 99

Re: mkarchiso: is it possible to overwrite files from installed packages?

Oh yes ... the NoExtract config option ... I simply forgot about that. The  PostTransaction libalpm hook appears too tedious for that purpose.
Unfortunately, NoExtract it did not work.
I've added this line:

NoExtract = usr/share/nano/sh.nanorc

and made sure it's the only one containing NoExtract except comments. I've tried with and without / at the beginning, I also checked the path for typos (using ls and the path copied via clipboard).
But still got the error:

nano: /tmp/mkarchiso/x86_64/airootfs/usr/share/nano/sh.nanorc exists in filesystem

Edit:
I forgot to mention that I also tried the full target path /tmp/mkarchiso/x86_64/airootfs/usr/share/nano/sh.nanorc with and without the / at the beginning.

Last edited by Markus.N2 (2023-11-30 12:09:01)

Offline

#4 2023-11-30 21:49:50

Markus.N2
Member
From: Germany
Registered: 2013-08-22
Posts: 99

Re: mkarchiso: is it possible to overwrite files from installed packages?

I think I'll have to check if I can make my own extended version of mkarchiso that has a "overwrite files" step after installing packages. Hopefully this is not too complicated.

Offline

#5 2023-12-01 06:56:01

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 625

Re: mkarchiso: is it possible to overwrite files from installed packages?

Markus.N2 wrote:

I've added this line:

NoExtract = usr/share/nano/sh.nanorc

Did you put it in the pacman.conf file that's inside your custom profile's directory?

Offline

#6 2023-12-01 10:31:34

Markus.N2
Member
From: Germany
Registered: 2013-08-22
Posts: 99

Re: mkarchiso: is it possible to overwrite files from installed packages?

Yes, of course.

Offline

#7 2023-12-02 12:10:09

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 625

Re: mkarchiso: is it possible to overwrite files from installed packages?

Yeah, it doesn't work.

error: failed to commit transaction (conflicting files)
nano: /tmp/archiso-tmp/x86_64/airootfs/usr/share/nano/sh.nanorc exists in filesystem
Errors occurred, no packages were upgraded.
==> ERROR: Failed to install packages to new root

Looks like pacman checks for existing files before looking at NoExtract.

/usr/share/ is a bad place to put custom files anyway, since it's the package manager territory.

I'm assuming you're adding a custom ~/.config/nano/nanorc to the ISO too, since syntax highlighting is not enabled by default in /etc/nanorc.
A solution would be to place your sh.nanorc somewhere else (e.g. /usr/local/share/) and load it from nanorc.

Offline

#8 2023-12-03 09:57:43

Markus.N2
Member
From: Germany
Registered: 2013-08-22
Posts: 99

Re: mkarchiso: is it possible to overwrite files from installed packages?

I'm aware that /usr/share/ is a bad place. However ... in this case it's the location where nano looks for .nanorc files. So I have no choice - at least without a tedious reconfiguration of nano.

Yes, I have a custom nanorc, but there I just include /usr/share/nano/*.nanorc, so I don't know what happens if  one of the files conflicts with my custom location.

So I think I'll have to go with plan B: check if I can extend mkarchiso. I have already checked that it's a script, not a binary. So it should be possible.

Last edited by Markus.N2 (2023-12-03 10:01:37)

Offline

#9 2023-12-03 10:09:25

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 625

Re: mkarchiso: is it possible to overwrite files from installed packages?

Markus.N2 wrote:

Yes, I have a custom nanorc, but there I just include /usr/share/nano/*.nanorc, so I don't know what happens if  one of the files conflicts with my custom location.

The last include wins.

Offline

Board footer

Powered by FluxBB