Automated wifi login

If you have the fortune to need to follow some silly “Login” button for some wifi, regularly, the following little script may help you avoid this idiotic (and useless) task.

This example uses the WIFIonICE, the free wifi on german ICE trains, simply as I have it twice a day, and got annoyed by the pointless Login button. A friend pointed me at just wget-ting the login page, so I made Network-Manager do this for me. Should work for anything similar that doesn’t need some elaborate webform filled out.


# (Some) docs at


case ${ACTION} in
        CONID=${CONNECTION_ID:-$(iwconfig $IFACE | grep ESSID | cut -d":" -f2 | sed 's/^[^"]*"\|"[^"]*$//g')}
        if [[ ${CONID} == WIFIonICE ]]; then
            /usr/bin/timeout -k 20 15 /usr/bin/wget -q -O - > /dev/null
        # We are not interested in this

This script needs to be put into /etc/NetworkManager/dispatcher.d and made executable, owned by the root user. It will run on every connection change, thats why the ACTION is checked. The case may be a bit much here, but it could be easily extended to do a lot more.

Yay, no more silly “Open this webpage and press login” crap.

New gnupg-agent in Debian

In case you just upgraded to the latest gnupg-agent and used gnupg-agent as your ssh-agent you may find that ssh refuses to work with a simple but not helpful

sign_and_send_pubkey: signing failed: agent refused operation

This seems to come from systemd starting the agent, no longer a script at the start of the X session. And so it ends up with either no or an unusable tty. A simple

gpg-connect-agent updatestartuptty /bye

updates that and voila, ssh agent functionality is back in.

Note: This assumes you have “enable-ssh-support” in your ~/.gnupg/gpg-agent.conf

Removing checksums

And as just announced on d-d-a, I’m trying to break all the tools dealing with the (Debian) archive. Or something like it. But its about time to get rid of MD5Sum checksums, and SHA1 can go with it directly.

As it is only in experimental for now, we can test and see what still breaks. I hope it won’t be too much, so we can get it over all the archive (minus the stable stuff, of course).

For some reason, what I like most in this change is the following python code that ended up in our InRelease file generation tool:

import apt_pkg
# Note: suite.checksums being an array with possible values of md5sum, sha1, sha256
hashfuncs = dict(zip([x.upper().replace('UM', 'um') for x in suite.checksums],
                      [getattr(apt_pkg, "%s" % (x)) for x in [x.replace("sum", "") + "sum" for x in suite.checksums]]))

Though I’m sure this can be done in much more readable ways, it’s doing what we need, but heck, took me a while to get it.

But probably the change to get rid of gzip will be much more challenging / hard to get through. Lets see, in the few minutes after my mail, I already got some notices about possible breakage here.

Fortunately those indices and the release file stuff are nicely seperated settings, so if it turns out we only take the checksums drop for now into the other suites, thats doable.

Squeeze fully archived

While writing this, the last bits of squeeze that haven’t been on yet are moved over there, that is security and the lts suite. As soon as that script done, some tiny archive magic will happen and over the next few dinstall runs, the rest of squeeze that still was there will no longer be on our regular mirror network anymore.

If you still use it, now is the time to upgrade.

Update: Forgot to mention, but yes, squeeze-backports(-sloppy) is also archived on

New ftpsync release

It took nearly a year, but today a new ftpsync version got released. Most of the work for this release was done by weasel, with one new feature submitted by waldi, my work was mostly style fixes and a bit of documentation. And of course the release now.

If you run a mirror, you will find the new version at the usual place, that is the project/ftpsync/ subdirectory. You may also want to subscribe to the debian mirrors mailinglist, as the mirror team will post more information about changes in ftpsync there.

tmux - tm

Wohoo, one more in that little series of mine, another update to tm.

This time it gained getopts style options - while retaining the “old” non-getopts style. It now can open more than one multisession to the same set of hosts, so you can connect multiple times to “host1 host2” at the same time. No matter if you open them using the “ms” subcommand or the pre-defined sessions from the .tmux.d directory.

I also took a bit and wrote some zsh completion for it. I’m pretty sure this can be done better and am happy for patches, but it does work for me, so for now I’m happy.

You can, as usual, grab tm from my misc git repository, the zsh completion is in my zsh config repository - also at Github.

Wheezy release

There was Lenny, there was Squeeze, now there is Wheezy.

Another major release of Debian where I had the pleasure to do the ftpmaster work for the release. Like the last times, Mark joined to help with the work. But 2 FTPMasters aren’t enough for one Wheezy, or so, so Ansgar had his first run aside from point releases.

With the whole load of work the release team did in the past to prepare this, combined with all the changes in dak we had since Squeeze, it turned out to be rather easy for us.

Again, a few moments and not a detailed log (times in CEST):

  • [10:45] Let’s prepare. Cronjobs go off on ftp-master and security, shared tmux session setup, including a live pipe into a file so other team members can follow using “less +F -R”, a titanpad page opened to share in writing the commands to process later.

  • [11:18] One last package update done manually. The latest and greatest of installation-guide, 20130503, really wants to join the rest in wheezy.

  • [12:00] While I did a database backup and started preparing the set of commands for later, Mark and Ansgar prepared our code to deal with the changes we are about to make.

  • [12:33] I start executing the commands (shell and sql), so somewhen after here we have Squeeze as oldstable (with all its extra suites also renamed), Wheezy as stable (taking its own suites with it, as well as gaining the -updates).

    And Jessie starts its life.

  • [12:45] Heissa, wouldn’t be fun if we wouldn’t have some bugs, so we just created a load of directories not needed or wanted. Not getting Jessies either. Ohwell.

  • [13:00] Jessie gets a copy of Wheezy to start with. Made the mistake to try that with our usual tool, control-suite. Err. Wrong. This is doing a set of checks on each package inserted. Would take ages. While one SQL to bypass the checks was a minute or so.

  • [13:xx] Got annoyed by our concept of consistency. Its great. Every tool takes suite names/codenames in a different way. Seperated with spaces, with commas, with codenames, with suitenames, we mix it in all possible combinations.

  • [14:00] Ansgar finished updating our security master host to cope with the changes for the release.

  • [14:39] Squeeze Release files got regenerated and signed again.

  • [14:54] Wheezy Release files got generated and signed.

  • [15:05] The cd build machine has a synced mirror tree, so they can start building our CD/DVD images

  • [16:25] A manual dinstall finished. And while it had some small problems (including nearly overwriting something inside the wheezy dists/ tree), it went pretty smoothly.

  • [21:00] After having kept the archive turned off for the whole day, we have 90 uploads with ~3Gb of uploads waiting. As it is now unlikely that we need larger archive changes, we turn (most of) our cronjobs back on, to get them processed.

Right now (that is, 21:08 CEST) I am mostly waiting for the CD build to finish. Current schedule seems to have that in some two and a half hours, after which we can push the mirrors and our press people announce it. Except if Murphy wants to show up, but lets hope that not.

Thanks go out to everyone involved in preparing this release, be it in the past by fixing bugs, uploading packages, doing whatever was needed, as well as doing the work today.

tmux - tm update

Just did a small update to my tm helper script.

There is now a new variable, TMSESSHOST. If that is set to false, the hostname of the current machine won’t be prepended to the generated session name. true is the default, as that was the behaviour in the past.

It now can attach to any session, not just the ones it created itself, thus nearly entirely removing my need of ever calling tmux directly.

And cosmetically - window names for sessions defined in the .tmux.d directory are no longer plain “Multisession”, but the session name as defined in the file.

If you are interested, you can get it over here from my git repository of misc stuff

tmux - tm

Just a small update for those that use my little tmux helper: You may want to fetch the latest version from my git repository. At least if you have to deal with a tmux version prior to 1.4 (like, on squeeze), though I really recommend to use a later one. 1.6 from backports or 1.7 (but thats not backported). Fix is small, just a better handling of the non-existing -V option to get the version information.

zsh config - and prompt

As most people that are using “that funny grey on black thing with the blinking white box” AKA a commandline, I do have a heavily configured shell. zsh in my case. Some while ago my old configuration for it started to annoy me and so I set out to redo it. With the basic requirement to be flexible and able to adjust to various zsh versions (back as far as Lenny).

I’ve set out and looked how others do it and took the (I hope) best bits and put them together in a way I like it. Maybe others want to pick from me, so here I describe a little, maybe someone is interested…

First - the config is completly inside .zsh. The only thing directly in my $HOME is a symlink from $HOME/.zshenv to $HOME/.zsh/zshenv.home. All in one place, nicer this way. The zshenv just sets ZDOTDIR, so zsh then uses the .zsh itself.

Next I am using “modules”. Well, actually everything is splitted out in small(er) files, so its way easier to maintain. And to overwrite stuff wherever I need to. So my .zshrc just loads those “module” files - and then goes and checks if it finds the same file inside a series of subdirectories. Those subdirectories are based on the hostname, the kernel name, the username, the domain name and the name of the distribution of the system. And a number of combinations of those.

That system allows me, for example, to have a set of aliases defined only on Debian systems (like those to do with apt-get & co). Or define some extra variables if I login to the host franck, domain Or whatever more. I’m also on the way of doing something similar for all my dotfiles.

While I was working at that I finally got fed up with the fact that my prompt, which is based on Phil!’s wasn’t doing what I wanted it on various of the hosts I access. Thankfully someone pointed me at a change to the grml zsh config: Frank Terbeck rewrote their prompt to make use of the zstyle system.

Now that got me going, I like the idea of having the whole prompt easily configurable and changeable. My prompt always has shown slight differences depending on where the shell runs, which meant I had to carefully craft PS1 for every such change, and when one changes something one had to check all the places to adjust them too.

No longer. I took Franks work and extended it for me. I wanted to still have a design matching my old prompt (minus colors, I changed color themes anyways), but with full flexibility the zstyle system can offer here.

Now I am at a point where

  • One zstyle call can change the information or order in my prompt.
  • The prompt automagically leaves out information when the terminal width gets under a limit,
  • I can have whatever extra information items in the prompt, even if the prompt never defined a default for it. Including running neccessary functions to update those extra items.
  • the prompt switches between color and black/white mode with one zstyle change,
  • the prompt draws lines differently, depending on the capabilities of the terminal.

As an example, on the ftp-master host my prompt, while otherwise being the same as everywhere else, contains one extra item - displaying the current status of the archive (dinstall).

If you want to try it, the setup file is available, but note that I don’t give any warranty. :) “Works for me”.

I load it in my Prompts module, while having the prompt setup file in my function path. The 4 commented lines, my testcase, are a nice example of a custom token, though a real life one, the setup for the ftp-master prompt with the one extra item can be found over here.

Comments? Bugfixes? Enhancements?

Update: Got asked for an example how to use my prompt to “fake” another. So here is what you need to do to use my prompt setup to imitate the prompt clint, as delivered with zsh:

autoload promptinit && promptinit
zstyle ':prompt:ganneff' vcs_info true
# Alternatively you can set whatever you like it to be.
zstyle ':prompt:ganneff' set_vcs_info_defaults true
zstyle ':prompt:ganneff' colors true

## no right prompt
zstyle ':prompt:ganneff:right:setup' use-rprompt false

## color of brackets depending on variable
zstyle ':prompt:ganneff:*:items:openbracket' pre '${${SSH_CLIENT+"${PR_YELLOW}"}:-"${PR_RED}"}'
zstyle ':prompt:ganneff:*:items:openbracket' post '${PR_NO_COLOR}'
zstyle ':prompt:ganneff:*:items:closebracket' pre '${${SSH_CLIENT+"${PR_YELLOW}"}:-"${PR_RED}"}'
zstyle ':prompt:ganneff:*:items:closebracket' post '${PR_NO_COLOR}'
zstyle ':prompt:ganneff:*:items:openanglebracket' pre '${${SSH_CLIENT+"${PR_YELLOW}"}:-"${PR_RED}"}'
zstyle ':prompt:ganneff:*:items:openanglebracket' post '${PR_NO_COLOR}'
zstyle ':prompt:ganneff:*:items:closeanglebracket' pre '${${SSH_CLIENT+"${PR_YELLOW}"}:-"${PR_RED}"}'
zstyle ':prompt:ganneff:*:items:closeanglebracket' post '${PR_NO_COLOR}'
## extra date format, and its color
zstyle ':prompt:ganneff:*:items:date' token '%D{ %a %y/%m/%d %R %Z}'
zstyle ':prompt:ganneff:*:items:date' pre '${PR_CYAN}'
## pts. %l instead of %y, also color again
zstyle ':prompt:ganneff:*:items:pts' token '%l'
zstyle ':prompt:ganneff:*:items:pts' pre '${PR_GREEN}'
zstyle ':prompt:ganneff:*:items:pts' post '${PR_NO_COLOR}'
## host ends with :
zstyle ':prompt:ganneff:*:items:host' token '%m:'
## and a different style for the rc level
zstyle ':prompt:ganneff:*:items:rc' token '%(?..[%?%1v] )'
zstyle ':prompt:ganneff:*:items:rc' pre ''
## change color for other parts that differ to my default
zstyle ':prompt:ganneff:*:items:user' pre '${PR_GREEN}'
zstyle ':prompt:ganneff:*:items:host' pre '${PR_GREEN}'
zstyle ':prompt:ganneff:*:items:at' pre '${PR_GREEN}'
zstyle ':prompt:ganneff:*:items:path' pre '${PR_GREEN}'
zstyle ':prompt:ganneff:*:items:history' pre ''
## Show the shell level in a different way
zstyle ':prompt:ganneff:*:items:shell-level' pre ''
zstyle ':prompt:ganneff:*:items:shell-level' token 'zsh%(2L./$SHLVL.) '
## And history is just a bold number. Lazy here, not using pre and post
zstyle ':prompt:ganneff:*:items:history' token '%B%h%b '
## And the last part in prompt, a # or % depending on privileges
## Using standard zsh tokens for bold
zstyle ':prompt:ganneff:*:items:privileges' pre '%B'
zstyle ':prompt:ganneff:*:items:privileges' post '%b'
## Now there are two parts not defined by default, so lets create them
## Both are simple existing variables, no need for extra precmd functions
## system info
zstyle ':prompt:ganneff:extra:ostype' pre '${PR_CYAN}'
zstyle ':prompt:ganneff:extra:ostype' post '${PR_NO_COLOR}'
zstyle ':prompt:ganneff:extra:ostype' token "${MACHTYPE}/${OSTYPE}/$(uname -r)"
## zsh version
zstyle ':prompt:ganneff:extra:zshvers' pre '${PR_CYAN}'
zstyle ':prompt:ganneff:extra:zshvers' post '${PR_NO_COLOR}'
zstyle ':prompt:ganneff:extra:zshvers' token "${ZSH_VERSION}"
zstyle ':prompt:ganneff:left:full:setup' items \
    openbracket date closebracket openbracket pts closebracket openbracket ostype closebracket \
    openbracket zshvers closebracket newline openanglebracket user at host \
    path closeanglebracket newline \
    shell-level space history rc space vcs privileges space
prompt ganneff

And if you now tell me “Uh, thats so much more than just saying /prompt clint/”, then you are right. But then: This way is flexible. As I wrote above, my prompt on the ftpmaster host is different. Actually, my prompt on all machines inside the domain “” differs, by having

    zstyle ':prompt:ganneff:*:items:host' pre '${PR_YELLOW}'

in the Prompts definition for And thats enough to show me im on a machine by a yellow hostname, instead of my default red.

On the ftpmaster host I have the additional few lines:

    # Want one more piece in my prompt here, dinstall status
    zstyle ':prompt:ganneff:left:full:setup' items \
        ulcorner line openparentheses user at host pts closeparentheses line history \
        line dinstall line shell-level line flexline openparentheses path closeparentheses line urcorner newline \
        llcorner line rc openparentheses time closeparentheses line vcs line change-root pipe space
    zstyle ':prompt:ganneff:extra:dinstall' pre '${PR_CYAN}'
    zstyle ':prompt:ganneff:extra:dinstall' post '${PR_NO_COLOR}'
    zstyle ':prompt:ganneff:extra:dinstall' token '$DINSTALL'
    zstyle ':prompt:ganneff:extra:dinstall' precmd jj_update_dinstall
    zmodload zsh/mapfile
    jj_update_dinstall () {

And woo, thats simple. I think.

(There ought to be a way to just easily add the item at a defined place in the items zstyle, but meh, too lazy to look).

← Newer Page 1 of 24