#!/usr/bin/perl

use lib "..";
use keyboard;

my $dir = "keymaps/usr/share/keymaps";
system("rm -rf keymaps ; mkdir -p keymaps/usr/share/keymaps");

foreach (keyboard::keyboards()) {
    my $kmap = keyboard::keyboard2kmap($_);
    if (system("./kmap2bkmap $kmap > $dir/$kmap.bkmap 2>/dev/null") != 0) {
	warn "unknown kmap $kmap\n";
	unlink "$dir/$kmap.bkmap";
    }
}

system("tar cfj keymaps.tar.bz2 -C keymaps usr") == 0 or die;
system("rm -rf keymaps");