Gnome-Blog: A new RPM & way to post.

I’m forever looking for ways to make things easier for myself ;)

Today I came across gnome-blog it’s a small gnome applet that allows you to post direct from your desktop, Infact that’s exactly how this was written ! (h)

The default FC3 rpm on seths website didn’t install for me, it complained about a python(abi) dependancy – which I just couldn’t find :( – I did however find this similar rpm which I installed before installing gnome-blog, so if you have problems installing my rpm, then this may help. ( http://dl.atrpms.net/~/pythonabi-2.3.4-1.rhfc3.at.i386.rpm )

This is the screenshot from seth’s site, although I can’t work out how to preview like his !

screen shot

Oh yeah – my rpm is here: gnome-blog-0.8-1.i386.rpm

Getting started with ACPI

Hardware stuff, especially laptops is usually window$/manufacturer specifc so getting some of it work work can be a bit of a pain. In FC1 low batteries & standby is handled by APM, in FC2 upwards APM is replaced with ACPI & this is a quick text on getting going.

There are two folders & a service :

  • /etc/acpi/actions
  • /etc/acpi/events
  • /etc/init.d/acpid

The service , I think runs in the background monitoring the hardware, you can then put events into /etc/acpi/events and get things to happen when the deamon spots them .

I originally tested this on an HP Omnbook 6000, but now I’m using a compaq nc6000 . To replace apm I need to

  1. Monitor Battery / Power Status
  2. React when power button / standby pressed
  3. Do Something when the lid is closed

Documentation :

http://acpi.sourceforge.net/documentation/index.html


To get started I had a look at the documentation ;) also there is an example in FC3 ( /etc/acpi/events/sample.conf )

Sample.conf

 # This is a sample ACPID configuration
event=button/power.*
action=/sbin/shutdown -h now
 

the Documentation explains that all acpi “real time” info is stored in /proc/acpi .

If you look /proc/acpi there is a directory “button” and in there “power” , so sample.conf seems to suggest if anything under “power” changes do action (in this case shutdown the machine).

Armed with this I could “test” with something a little quicker than switching on/off the machine; like opening / closing the lid….

So, in /proc/acpi/button/lid/C139 (the C139 is laptop specific) there is a file called state, and when it will tell you if the lid is open or closed (just in case you didn’t know ;) ), now it is this “lid” directory that acpi will be looking for, so what you do is create a file called /etc/acpi/events/lid and put in it

/etc/acpi/events/lid

# This is a sample ACPID configuration – what to do when a laptop lid is closed.
event=button/lid.*
action=/etc/acpi/actions/lid “%e”

You’ll notice that the action is set to /etc/acpi/actions/lid “%e” this will be a script, but you could point it to any script/executable you like. In /etc/acpi/actions/lid I have put

/etc/acpi/actions/lid

#!/bin/bash

# Make sure we recieve something !
if [ "$1" = "" ]
then
echo “Script Failed, NO Input !!!”
exit
fi

# what we got from the acpi deamon
acpi_in=”$1″
# what the lid code was…
lidstatus=`echo “$acpi_in” | awk ‘{print $4}’`

# the lid code in dec
dec_lidstatus=`printf “%d\n ” 0x$lidstatus`

#prepare for the maths
x=$dec_lidstatus
y=2

# was the lid code odd or even ?
mod=$(($x % $y)) # get the remainder of x / y and assign it to variable mod

# If %mod is 0 then the number is even, if it is 1 then the number is odd !
if [ $mod = 0 ]
then
# even numbers mean the lid is open !!!
# wall lid open
exit
else
# odd means closed !!!
# wall lid closed

# so lets lock the desktop !
su – nick -c “xscreensaver-command -lock”
fi

Now, this needs a little explaining…..

There a couple of things you need to know about acpi

  1. acpi runs as root, so any event get’s executed with root priveleges :D
  2. %e is an incremental number, odd numbers for lid closed & even for lid open
  3. To get these changes to work you need to restart the acpi service

So as you can see my lid open/close script gets a little complicated. To play if you remove the comments in from of the “wall” commands, save an open an empty shell, when you open & close the lid you get broadcast messages from root ! :cool: or if you just leave it as it is it’ll try and run “nick”‘s screen saver :D

Now my old laptop had both a standby or sleep button and a power button, but getting events to happen is exactly the same, simply create a script doing what you want it to do, create a file ine /etc/acpi/events and set the event to event=button/power.* (or event=button/sleep.*) and voila !

Now finally, monitoring battery status, thankfully gnome already has a nice applet

or if you want to check it your self /proc/acpi/battery/C138/state (again C138 is laptop specific) this file will tell you !

I hope you’ve found this of some use !

Beagle is Driving me MAD !

beagle logo

grr… I need to vent some frustration… if you don’t know what the beagle is you should check their website:

http://www.gnome.org/projects/beagle/

In a nutshell it’s a cutting egde gnome search tool, and everything I’ve read about it is really positive, the problem is there doesn’t seem to be many Fedora Users using it, so there isn’t much documentation on getting it working… I was thinking about doing my own, but I’ve messed about with my laptop so much, that even if i do get it to work I’ll have forgotten what I’ve done !

Anyway I’d like to send a Big Thanks to Ben Konrath who has just compiled a new inotify kernel for me.

Using Legacy Sound Cards In FC3

For a short time I had a Sony PCG-C1F laptop …

Now these boxes are quite old, so it get sound working in Fedora Core 3 we’d need some legacy sound card support. Sound cards in FC3 are powered by ALSA & the alsa project is very comprehensive, and support the sound card in this box… BUT surprisingly, on a clean install of fedora it doesn’t work :(

So what do we need to do to get legacy sound cards to work ?

According to the ALSA documentation we need to run a configuration utility called alsaconf.. but it doesn’t exist. I found a thread on the fedora list that explained this…

https://www.redhat.com/archives/fedora-list/2004-November/msg08614.html

As you can see bug was filed, and closed, since aslaconf was removed by the FC team due to the possabiliy that the probe it runs may crash your machine…

So to get alsaconf back we need to 1st un-install the current version & it’s depandancies.

[root@localhost ~]# rpm -ev firstboot-1.3.33-1.noarch
[root@localhost ~]# rpm -ev system-config-soundcard-1.2.10-1.noarch
[root@localhost ~]# rpm -ev alsa-utils

Now we need to get a new version, you now have a choice.

  1. Install my RPM http://www.linickx.com/files/rpm/fedora/alsa-utils-1.0.6-3.i386.rpm
  2. Build your own ! :)

Installing my RPM
This is quite simple as root

[root@localhost ~]#rpm -ivh http://www.linickx.com/files/rpm/fedora/alsa-utils-1.0.6-3.i386.rpm

Building your own RPM
again.. not too complicated ;)

To start with you need the source rpm from redhat:

http://download.fedora.redhat.com/pub/fedora/linux/core/3/SRPMS/alsa-utils-1.0.6-3.src.rpm

Then install it into your build directory.. if you don’t know how.. have a quick read of this Rebuilding RPMS – Getting started guide

In alsa-utils.spec you need to remove the following lines:

%{__rm} -f $RPM_BUILD_ROOT/sbin/alsaconf \
$RPM_BUILD_ROOT%{_mandir}/man*/alsaconf*

then rebuild the rpm

$SHELL>rpmbuild -ba alsa-utils.spec

and install the rpm

[root@localhost ~]#rpm -ivh alsa-utils-1.0.6-3.i386.rpm

And FINALLY Configuring the Sound Card

to configure your sound card run /sbin/alsaconf , follow the onscreen instuctions and you’re sorted, further documentation on configuration is available at alsa-project.org

ahh, it’s all music to my ears !

Rebuilding RPMS – Getting Started Guide.

I’ve got a few posts in my wordpress drafts that are based around rebuilding RPMS, I figure that before I finish them it makes sense to wrte a Getting Started Guide.

The first thing is based around the “Unix Golden Rule”: Only use root when you have to.

To rebuild rpms you need a cirtain directory stucture, it is located in /usr/src/redhat, but since it is owned by root you’re gonna need on in your $HOME. The following does the job:

$SHELL>cd $HOME
$SHELL>cp -a /usr/src/redhat/ rpmbuild
$SHELL>echo ‘%_topdir %(echo $HOME)/rpmbuild’ >> .rpmmacros

Next: you need a Source RPM, these are usually found with any other RPM, except they end .src.rpm rather than .i386.rpm or similar. Start with something simple like wget; (Sometimes building rpms requires dependancies) now this import, install as your normal user NOT root.

$SHELL>rpm -ivh wget-1.9.1-17.src.rpm
1:wget ########################################### [100%]
$SHELL>

This will put all of the source in wget-1.9.1-17.src.rpm into your $HOME/rpmbuild directory, specifically you’lll find the actual sources in $HOME/rpmbuild/SOURCES and a SPEC file in $HOME/rpmbuild/SPEC. The Sources are all the files you need; so the source.tar.gz that you’d usually run the “holy trinity” (configure, make, make install ) against, and any patches. The SPEC file is what turns the sources & patches into the RPM, so if you want to change the RPM in anyway, like change the changelog (i.e. packaged by [NICK] ) you edit the spec file.

So to turn the src.rpm into an installable file you run.

$SHELL>cd $HOME/rpmbuild/SPECS
$SHELL>rpmbuild -ba wget.spec

and in $HOME/rpmbuild/arch/will be wget-1.9.1-17.arch.rpm (in my case arch is i386; oh and sometimes you get a debug rpm, which gives you some developemnt stuff you might need), and now you have an exact copy of the wget RPM built by Redhat but this one was built by your fair hands ;)

So to Install as root or using sudo

rpm -ivh wget-1.9.1-17.i386.rpm

& you’re done ! So now if you find a src.rpm but not one to install, now you can build your own.

Here are some useful References :

Better Living Through RPM, Part 1
Better Livig Though RPM, Part 2
How to Sign Custom RPM Pakages with GPG
How to create rpmbuild directory

Finally, a decent “Mail Notification” applet !

It was lunchtime, & I was broswing the web, I stumbled across a $HOME of gnome applications http://gnomefiles.org/ and there in the top 10 most popular applications something caught me eye… what was Mail Notify?

After a short broswe of the pojects home page, I was already searching for a RPM to install, and to my suprise those smashing people on the Fedora Extra’s team have already made one ! …

mail-notification-1.1-1.i386.rpm

I loaded it up & this is great ! a system tray application that can check multiple mail accounts (including gmail), and it don’t look half bad either !

Mail Notify Screen Shot

I’d definatley recommend it ! :D