Archive for November, 2008

Making a Fedora Custom CD

November 29, 2008

Make a custom spin of Fedora 9 was cool, I tryed on Fedora 10 and it didn’t work fine.

I installed virtual box on my laptop and installed fedora 9 32 bits on it.

Inside the virtual machine with fedora 9 I ran the commands:

1.0) Install pungi

#yum install pungi

1.1) I copyed the kickstart file provided

repo –name=release –mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-9&arch=$basearch
repo –name=updates –mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f9&arch=$basearch

%packages –nobase
bash
kernel
passwd
policycoreutils
chkconfig
authconfig
rootfiles
anaconda-runtime

%end

1.2) Generating the iso file
#pungi -c f9-ks.cfg –nosource –force –ver=FC9

The generation of the iso file took almost one hour, now I just need to burn the iso file on a dvd and install it in a computer in the lab.

Compiz-Fusion – Gnome – Fedora 10 x86_64

November 27, 2008

1.0) Removing the old compiz

#yum -y remove compiz

1.1) Install the rpmfusion (Livna, Freshrpms and Dribble) repository.

#rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

1.2) Installing the new compiz with lots of plugins

#yum -y install compiz-fusion compiz-fusion-gnome compiz-fusion-extras compiz-fusion-extras-gnome compizconfig-backend-gconf compiz-manager gnome-compiz-manager ccsm fusion-icon fusion-icon-gtk emerald emerald-themes

1.3) Configuring Auto Start

Go to:

System -> Preferences -> Personal -> Sessions

Click add

And type:

Name: Fusion Icon
Command: fusion-icon
Comment: Compiz Fusion Panel Applet

1.4) Now, just logoff from your computer and login again then you will see the fusion icon.

Have fun !!!

Source:
[1]  http://www.my-guides.net/en/content/view/125/26/1/9/

Func RPM Verification Project – Release 0.3 – Beta

November 26, 2008

After a iteration with the community I changed the way to invoke the method, instead of using a asynchronous call, now I can use a synchronous call. The results now came very fast, and it begins to appear on the screen the time they are processed.

This is the code to be released in the 0.3 version of the project.

def verify(self, flatten=True):

import commands, os, subprocess
ts = rpm.TransactionSet()
mi = ts.dbMatch()
results = []
for hdr in mi:
name = hdr[‘name’]
if flatten:
subprocess.call([“/bin/rpm”, “-V”, name], shell=False)
results.append(“%s” % (name))
else:
results.append([name])
return results

func-logo-small6

Mosaic using Linux Command Line Tools

November 21, 2008

1.0) Creating a mosaic

1.1) Install metapixel

yum -y install metapixel

1.2) Create the library directory that will be the source of your mosaic.

metapixel-prepare source_directory destination_directory –width=25 –height=25

1.3) Creating the mosaic

metapixel –metapixel source_image.jpg mosaic_name.png –library source_files_from_metapixel_prepare –scale=35 –distance=100

And here is my mosaic…..

milton3

2.0) Removing red eyes on Gimp

    gimp-logo

    2.1) Open a picture

    2.2) Go to Filters -> Enhance -> Red Eye Removal

    gimp-how-to

    Working on Release 0.3 of the Project

    November 21, 2008

    After getting some feedback of the Func community is time to polish the release 0.2 and work on the release 0.3

    func-logo-small5

    Linux Machines as Routers – Network Scenario

    November 20, 2008

    The scenario has 3 desktops and 2 routers, remember that all of then are Linux computers.

    • Topology

    topology1

    • Configurations

    Desktop A
    route add -net 172.17.0.0 gw 11.0.0.254
    route add -net 192.168.2.0 netmask 255.255.255.0 gw 11.0.0.254

    Desktop B

    route add -net 11.0.0.0 netmask 255.0.0.0 gw 172.17.0.254
    route add -net 192.168.2.0 netmas, 255.255.255.0 gw 172.17.254.254

    Desktop C

    route add -net 172.17.0.0 netmask 255.255.0.0 gw 192.168.2.254
    route add -net 11.0.0.0 gw 192.168.2.254

    Router ABC

    eth0 172.17.0.254/16
    eth0:1 11.0.0.254/8
    echo “1” > /proc/sys/net/ipv4/ip_forward
    route add -net 192.168.2.0 gw 172.17.254.254

    ROUTER BCA

    eth0 172.17.254.254/16
    eth0:1 192.168.2.254/24
    echo “1” > /proc/sys/net/ipv4/ip_forward
    route add -net 11.0.0.0 netmask 255.0.0.0 gw 172.17.0.254

    Numbers Game in Python – Lab I

    November 20, 2008

    It was cool to handle with python deeper than the famous “Hello World”. I am still getting adapted with the new language, but its looks like not to be hard; No variables declarations, no brackets, no square brackets, just indent.

    This is the code of my python game:

    #!/usr/bin/python

    import random
    secret=random.randrange(1,100)

    print ‘###########################’
    print ‘#           Welcome to guess a number game….. 🙂              #’
    print ‘###########################’
    print ‘Game Instructions: Your goal is to guess the secret number. ‘
    print ‘to play type a number between 1 and 100 and the computer is going to ‘
    print ‘say if you have to type a greater number or lower number\n’
    print ‘PS: your have a maximum of 10 atempts to guess the number\n’

    number_tryes=0
    while True:
    #Test the limit of the number of tryes
    if number_tryes > 10:
    break

    #Test if the value entered is a number
    try:
    guess=int(raw_input(“Enter a guess: “))
    except:
    print ‘You have to type only numbers’
    continue
    #Test if the number is in the range
    try:
    if not 0 <= guess <= 100:
    continue
    except:
    print ‘You have to type a numbe between 1 and 100’
    continue

    if guess<secret:
    print “Too low!”
    number_tryes+=1
    elif guess>secret:
    print “Too high!”
    number_tryes+=1
    else:
    number_tryes+=1
    print “Correct!\n”
    print ‘You typed’, number_tryes , ‘times to guess the magic number’
    break
    print ‘###########################’

    Func RPM Verification Project – Release 0.2 – Official

    November 14, 2008

    ==Project Name==

    Func Rpm Module ”’Verification Method”’

    ==Project Description==

    Create a method inside the ”’rpms module”’ to verify the rpms of the system.

    This method will generate the same output of the command
    ”’#rpm -V -a ”’

    It will allow a system administrator to execute the command in a main server and verify all the servers at once.

    ==Project Details==

    The ”’rpms”’ module is in the file: ”’/usr/lib/python2.5/site-packages/func/minion/modules/rpms.py”’

    I added the method ”’verify”’

    # Copyright 2007, Red Hat, Inc
    # Michael DeHaan <mdehaan@redhat.com>
    #
    # This software may be freely redistributed under the terms of the GNU
    # general public license.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program; if not, write to the Free Software
    # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    import func_module
    import rpm
    class RpmModule(func_module.FuncModule):
    version = “0.0.2”
    api_version = “0.0.1”
    description = “RPM related commands.”
    def inventory(self, flatten=True):
    “””
    Returns information on all installed packages.
    By default, ‘flatten’ is passed in as True, which makes printouts very
    clean in diffs for use by func-inventory.  If you are writting another
    software application, using flatten=False will prevent the need to
    parse the returns.
    “””
    # I have not been able to get flatten=False to work if there
    # is more than 491 entries in the dict — ashcrow
    ts = rpm.TransactionSet()
    mi = ts.dbMatch()
    results = []
    for hdr in mi:
    name = hdr[‘name’]
    epoch = (hdr[‘epoch’] or 0)
    version = hdr[‘version’]
    release = hdr[‘release’]
    arch = hdr[‘arch’]
    if flatten:
    results.append(“%s %s %s %s %s” % (name, epoch, version,
    release, arch))
    else:
    results.append([name, epoch, version, release, arch])
    return results

    ”’def verify(self, flatten=True):”’
    ”'””””’
    ”’Returns information of the verification of all installed packages.”’
    ”'””””’
    ”’import commands”’
    ”’ts = rpm.TransactionSet()”’
    ”’mi = ts.dbMatch()”’
    ”’results = []”’
    ”’for hdr in mi:”’
    ”’checksum = commands.getoutput(“rpm -V ” + hdr[‘name’])”’
    ”’if flatten:”’
    ”’results.append(“%s” % (checksum))”’
    ”’else:”’
    ”’results.append([checksum])”’
    ”’return results”’

    def glob(self, pattern, flatten=True):
    “””
    Return a list of installed packages that match a pattern
    “””
    ts = rpm.TransactionSet()
    mi = ts.dbMatch()
    results = []
    if not mi:
    return
    mi.pattern(‘name’, rpm.RPMMIRE_GLOB, pattern)
    for hdr in mi:
    name = hdr[‘name’]
    epoch = (hdr[‘epoch’] or 0)
    version = hdr[‘version’]
    release = hdr[‘release’]
    # gpg-pubkeys have no arch
    arch = (hdr[‘arch’] or “”)

    if flatten:
    results.append(“%s %s %s %s %s” % (name, epoch, version,
    release, arch))
    else:
    results.append([name, epoch, version, release, arch])
    return results
    def register_method_args(self):
    “””
    Implementing the method argument getter
    “””
    return {
    ‘inventory’:{
    ‘args’:{
    ‘flatten’:{
    ‘type’:’boolean’,
    ‘optional’:True,
    ‘default’:True,
    ‘description’:”Print clean in difss”
    }
    },
    ‘description’:”Returns information on all installed packages”
    },
    ‘glob’:{
    ‘args’:{
    ‘pattern’:{
    ‘type’:’string’,
    ‘optional’:False,
    ‘description’:”The glob packet pattern”
    },
    ‘flatten’:{
    ‘type’:’boolean’,
    ‘optional’:True,
    ‘default’:True,
    ‘description’:”Print clean in difss”
    }
    },
    ‘description’:”Return a list of installed packages that match a pattern”
    }
    }

    ==Project News==

    func-logo-small4

    Torrent x Magnet

    November 13, 2008

    .Torrent files:
    –    Other user will not able to see your share folder, since it only share the files that you’re downloading and the one that you marked to be shared.
    –    It is very easy to find updated resources from .torrent files.
    –    You will able to get fast connection, especially when the resource is updated lately and it’s a popular file.
    –    You can change a lot of different options in the application during downloading a torrent package, including priority, download and upload bandwith.

    Magnet files:
    –    You may not able to find updated resources, since there are not many people using magnet links.
    –    Your fireware or your internet supplier may have disable the port or limit the bandwidth for magnet port.

    Disadvantages:

    .Torrent files:
    –    Even you can google a lot of torrent files from the internet, torrent clients do not have search functions.
    –    Compare to magnet links, you have to find torrent files yourself, instead of just click on a web page or search in the client application.

    Magnet files:
    –    You may expose some sensitive files when you’re sharing a whole directory.
    –    Files are not up-to-date
    –    a lot of spam and virus in this peer-to-peer network.

    Func RPM Verification Project – Release 0.2

    November 11, 2008

    I found the documentation of the RPM Python API in the address: http://docs.fedoraproject.org/drafts/rpm-guide-en/ch16s06.html

    Varinder show me the command

    #func <target_machine> call system list_module

    I read the documentation in the func fedora hosted website and I found another useful command:

    #func <target_machine> call system list_methods

    The items only appear after restart the funcd daemon.

    I modified the rpms module and added a new function call verify, the output of list methods is:

    [root@milton func]# func milton.ca call rpms list_methods
    {‘milton.ca’: [‘verify’,
    ‘glob’,
    ‘inventory’,
    ‘module_description’,
    ‘module_version’,
    ‘get_method_args’,
    ‘module_api_version’,
    ‘list_methods’]}

    Now the verify is working like the inventory function, but soon I will put the functions needed.

    In the rpms module there are some methods inventory, glob, module_description, module_version and now verify.

    • inventory

    Returns information on all installed packages.

    • glob

    Return a list of installed packages that match a pattern, kind of packet search.

    • module_description

    [root@milton func]# func milton.ca call rpms module_description
    {‘milton.ca’: ‘RPM related commands.’}

    • module_version

    [root@milton func]# func milton.ca call rpms module_version
    {‘milton.ca’: ‘0.0.2’}

    • verify

    Returns information of the verification of all installed packages.

    func-logo-small2