Editing Device management using Bcfg2

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 21: Line 21:
|-
|-
| Enterprise
| Enterprise
-
| A large company or other organization that wants employees to ba able to acces company IT systems using Maemo based devices
+
| A large company ot other organization that wants employees to ba able to acces company IT systems using Maemo based devices
|-
|-
| Desktop computer
| Desktop computer
Line 40: Line 40:
*[http://www.linuxlinks.com/article/20100222155850632/ConfigurationManagement.html 7 of the Best Free Linux Configuration Management Tools]
*[http://www.linuxlinks.com/article/20100222155850632/ConfigurationManagement.html 7 of the Best Free Linux Configuration Management Tools]
-
* [http://docs.bcfg2.org Bcfg2 documentation]
+
* [http://trac.mcs.anl.gov/projects/bcfg2/wiki/Bcfg2Doc Bcfg2 documentation]
== Device management? Why bother? ==
== Device management? Why bother? ==
Line 72: Line 72:
== Getting Bcfg2 up and running ==
== Getting Bcfg2 up and running ==
-
<font color="red">A word of warning</font>: Configuration management is complicated task. Learning Bcfg2 and the concepts behind it does take some time and effort. Do NOT try to manage Maemo clients as your first Bcfg2 rehearsal. Instead, familiarize yourself with Bcfg2 first using "ordinary" computers  as clients.
+
<font color="red">A word of warning</font>: Configuration management is complicated task. Learning Bcfg2 and the concepts behind it does take some time and effort. Do NOT by try to manage Maemo clients as your first Bcfg2 rehearsal. Instead, familiarize yourself with Bcfg2 first using "ordinary" computers  as clients.
=== Problems with Bcfg2 in Maemo ===
=== Problems with Bcfg2 in Maemo ===
Line 192: Line 192:
  This is a simple file
  This is a simple file
-
Edit file <code>/var/lib/bcfg2/Cfg/etc/simple/info.xml</code> to contain following:
+
Edit file <code>/var/lib/bcfg2/Cfg/etc/simple/simple</code> to contain following:
  <FileInfo>
  <FileInfo>
Line 257: Line 257:
=== Autogroup probe ===
=== Autogroup probe ===
-
Bcfg2 is able to automatically determine group memberships using probes. Aa sample probe code which recognizes Maemo devices among many other computers is shown below:
+
Bcfg2 is able to automatically determine group memberships using probes. [http://wiki.maemo.org/Image:Autogroup.sh Here] is a sample probe code which recognizes Maemo devices among many other computers. Just put the code into a file at Probes directory, for example, <code>/var/lib/bcfg2/Probes/autogroup</code>
-
 
+
-
<source lang="bash">
+
-
#! /bin/sh
+
-
 
+
-
opi=/usr/bin/osso-product-info
+
-
swv=/usr/bin/sw_vers
+
-
 
+
-
# Are we Linux?
+
-
if uname 2>/dev/null | grep -q "Linux"
+
-
then
+
-
    # LSB saves the day
+
-
    if lsb_release -a > /dev/null 2>&1
+
-
    then
+
-
        lsb_release -ci 2>/dev/null |\
+
-
        awk -F: '{gsub(/^[ \t]+/, "", $2);print "group:" tolower($2)}'
+
-
    # It did not? We might be maemo
+
-
    elif [ -x $opi ]
+
-
    then
+
-
        if $opi 2>/dev/null | grep "OSSO_PRODUCT_RELEASE_NAME" | grep -q 'Maemo 5'
+
-
        then
+
-
            echo "group:fremantle"
+
-
        elif $opi 2>/dev/null | grep "OSSO_PRODUCT_RELEASE_NAME" | grep -q 'Maemo 6'
+
-
        then
+
-
            echo "group:harmattan"
+
-
        fi
+
-
        echo "group:maemo"
+
-
    # We were not? Get desperate
+
-
    elif uname -v 2>/dev/null | grep -q "Ubuntu"
+
-
    then
+
-
        echo "group:ubuntu"
+
-
    elif [ -f /etc/fedora-release ]
+
-
    then
+
-
        echo "group:fedora"
+
-
    elif [ -f /etc/redhat-release ]
+
-
    then
+
-
        echo "group:redhat"
+
-
    else
+
-
        echo "group:linux"
+
-
    fi
+
-
fi
+
-
 
+
-
# Are we Mac?
+
-
if uname 2>/dev/null | grep -q "Darwin"
+
-
then
+
-
    if [ -x $swv ]
+
-
    then
+
-
        if  $swv 2>/dev/null | grep "ProductVersion:" | grep -q '10.6'
+
-
        then
+
-
            echo "group:snowleopard"
+
-
        elif $swv 2>/dev/null | grep "ProductVersion:" | grep -q '10.5'
+
-
        then
+
-
            echo "group:leopard"
+
-
        elif $swv 2>/dev/null | grep "ProductVersion:" | grep -q '10.4'
+
-
        then
+
-
            echo "group:tiger"
+
-
        else
+
-
            echo "group:macosx"
+
-
        fi
+
-
    else
+
-
        echo "group:freebsd"
+
-
    fi
+
-
fi
+
-
 
+
-
# What arch?
+
-
if uname -m | grep -E '^arm' > /dev/null 2>&1
+
-
then
+
-
    echo "group:armel"
+
-
elif uname -m | grep -E '^i.?86'> /dev/null 2>&1
+
-
then
+
-
    echo "group:i386"
+
-
elif uname -m | grep -E '^x86_64'> /dev/null 2>&1
+
-
then
+
-
    echo "group:amd64"
+
-
else
+
-
    echo "group:`uname -m`"
+
-
fi
+
-
</source>
+
-
 
+
-
Just put the code into a file at Probes directory, for example, <code>/var/lib/bcfg2/Probes/autogroup</code>
+
At Bcfg2 web site is another [http://trac.mcs.anl.gov/projects/bcfg2/wiki/Plugins/Probes/examples/group example] of autogroup probe code. This code does not recognize Maemo but might do better work with some other platforms.
At Bcfg2 web site is another [http://trac.mcs.anl.gov/projects/bcfg2/wiki/Plugins/Probes/examples/group example] of autogroup probe code. This code does not recognize Maemo but might do better work with some other platforms.
Line 359: Line 280:
#* Suitable approach for servers but brings tiny device at it's knees
#* Suitable approach for servers but brings tiny device at it's knees
#* We probably only want to control that package X is installed and let package manager take care of the rest (updates & such)
#* We probably only want to control that package X is installed and let package manager take care of the rest (updates & such)
-
# No any form of proxy handling (odds being inside corporate firewall are good)
+
#* No any form of proxy handling (odds being inside corporate firewall are good)
==== Opportunities ====
==== Opportunities ====
Line 369: Line 290:
We need to write a "APTlite" client driver. Probably modifying an simple existing driver like <code>FreeBSDPackage.py</code> would do. Some notes about the task:
We need to write a "APTlite" client driver. Probably modifying an simple existing driver like <code>FreeBSDPackage.py</code> would do. Some notes about the task:
-
* <code>RefreshPackages</code> method needs to be modified to include only packages received from server and ignore the rest. Looks like following piece of code generates the list we need
+
* RefreshPackages needs to be modified to include only packages received from server and ignore the rest. Looks like following piece of code generates the list we need
  desired = [entry.get('name') for struct in self.config for entry in struct if entry.tag == 'Package']
  desired = [entry.get('name') for struct in self.config for entry in struct if entry.tag == 'Package']
-
* Then, we could run something like this for each pkg in desired list to fill up the <code>self.installed</code> dictionary:
+
* Then, we could run something like this for each pkg in desired list:
  /usr/bin/dpkg-query -W --showformat='${Version}\t${Status}\n' <pkg>
  /usr/bin/dpkg-query -W --showformat='${Version}\t${Status}\n' <pkg>
-
* <code>VerifyPackage</code> method needs probably to be made a bit more liberal, like returning true if <code>entry.attrib['version']</code> equals <code>'auto'</code>  or <code>'any'</code>
+
* Package verification (VerifyPackage) needs probably to be made even more liberal, like returning true if entry.attrib['version'] is 'auto' or 'any'
-
 
+
-
* <code>pkgtool</code> could probably be copied from <code>APT.py</code>
+
-
 
+
-
* Proxies could be copied from shell environment by adding them into <code>pkgtool</code>. Something like
+
-
 
+
-
proxies = ""
+
-
for p in ('http','https','ftp'):
+
-
    if os.environ.has_key('%s_proxy' % p):
+
-
        proxies += '%s=%s ' % ('%s_proxy' % p, os.environ.get('%s_proxy' % p))
+
-
pkgtool = proxies + ' ' + pkgtool
+
-
 
+
-
And how to get proxies into shell variables? One option is to use Bcfg2 to manage some file which is sourced by shell
+
[[Category:Power users]]
[[Category:Power users]]

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)