# init script for tpb?

## black_rob

Hi, I've been playing with gentoo on my laptop (thinkpad x20) and love it, but I want to get the thinkpad button program (tpb) to start automatically, and can't figure out how.

I've tried writing an rc-script following the guide (http://www.gentoo.org/doc/en/rc-scripts.xml), but I couldn't get it to work, then I tried copying and changing the rc-script for gpm, and that didn't work.... basically I don't know what I'm doing, but I like trying to figure these things out, up to a point.  I've reached that point, so now I should ask.

Got any ideas?  I could post the gpm script I'm working with but it's all trashed.

A few things I don't understand:

     -- for the init script, do I have to start it after X? I assume so, because it doesn't seem to do anything if I call use it on a console.  But maybe there's a better way, like adding it to the xdm script?

     -- do I have to specify that I want to run it as a daemon?  from the command line (in X) that's the  only option I use , "tpb -d".

Thanks

----------

## ender wiggin

I just put a link to tpb in ~/.kde/Autostart.

```

cd ~/.kde/Autostart

ln -s /usr/bin/tpb .

```

This, of course, assumes that you are running KDE   :Wink: 

----------

## black_rob

Good idea, but I don't use KDE anymore.  Only have Gnome and fluxbox installed, and gnome is pretty much for the rare occasions when my girlfriend uses it.  I'm gonna try modifying an init script again in a day or so, but  it seems like there should be a better way.  I remember when I used to  use startx instead of gdm it looked for an xconfig file (forget what it's called, it's been so long), and started all the apps listed then the window manager.  I suppose I could stop using gdm, but i like it.  The pretty interface asking me to login makes me feel important.

----------

## stgreek

You can also just add it to you gnome session (eg out it as priority 50 and run tpb -d)

----------

## Chol

How do I grant normal users access to /dev/nvram ? Changing permissions of /dev/nvram only lasts until next reboot  :Crying or Very sad: 

----------

## krusty Ruffle

To get tpb to work for normal users I had to do a few things:

First- Enable nvram in the kernel

Then- modprobe nvram

And- add nvram to: /etc/modules.autoload.d/kernel-2.6

to get read access on /dev/nvram for normal users add:

```
 KERNEL="nvram" MODE="664" 
```

to: /etc/udev/rules.d/50-udev.rules

To make it start when I startx I added:

```
 tpb & enlightenment 
```

to: ~/.xinitrc

This has worked for me, I haven't figured out how to start it with a display manager yet, as I have only been using Gentoo for a few days and I haven't got araound to setting one up yet....

Hope this helps

----------

## Tsuna

thanks it worked for me, I used

```
KERNEL="nvram" GROUP="nvram"
```

and I created the group nvram and added myself in this group. I think it's the most efficiant way of solving the problem

----------

