MadBlog
Sunday 21 August 2005

Debian and pam-LDAP

I use now extensively lib(pam|nss)-ldap and was really tired having to forge my .ldif to add users.

Since I don't need samba, smbldap-tools does not work (I don't use samba.schema whatever the name is)...

So I discovered ldapscripts, those worked, even if they don't provide a lot of functionnalities. At least, you can :

  • add/delete users
  • add/delete groups
  • add/remove users from groups
  • change the default group of your users

I've just written some bits of magic that make the ldapscripts discover its settings from libpam-ldap and adduser config files, so that the average user will see those script work out from the box after having configured libpam-ldap.

Now I'm a fully happy pam-ldap user.

And btw, I've submitted an ITP, and look at the magic :

  • Bug#324296 ACK : 6:33:21 -700
  • ldapscripts_1.2-2_amd64.changes is NEW : 08:02:04 -0700
  • ldapscripts_1.2-2_amd64.changes ACCEPTED : 13:48:32 -0700

w00t

Saturday 20 August 2005

Blog reorganization - Debian Planet

I've reworked my Categories in order to have a better Sorting of my posts. It appears that dotclear is so smart that it didn't broke my rss feeds.

Though, I've subscribe a different feed (every english posts instead of the old Debian category I had) to the Debian Planet, and planet may duplicate some old posts. I apologies in advance if it should happen.

Friday 19 August 2005

back from the deads, screenrc, zshrc

Well, my DSL provider killed my connection for 10 days, and then I had some vacation ...

Long time no see.

Though, I've played with my dotfiles recently, and I set up some really nice things, picked from the web.

Screen and zsh cooperation

The one I find the best is the tight collaboration between screen and zsh to have nice labelled windows in the screen status line.

You have to do this like that :

   # in your .zshrc, add the following code to you preexec :
   preexec () {
       if [[ "$TERM" == "screen" ]]; then
           local CMD=${1[(wr)^(*=*|sudo|-*)]}
           echo -ne "\ek$CMD\e\\"
       fi
   }
   # and this code in order to reset the title when zsh gets the hand back
   if [[ "$TERM" == "screen" ]]; then
       PROMPT="${PROMPT}%{^[kzsh^[\\%}"
   fi

Then, you can have in your .screenrc some dark margic like :

   bind s select zsh

which make Ctrl-A s find your first available shell (really nice).

Make Shift+PgUp/PgDown work in screen

well, this is complete dark magic, but it works :

   # tell screen that you term can scroll
   termcapinfo xterm ti@:te@
   # bind Shift+PgUp/PgDn
   bindkey -m "^[[5;2~" stuff ^b
   bindkey -m "^[[6;2~" stuff ^f

And another great setting is altscreen :

   # Support alternate screens so that, for example, when you
   # quit out of vi, the display is redrawn as it was before vi
   # redrew the full screen.
   altscreen on

Though, now, Shift-Tab doesn't work anymore in screen, and since in vimrc I have things like :

   " {{{ Tab Key magic ...
   vmap <tab> >gv
   vmap <bs> <gv
   function! CleverTab()
       if strpart( getline('.'), col('.')-2, 1 ) =~ '^\s*$'
           return "\<Tab>"
       else
           return "\<C-P>"
       endif
   endfunction
   inoremap <Tab> <C-R>=CleverTab()<CR>
   inoremap <S-Tab> <Tab>
   " }}}

it's quite important that Shift+Tab works ...

zsh does not eat non "\n" terminated lines

I don't like the option

   setopt no_prompt_cr

that tells zsh no to print a "\r" before each prompt : I have a rprompt, and if a command (e.g. echo -n "f*****g command") is performed just before a shell prompt display, then my rprompt is wrapped, it's ugly.

but printing a "\r" each time eats the line if no "\n" was present, which happens sometime, and makes you think the command you launched failed.

I found that jewel on the zsh-users MailList :

   precmd() {
       local escape colno lineno
       IFS='[;' read -s -d R escape\?$'\e[6n' lineno colno
       (( colno > 1 )) && echo ''
   }

Basically, it checks before writing the prompt if the current column position is 0, and if not, it prints an "\n". I guess it may exists some races if you have a background job, but for alldays use, it's perfect.