Creating useful Pacman hooks

I was planning on getting around to that, but Rome wasn't built in a day you know. :smile:

I've been busy with these silly little scripting projects of mine. The service I just wrote to restart dropped connections will really help a lot of people with flaky wifi I think.

@sgs did you get the above hook working well for you (and on which DE and terminals)

1 Like

I'm so sorry, I'm afraid not. But I'm sure you know how to do it and that it has to work.
I am on unstable, but with ""-mmin -60" (1hour)" I will test next time.


Thread: table of contents
I'd do the preliminary work if I knew what was relevant. LOL :smiley: :wink: :slight_smile:

My knowledge is unfortunately very limited respectively I have done everything already once, but I just can't remember it anymore :smiley:

1 Like

No big deal I'll get around to adding links. There's not so many hooks on here that it's hard to find an individual hook yet (but it's getting there).

1 Like

Geez, I can't find this hook I was looking for I wanted to play with.
Sure would be nice if there was a table of contents or something.

/sigh

:crazy_face:

It's apparently time for me to create an irony or "I'm just kidding" button. :slight_smile:

lkidding-sgs


As always, this message does not destroy itself.

6 Likes

Atheros QCA9377 Pacman Hook

Recently I have again read reports that the Atheros QCA9377 wifi adapter is suffering breakages on system updates. This issue usually only affects those who are using kernel 4.14 (or older).

Those using kernel 4.14 (and below) need to rename or delete the Atheros firmware-6.bin for this wifi adapter to work with older kernels. When using older kernels the firmware-5.bin must be used instead.

Wifi can be repeatedly broken after a system update, if the firmware-6.bin file is upated. This can be prevented by creating a pacman hook to automatically rename the firmware-6.bin to firmware-6.bin.bak after every update.

Atheros QCA9377 Pacman Hook

With a text editor create the Pacman hook:

/etc/pacman.d/hooks/qca9377.hook
[Trigger] 
Operation = Install 
Operation = Upgrade 
Type = File 
Target = lib/firmware/ath10k/QCA9377/hw1.0/firmware-6.bin

[Action] 
Description = Rename Atheros v.6 Firmware 
When = PostTransaction 
Exec = mv /lib/firmware/ath10k/QCA9377/hw1.0/firmware-6.bin /lib/firmware/ath10k/QCA9377/hw1.0/firmware-6.bin.bak 
NeedsTargets

This hook is only necessary for those using older kernels with the QCA9377 adapter. If you update to a kernel newer than 4.14 you will need to delete the pacman hook and rename firmware-6.bin.bak to its original name.

I have not personally tested this hook (as I do not own a QCA9377 adapter), but I'm fairly certain this should prevent any firmware update breakages in the future.

Please report on this hooks effectiveness if you have tested it with your QCA9377 adapter.

3 Likes

So once I got my idiocy out of the way, I LOVE the timeshift hook.
Impressive stuff.
I should never write stuff like this because I'll do sneaky stuff. Like with the countdown.

You have 3 seconds - press any key to stop the deletion of your /home directory
You have 2 seconds -  press any key to stop the Timeshift backup (just kidding about deleting home)
You have 1 second -  press any key to stop the Timeshift backup (Just kidding... deleting /home dir)

Window closes

3 Likes

Well its truly possible to execute deleting / directory with pacman hook.

Hello TBG. Thanks for your help, I tested your hook and doesn't work. When I reinstall linux-firmware, this creates the firmware-6.bin again and I have this message:

warning: could not get file information for usr/lib/firmware/ath10k/QCA9377/hw1.0/firmware-6.bin

Probably that means that the real target is from usr/lib... also I tested changing the target and Exec routes and doesn't work either.

Wanted

tbg-02-sgs

2 Likes

Apologies, but I am not at home, so I do not have access to a Linux system to troubleshoot this issue. I will revisit the issue when I'm home again and let you know my findings.

1 Like

Don't worry TBG. Maybe I have an issue in my version, here:

[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = usr/lib/firmware/ath10k/QCA9377/hw1.0/firmware-6.bin

[Action]
Description = Rename Atheros v.6 Firmware
When = PostTransaction
Exec = mv /usr/lib/firmware/ath10k/QCA9377/hw1.0/firmware-6.bin /usr/lib/firmware/ath10k/QCA9377/hw1.0/firmware-6.bin.bak 
NeedsTargets

Greetings :slight_smile:

What would I need to add to the pacman-list hook to get it to delete ones that are older than X days? Or would that require telling the hook to run a script and creating one in the hooks.bin directory?

What do you want it to delete?

I want the hook (or script if I have to add one to run) to delete package list backups older than say... 30 days.

You could script that in manually but I think it would be a lot easier and more effective to use something like logrotate

3 Likes

Oh nice that's already included in Manjaro. Thanks!

1 Like

So something as simple as this, then?

/home/yochanan/package_lists {
	monthly
	rotate 1
}

exists with pamac a hook for clear packages cache ...

https://www.archlinux.org/todo/alpm-hooks-should-use-type-path-not-file/

"File" deprecated , Path is for next version

4 Likes

Forum kindly sponsored by