You are not logged in.

#1 2017-04-12 20:33:00

falate
Member
Registered: 2017-04-12
Posts: 5

[SOLVED]Excluding installed package files during upgrading via pacman.

Hello to everyone!

I'm new to the boards, but with ArchLinux I'm familiar for about year.

Currently, I've managed to customize my kernel by swapping it to Zen Linux, and I have reorganized my bootloader, etc.
Now I ran to issue where pacman is overriding my mkinitcpio preset for Zen Kernel and post-installation hook which I edited for automatic customization.
I couldn't find it on the boards, so I'd try to ask: is there an possibilty to exclude some files from package using built-in pacman functionality (without post-upgrade hook, because I think it is possible to run custom shell script after installation to perform customization tasks).

Kind regards, Casper.

EDIT:

I found pacman feature that directly match thread topic.
Because I didn't found answer by search I ll post it there.
To disable overriding specified files use

NoExtract = file/path/from/root/or/all/*

delimited by spacebar symbol in /etc/pacman.conf.

Last edited by falate (2017-04-13 16:16:33)

Offline

#2 2017-04-12 20:45:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

This sounds like an X-Y problem. Why is pacman overriding your -zen preset? Fix that.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-04-12 20:50:26

falate
Member
Registered: 2017-04-12
Posts: 5

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

jasonwryan wrote:

This sounds like an X-Y problem. Why is pacman overriding your -zen preset? Fix that.

Thank you for the reply!
Well preset file is located in the package as 'linux-zen /etc/mkinitcpio.d/linux-zen.preset'.
Every upgrade is overriding this one and this one "linux-zen /usr/share/libalpm/hooks/90-linux-zen.hook" which replaces the location of my custom preset in the hook.

Offline

#4 2017-04-12 21:21:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

Why isn't your custom preset in /etc/mkinitcpio.d/?

I'm still missing what the actual customisation is that you are trying to achieve? Is is a custom alpm-hook? Or a mkinicpio preset? Or both? Please paste the exact files that you are customising.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2017-04-12 21:30:40

falate
Member
Registered: 2017-04-12
Posts: 5

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

jasonwryan wrote:

Why isn't your custom preset in /etc/mkinitcpio.d/?

I'm still missing what the actual customisation is that you are trying to achieve? Is is a custom alpm-hook? Or a mkinicpio preset? Or both? Please paste the exact files that you are customising.

So I tried to solve it in two ways, and both are failing.
I've managed to write my own preset named 'zen' and tried to modify pacman library hook to execute it, and also modified original preset which gets overridden every upgrade.

I've changed original hook to:

[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = boot/vmlinuz-linux-zen
Target = usr/lib/initcpio/*

[Action]
Description = Updating linux-zen initcpios
When = PostTransaction
Exec = /usr/bin/mkinitcpio -p zen

From:

[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = boot/vmlinuz-linux-zen
Target = usr/lib/initcpio/*

[Action]
Description = Updating linux-zen initcpios
When = PostTransaction
Exec = /usr/bin/mkinitcpio -p linux-zen

Customized file pathes:
"/etc/mkinitcpio.d/linux-zen.preset"
"/usr/share/libalpm/hooks/90-linux-zen.hook"

That's the reason why i wanted to exclude one of them from package upgrade and left them unchanged (and from this reason comes my major question in thread about leaving selected files during package upgrade).

Last edited by falate (2017-04-12 21:36:53)

Offline

#6 2017-04-12 21:41:38

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

Why not place the modified hook in /etc/pacman.d/hooks Pacman#Hooks

Exec = /usr/bin/mkinitcpio -p zen

So why is the preset not named /etc/mkinitcpio.d/zen.preset?
Edit:
Pacman#Skip_files_from_being_installed_to_system
In general I would advise against using the feature though if the result can be achieved through other means.

Last edited by loqs (2017-04-12 21:44:21)

Offline

#7 2017-04-12 21:44:58

falate
Member
Registered: 2017-04-12
Posts: 5

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

loqs wrote:

Why not place the modified hook in /etc/pacman.d/hooks Pacman#Hooks

Exec = /usr/bin/mkinitcpio -p zen

So why is the preset not named /etc/mkinitcpio.d/zen.preset?

I had zen.preset and linux-zen.preset (linux-zen.preset is overriden by upgrade because it is included in package).
I can't manage to disable original hook, and my /boot is getting messy after upgrading with two hooks. Is there any possibility to disable original hook?
(I also can't manage to modify the original one, because it is included in the package and gets replaced every upgrade.)

Last edited by falate (2017-04-12 21:45:34)

Offline

#8 2017-04-12 21:56:24

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

# mkdir  /etc/pacman.d/hooks
# ln -s /dev/null /etc/pacman.d/90-linux.hook
# pacman -U linux-4.10.10-1-x86_64.pkg.tar.xz 
loading packages...
warning: linux-4.10.10-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) linux-4.10.10-1

Total Installed Size:  83.16 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
:: Processing package changes...
(1/1) reinstalling linux                           [######################] 100%
>>> Updating module dependencies. Please wait ...
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...

Seems to demonstrate /etc/pacman.d/90-linux.hook overriding /usr/share/libalpm/hooks/90-linux.hook
Edit:
replaced
# ln -s /dev/null /etc/pacman.d/90-linux.hook /dev/null
with correct
# ln -s /dev/null /etc/pacman.d/90-linux.hook

Last edited by loqs (2017-04-12 21:58:04)

Offline

#9 2017-04-12 22:19:34

falate
Member
Registered: 2017-04-12
Posts: 5

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

loqs wrote:
# mkdir  /etc/pacman.d/hooks
# ln -s /dev/null /etc/pacman.d/90-linux.hook
# pacman -U linux-4.10.10-1-x86_64.pkg.tar.xz 
loading packages...
warning: linux-4.10.10-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) linux-4.10.10-1

Total Installed Size:  83.16 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
:: Processing package changes...
(1/1) reinstalling linux                           [######################] 100%
>>> Updating module dependencies. Please wait ...
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...

Seems to demonstrate /etc/pacman.d/90-linux.hook overriding /usr/share/libalpm/hooks/90-linux.hook
Edit:
replaced
# ln -s /dev/null /etc/pacman.d/90-linux.hook /dev/null
with correct
# ln -s /dev/null /etc/pacman.d/90-linux.hook

Thank you, this solution finally works.

Offline

#10 2017-04-23 04:34:57

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED]Excluding installed package files during upgrading via pacman.

The linux-zen package correctly marks /etc/mkinitcpio.d/linux-zen.preset as a backup file, so pacman absolutely should not ever overwrite that file once you have modified it...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB