[pacman-dev] sudo-less pacman -Sy --dbpath
Mathew de Detrich
deteego at gmail.com
Thu Sep 2 11:10:27 EDT 2010
In regards to this https://bbs.archlinux.org/viewtopic.php?id=89484
One issue with pacman is that its one of the few package managers that can't
check if you have updates based on a pacman mirror (defined by the
mirrorlist file) without altering the current pacman database and not
requiring root permissions. Even with using sudo, its only possible to do
the above with
pacman -Sy --dbpath /tmp/somedir/
pacman -Qu --dbpath /tmp/somedir/
with pacman -Sy requiring sudo. The premise for such a change is basically
pacman update checker scripts/widgets etc etc. I am not aware of how a lot
of the pacman widgets check if the system is udpated, however a lot of them
use pacman -Qu which only checks if you need updates with the local database
(not with the mirrors which you have designated in the mirrorlist file).
This is an issue with scripts that run on systems that use
dwm/awesome/xmonad/conky etc etc because such widgets only work if the user
did a pacman -Syu just before the widget checks for updates (or even worse a
pacman -Sy, which if done periodically using crond or some other script can
lead to breaks in the system)
The patch provided allows you to use pacman -Sy --dbpath without having to
use root (you still require root for a pacman -Syu --dbpath or a pacman -Sy
--dbpath <somepath> <package/s>). This makes technical sense as well, since
root isn't actually require if you create a database copy to some file on
the your system (root would only be required if you specify a folder which
you cant access due to permissions, however pacman should forcefully quit in
such an instance as I believe it does currently in other similar
circumstances)
The final premise however is that a user should be able to run a command
like pacman -Qyu which will check if any updates exist according to the
mirror without doing any changes to the pacman database. This means
implementing such update checking programs "properly" (as in check for
updates against mirror) is completely trivial. With this patch its a lot
less trivial (you have to run check if a folder exists in /tmp/, if it does
delete it incase of a broken sync, if not create one, run pacman -Syu
--dbpath onto that folder and then run pacman -Qu --dbpath) but at least its
possible to check if the arch system requires updates without needing root
(if needed I have time next week to create a patch implementing pacman -Qyu
or such a flag)
Note that I have only done fairly basic testing with this patch so don't be
surprised if I missed some cases (or some options). There might be some
other options which when combined with --dbpath actually requires root (I
took the cases of using the -u flag and adding targets on the end). Adding
more of such cases is trivial if you check line 91 of util.c (you guys know
pacman options a lot better then I)
Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbpathwithoutsudo.patch
Type: text/x-patch
Size: 2209 bytes
Desc: not available
URL: <http://mailman.archlinux.org/pipermail/pacman-dev/attachments/20100902/c9beee1c/attachment.bin>
More information about the pacman-dev
mailing list