Available Solutions Scanner

From wiki.gpii
Jump to: navigation, search

Note: This page describes early work on a component that is part of the Device Reporter. See Solutions Reporter and Device Characteristics Reporter in the architecture description. Some information on this page may be out of date.


Part of the work for Matchmaking and Solutions Reporting depends on determining which applications and solutions are currently available on the local device. We will develop an API contract for GPII components that will be Solutions Scanners for the device. Implementations will exist for the devices and operating systems we support, and in some situations there may be multiple implementations that run on a particular device profile. Consider a situation such as a Red Hat Linux distribution. Some of the solutions may be installed using rpm packages with a package management system such Yum. However, oftentimes 3rd party applications may have install scripts that place them in /usr/local, /opt, or somewhere else. In that situation it may not be registered with yum. So, it may be necessary to check multiple locations.

Tasks include:

  • Investigating and building our node hooks into various libraries/scripts on different platforms
  • Developing the GPII signatures and appropriate places to integrate the scanner information.

Interesting Issues

  • Will some types of scanning need to happen in the background at regularly scheduled intervals, or triggered by certain OS events.  In some cases, if detecting the solution takes a long time, it won't be acceptable to do that work while the user is waiting to log in. Instead we may need to do it periodically and persist/cache the results locally.
  • How will we know how to scan for various solutions? E.g. given a solution such as Orca, how do we know if it's installed via yum, and if it is what the name(s) of the packages are? Will some of this metadata need to be added to the solutions registry json schema, and if not there, where?

Platform Specific Libraries

Following is a current list of potential libraries to use on each platform, or in some cases libraries to look to for inspiration (in the even they have licensing restrictions).

Linux

On Linux we'll likely start by using the package managers on modern distributions such as yum or apt.  A univeral library which attempts to bridge all of these is Package Kit.

http://www.packagekit.org/pk-intro.html

  • Fedora 17 has PackageKit 0.7.4 installed out of the box.
  • Ubuntu 12.04 has PackageKit 0.7.2 available in the default set of apt repositories.

Version 0.7.2+ has enough functionality for what we are trying to accomplish.

Windows

Although we still need to look at the licensing issues, the following libraries may prove educational to look at:

Another strategy is to look at the Uninstall section in the registry, as most applications put items there.  Evgeni has created a .bat script that does this. ( TODO put this somewhere in git )

echo List of installed software > software_list.txt
echo ========================== >>software_list.txt

reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall tempHKLM.txt
reg export HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall tempHKCU.txt

find "DisplayName" tempHKLM.txt tempHKCU.txt | find /V "ParentDisplayName" > tempList.txt

for /f "tokens=2,3 delims==" %%a in (tempList.txt) do (echo %%~a >> software_list.txt)

del tempHKLM.txt tempHKCU.txt tempList.txt

notepad software_list.txt

OS X

One possible option on OS X is the System Profiler command line tool which will output XML formatted information about all installed applications.

system_profiler SPApplicationsDataType -xml

Android

The following thread discusses ways of detecting what is installed on Android:

http://stackoverflow.com/questions/2695746/how-to-get-a-list-of-installed-android-applications-and-pick-one-to-run

To install applications programmatically on android:

http://stackoverflow.com/questions/4604239/install-application-programmatically-on-android

See also