You are not logged in.

#1 2013-12-30 08:37:33

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Pacman {pre,post}-installation hooks?

Hi,

Most of my filesystems are ro mounted, it would be nice to have Pacman remount them as rw, install the packages and then remount them as ro.

I searched the wiki, Google and the forums and did not find any results.

I already have the script, just need to teach Pacman to use it smile . Does anyone now something about this? I'm starting to get the nasty feeling Pacman does not support this (which should not be *that* big a deal -> sudo is an alternative).


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#2 2013-12-30 09:18:38

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

Re: Pacman {pre,post}-installation hooks?

Moving to Pacman & Package Upgrade Issues...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2013-12-30 09:45:27

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Re: Pacman {pre,post}-installation hooks?

Not at the moment - although it would be easy to write a wrapper script.

Offline

#4 2013-12-30 10:47:25

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: Pacman {pre,post}-installation hooks?

Okay, thanks for the definitive answer.

A wrapper script would involve replacing Pacman right? I don't think that is a good idea, I'm planning on using Archlinux for my parents as well.


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#5 2013-12-30 12:55:34

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

Re: Pacman {pre,post}-installation hooks?

Rexilion wrote:

A wrapper script would involve replacing Pacman right?

No, just "wrapping" it:

## in ~/.bashrc

pacman() {
    # remount rw here
    pacman $@
    # remount ro here
}

For a little better version, you might check the flags passed to determine whether remounting is really necessary.

Last edited by Trilby (2013-12-30 12:56:36)


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

Offline

#6 2013-12-30 16:09:23

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: Pacman {pre,post}-installation hooks?

Ah, I see. Thanks. But that is not going to fly when using gnome-packagekit. Thanks anyway. I'll just use some sudo magic smile . (If nothing better pops up).


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#7 2013-12-30 16:56:09

progandy
Member
Registered: 2012-05-17
Posts: 5,317

Re: Pacman {pre,post}-installation hooks?

Rexilion wrote:

Ah, I see. Thanks. But that is not going to fly when using gnome-packagekit. Thanks anyway. I'll just use some sudo magic smile . (If nothing better pops up).

Does gnome-packagekit use a fixed path? If not, just put the wrapper in /usr/local/bin which will be read before /usr/bin


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#8 2013-12-30 16:58:56

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: Pacman {pre,post}-installation hooks?

Nice, that works!


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#9 2013-12-30 17:21:03

progandy
Member
Registered: 2012-05-17
Posts: 5,317

Re: Pacman {pre,post}-installation hooks?

Rexilion wrote:

Nice, that works!

Really? I just remembered that packagekit probably ignores packman completely an accesses libalpm directly.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#10 2013-12-30 17:23:28

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: Pacman {pre,post}-installation hooks?

Yes indeed, yelled too soon. What works was creating /usr/local/bin/pacman and link that to leafpad. Running pacman makes leafpad open right now.

So sudo it is!


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#11 2013-12-30 17:36:41

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

Re: Pacman {pre,post}-installation hooks?

Rexilion wrote:

Ah, I see. Thanks. But that is not going to fly when using gnome-packagekit. Thanks anyway. I'll just use some sudo magic smile . (If nothing better pops up).

Ah ... then just apply the same logic to gnome-packagekit.  Make a script in your path called gnome-packagekit that remounts rw, runs /usr/bin/gnome-packagekit (or whatever), then remounts ro.


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

Offline

#12 2013-12-30 17:38:29

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: Pacman {pre,post}-installation hooks?

My thoughts exactly. Only this will be gnome-packagekit specific and will not work with other (CLI) backends. But I can live with that. I guess Pacman is fast because it does not contain all these extra features. Which is why I liked it. It's faster than emerge, aptitude and yum. Which is pretty impressive.


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#13 2013-12-31 02:05:34

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Re: Pacman {pre,post}-installation hooks?

Not really...  not having hooks is making package installs slower at the moment.

Offline

#14 2014-03-02 12:01:43

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: Pacman {pre,post}-installation hooks?

Found this:

[root@delta gebruiker]# ls /etc/PackageKit/events/
post-transaction.d  pre-transaction.d

These scripts run at every 'transaction' which, in the case of updating, means that updates are grouped together and processed in one 'transaction'.

Thrilled by this description I decided to have a look at the parameters that were passed using a temporary script.

terminal wrote:

[root@delta gebruiker]# cat /tmp/post /tmp/pre | grep NOTAPISTABLE$
# pre
get-updates NOTAPISTABLE
get-update-detail NOTAPISTABLE
get-details NOTAPISTABLE
simulate-update-packages NOTAPISTABLE
update-packages NOTAPISTABLE
# post
get-updates NOTAPISTABLE
get-update-detail NOTAPISTABLE
get-details NOTAPISTABLE
simulate-update-packages NOTAPISTABLE
update-packages NOTAPISTABLE

Ow well.


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

Board footer

Powered by FluxBB