You are not logged in.
i miss this functionality with pacman:
a command to automatically execute after every invocation (presumably installation or removal of software).
now i wrote myself a little wrapper script and would like to submit it to archforum's scrutiny.
an added challenge: the command differs depending on the window manager.
as a normal user, i set the command, but the wrapper has to find it even as superuser.
here's what i came up with:
/usr/local/bin/pacman:
#!/bin/bash
source /home/<user>/.config/menu_updater >/dev/null 2>&1
MENU_UPDATER=${MENU_UPDATER-true}
menu_updater="$(which $MENU_UPDATER)"
/usr/bin/pacman "$@"
returnvalue=$?
sudo -u <user> "$menu_updater" >/dev/null 2>&1 &
exit $returnvalue
(which pacman shows /usr/local/bin/pacman now)
this is preceded by a few lines in ~/.xinitrc:
case "$WM" in
fluxbox)
export MENU_UPDATER="fluxbox-generate_menu"
echo "$MENU_UPDATER=" > $HOME/.config/menu_updater
exec fluxbox
;;
openbox)
. ~/.fehbg
fbpanel &
export MENU_UPDATER="true"
echo "$MENU_UPDATER=" > $HOME/.config/menu_updater
exec openbox
;;
esac
it seems to be working fine, but what do you think?
maybe it's flawed, waiting for a disaster to happen?
maybe there's an easier/better/safer solution?
Last edited by ondoho (2015-08-30 17:18:16)
Offline
The easier/better/safer solution is in the pipeline. The next big update to pacman should include hook support.
Online
The easier/better/safer solution is in the pipeline. The next big update to pacman should include hook support.
Although I wouldn't be hanging out for it myself - hooks have been "in the pipeline" for quite a while!
See https://bugs.archlinux.org/task/2985, https://wiki.archlinux.org/index.php/Us … cman_Hooks. Perhaps consider voting for the bug if you think it would be helpful.
Offline
10 years, wow.
i added my vote.
...
the wrapper seems to be working ok.
there's some problems with the menu_updater: sometimes the fluxbox menus come out corrupted, not usre if there's multiple instances of the menu_updater running.
but pacman itself (and yaourt) seem to be fine with this.
Offline
Scimmia wrote:The easier/better/safer solution is in the pipeline. The next big update to pacman should include hook support.
Although I wouldn't be hanging out for it myself - hooks have been "in the pipeline" for quite a while!
Ah, but Allan has said it is in the roadmap for 4.3, and there is serious progress: https://lists.archlinux.org/pipermail/p … 20201.html
Online
Wonderful! Note that the wiki still doesn't list a development branch.
Hopefully it makes it in this time
Offline