- sudo yum install rpmdevtools
- rpm2cpio somefile.rpm | cpio -idmv
PolicyKit is an operating system component for controlling system-wide privileges in Unix-like operating systems. It provides an roganized way for non-privileged processes to communicate with privileged ones. In contrast to systems such as sudo, it does not grant root permission to an entire process, but rather allows a finer level of control of centralized system policy.
Files shipped with PolicyKit and 3rd party packages (e.g. under package manager control) typically have comments (such as “DO NOT EDIT THIS FILE, it will be overwritten on update”) telling the system administrator that changes will be overwritten on update.
Configuration for the Local Authority is read from files in the /etc/polkit-1/localauthority.conf.d directory.
The Local Authority reads files with .pkla extension from all directories located inside the /etc/polkit-1/localauthority and /var/lib/polkit-1/localauthority directories. By default, the following sub-directories are installed.
10-vendor.d Intended for use by the OS vendor.
20-org.d Intended for the organization deploying the OS.
30-site.d Intended for the site deploying the system.
50-local.d Intended for local usage.
90-mandatory.d Intended for the organization deploying the OS.
New direcrtories and can be added or removed. The configuration files are the .pkla files. A .pkla file must be named by using a scheme to ensure that the name is unique, e.g. reverse DNS notation or similar. For example com.mycompany.packagekit.pkla .
Each group in a .pkla file must have a name that is unique within the file it belongs to.
The following keys are are recognized:
Identity
Action
ResultActive
ResultInactive
ResultAny
ReturnValue
Sample .pkla file
# Allow "standard users" to do some things without being interrupted by |
# password dialogs (TODO: not complete) |
# |
[Desktop User Permissions] |
Identity=unix-group:wetab |
Action=org.freedesktop.packagekit.package-install;org.freedesktop.packagekit.package-remove; |
ResultAny=no |
ResultInactive=no |
ResultActive=yes |
This configuration file allows packagekit to install and remove packages.
The policies files are located in /usr/share/polkit-1/actions/"DBUS application name" .
Anything in /usr isn't considered 'configuration', so any time the PolicyKit is updated modifications will be wiped out and the modifications should be done again. Configuration should be set /etc or /var .
http://hal.freedesktop.org/docs/polkit/pklocalauthority.8.html
$ man pklocalauthority
PackageKitPackagekit is an open source and free suite of software applications designed to provide a consistent and high-level front end for a number of different package management systems. PackageKit itself is a system activated daemon called packagekitd, that abstracts out differences between the different systems. The actual nuts-and-bolts distro tool (yum, apt, conary, etc) is used by PackageKit using compiled and scripted helpers. Those tools (yum, apt, conary, etc) are called the backend for PackageKit. PackageKit isn't meant to replace these tools, instead providing a common set of abstractions that can be used by standard GUI and text mode package managers. It provides C++, python APIs which actually at this currently are not well documented and everything presented here is derived from my studying of the code. InstallationThe recent version of PackageKit is 0.6.6, this is not available in repositories and it should be compiled from sources, which can be found here http://www.packagekit.org/releases/PackageKit-0.6.6.tar.gz . Please check if newer versions are available. While configuring PackageKit dont forget to configure it with following flags ./configure --with-default-backend=yum --enable-yum --prefix=/usr --sysconfdir=/etc --disable-static --disable-local PackageKit daemon is a system activated daemon so you have to point dbus the location of the packagekit's daemon by configuring following file /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service Restart dbus service sudo /etc/init.d/messagebus restart PackageKit daemon location is /usr/libexec/packagekitd IssueThe attached script failed installing packages with "wetab" user privileges, the reason is not clear yet. That to run script successfully launch it with "sudo". Raw Dbus APIIssuesThe DBus API is defined by PackageKit but it's up to the backends themselves to do the right thing, and support all the different ways of using it. Depending on platform/packagekit version Dbus API may differ, for instance Dbus API in Ubuntu for the same version of PackageKit differed from the Dbus API under MeeGo, as authorof PackageKit said "Ubuntu really needs to update PackageKit to something more up to date." APIObject path : /org/freedesktop/PackageKit Interfaces :
API description can be found here The latest interface is available in the source tree or on-line. HelpThat to see Dbus API on current platform install Dbus debugger called "d-feet". If after launching "d-feet" does not show /org/freedom/PackageKit object path then launch packagekitd daemon manually with super user privilages: sudo /usr/sbin/packagekitd Connect to "unix:path=/var/run/dbus/system_bus_socket" to debug SystemBus High Level Python APIThere an python class called "PackageKitClient" located in /usr/lib/python2.6/site-packages/packagekit/client.py file, which provides high level interface for package management. Unfortunatelly the class is not well documented and some functions are not working OK. Because of this the packagekit-wrapper-meego.py was implemented, which contains PackageKitClient wrapper class similiar to PackageKitClient implemented in /usr/lib/python2.6/site-packages/packagekit/client.py file. The packagekit-wrapper-meego.py is modifcation/addition of Canonicals packagekit wrapper for MeeGo. Run script with superuser privilegies as currently there is an issue decribed in PackageKit installation section. The PackageKitClient (Attached) Class is written in python and contains methods described below. Also it contains the usage of all described functionalities. The PackageKitClient class provides following methods: Resolve(filter, package) : returns list of matched packages GetDetails(package) : returns the details of the packages SearchName(filter, name) : searches and returnes availlable packages InstallPackage(package, RemovePackage(package, The packagekit-wrapper-meego.py is attached. The mechanisms that are used in class for implementing the methods are same for implementing the same methods in C++ as well. Sample of retrieving Transaction's status using python:
High Level C++ API, using libpackagekitThe libpackagekit gobject librarywraps the DBUS interface in a nice glib-style API. This makes designing programs that use libpackagekit can concentrate on core functionality rather that the DBUS and PackageKit internals. PkClient in libpackagekit can be used as easily as: Code sample
More info can be found here http://packagekit.org/gtk-doc/PkClient.html Mechanism of retrieving progress informationThe org.freedesktop.PackageKit.Transaction interface containes transaction properties (status, percentage, etc) and signal Changed() which is invoked if one of the parameters is changed. So that to get installation/removal progres just connect to the Changed() signal and read off the properties. PolicyKit and PackageKitRunning DBus methods like InstallPacakges, RemovePackages, UpdateSystem and others requires authorization with root account. That to change authorization policies for this and other DBus methods PolicyKit should be configured. How to configure PolicyKit can be found in this blog. That to set policy the action name for the appropriate name should be known for example "InstallPackages" methods action name is "org.freedesktop.packagekit.install-untrusted". Action names can be found the packagekit DBus API description here http://www.packagekit.org/gtk-doc/api-reference.html IssueDepending on configured policies, platform there might be need to set addtional policies for example that authorize SystemUpdate without root password "sudo" also "org.freedesktop.packagekit.install-untrusted" action should be setResultActive=yes . SolutionThat to see the required action names install package "polkit-gnome" which is available in meego repositories. Polkit-gnome will launch a pop-up window if the application requries the autorization. Under details you can see the action which required authorization. Here is a sample which shows action name for package removal References |
/usr/include/c++/4.4/ext/atomicity.h(46): error: identifier "__sync_fetch_and_add" is undefinedIt seems still there are problems while compiling cuda with gcc 4.4 and above.
/usr/include/c++/4.4/ext/atomicity.h(50): error: identifier "__sync_fetch_and_add" is undefined
nvcc --device-emulation --compiler-bindir=/usr/bin/gcc-4.3 -arch sm_13 main.cu -o run