#User hooks for pacman

29 messages · Page 1 of 1 (latest)

harsh garden
#

Trying to make a couple of applications rerun when updating, but making sure those applications have $EUID different from root

#

@outer wave

#

So, whenever pacman updates some systemd-bus related packages, some applications that I run in userspace that depend on it breaks, mostly fcitx5 and some mouse configurations

#

I have a couple of scripts that I use on my i3wm configuration that takes care of fixing the mouse issues, and fcitx has native support for "reloading"

#

the thing is, both apps are ran as my user, so I'm mostly just brainstorming to see if there is a way to make it so that "user hooks" are possible

outer wave
#

I don't think so... I looked at the man page

sick cave
#

you could probably add a system hook that runs a script which does something like su $SUDO_USER -c "commands to reload the app as a user"

outer wave
#

it doesn't look like there's a way to tell it to run the hooks as some user

harsh garden
#

I don't mind writing applications

#

I could possibly make a root app that takes a look at the config for available users and their hook directories

#

which could then run that su command

sick cave
#

SUDO_USER would then be your user

#

you could also just hardcode your username in the script

harsh garden
#

I don't think that'd be an issue unless the user hooks must always be rerun regardless of who is current logged in

#

the thing with these "user hooks" is that they only need to be run when the session owner is the user

#

so, technically not a bug, just a feature

sick cave
#

you could just check the username in the script

outer wave
#

I think unless rerunning these apps would be more trouble if they don't have to be rerun it's probably easier just to run a script after updating

sick cave
#

true

harsh garden
#

true²

#

I wonder if I can make something generic that works for everyone

#

or rather, mostly everyone

sick cave
#

a user hook system should be relatively simple to make

harsh garden
#

A simple user_name & user_hookpath should be enough

sick cave
#

just make sure you're not executing user-writable scripts as root KEKDOGE

harsh garden
#

then, execute as the user everything in the ${user_hookpath} that is +x'd