Changeset 1414


Ignore:
Timestamp:
02/23/12 20:44:04 (15 months ago)
Author:
bruno
Message:

r4400@localhost: bruno | 2012-02-21 13:15:45 +0100

  • Start adding keyboard capture support
Location:
devel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r1413 r1414  
    555555ospathcmd-keyfile rpm = /etc/sysconfig/keyboard 
    556556ospathcmd-keyfile slackware = /etc/rc.d/rc.keymap 
    557 ospathcmd-keyfile debian = /etc/rc.config,/etc/console/boottime.kmap.gz 
     557ospathcmd-keyfile debian = /etc/console/boottime.kmap.gz 
    558558ospathcmd-keyfile ubuntu = /etc/console-setup/boottime.kmap.gz,/etc/console-setup/cached.kmap.gz 
    559559ospathcmd-keyfile arch = /etc/rc.conf 
     
    563563# ??? 
    564564ospathcmd-keymapdir slackware = /usr/share/kbd/keymaps 
     565# Regular expression to find the locale in the keymap file 
     566ospathcmd-keymapre rpm = s/^KEYTABLE="([[:alpha:]]+)"/$1/ 
     567ospathcmd-keymapre arch = s/^KEYMAP="([[:alpha:]]+)"/$1/ 
     568ospathcmd-keymapre gentoo = s/^KEYMAP="([[:alpha:]]+)"/$1/ 
     569ospathcmd-keymapre slack = s/\w\s([[:alpha:]]+.map)/$1/ 
    565570 
    566571# Some path for commands may defer from one system to another 
  • devel/pbmkbm/bin/pbmkbm

    r1413 r1414  
    1616use File::Basename; 
    1717use File::Copy; 
     18use File::Find; 
    1819use POSIX qw(strftime); 
    1920 
     
    254255pb_env_init_pbrc(); # to get content of HOME/.pbrc 
    255256 
     257# Global hash containing all the configuration information 
     258my %mkbm; 
     259 
    256260# 
    257261# Check target dir 
    258262# Create if not existent and use default if none given 
    259263# 
    260 my $targetdir = shift @ARGV; 
     264$mkbm{'targetdir'} = shift @ARGV; 
    261265 
    262266# 
     
    272276# Where is our build target directory 
    273277# 
    274 if (not defined $targetdir) { 
    275     $targetdir = "/var/cache/pbmkbm"; 
     278if (not defined $mkbm{'targetdir'}) { 
     279    $mkbm{'targetdir'} = "/var/cache/pbmkbm"; 
    276280    my ($vestdpath) = pb_conf_get("mkbmpath"); 
    277     $targetdir = "$vestdpath->{'default'}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}" if (defined $vestdpath->{'default'}); 
    278     pb_log(1,"No target-dir specified, using $targetdir\n"); 
     281    $mkbm{'targetdir'} = "$vestdpath->{'default'}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}" if (defined $vestdpath->{'default'}); 
     282    pb_log(1,"No target-dir specified, using $mkbm{'targetdir'}\n"); 
    279283} 
    280284 
    281285# Point to the right subdir and create it if needed 
    282 pb_mkdir_p($targetdir) if (! -d $targetdir); 
     286pb_mkdir_p($mkbm{'targetdir'}) if (! -d $mkbm{'targetdir'}); 
    283287 
    284288# Log information on our system 
     
    426430# Once the environment is made, add what is needed for this boot media to it. 
    427431# Keyboard 
     432pb_mkbm_find_keyboard(\%targettree); 
    428433# Terminfo 
    429434# List of commands 
     
    476481    } 
    477482} 
    478 pb_log(2,"Target Tree is now: ".Dumper($tgtree)."\n"); 
     483pb_log(1,"Target Tree is now: ".Dumper($tgtree)."\n"); 
    479484close(BUSY); 
    480485pb_log(1,"End of busybox analysis\n"); 
     
    483488sub pb_mkbm_find_keyboard { 
    484489 
     490my $tgtree = shift; 
     491 
    485492pb_log(1,"Analyzing your keyboard's configuration\n"); 
    486493my $keyfile = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-keyfile")); 
    487 die "Unable to read the keyfile $keyfile" if (! -r $keyfile); 
     494die "Unable to read the keyfile $keyfile" if ((not defined $keyfile) || (! -r $keyfile)); 
    488495my $keymapdir = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-keymapdir")); 
    489 die "Unable to read the keymapdir $keymapdir" if (! -d $keymapdir); 
     496die "Unable to read the keymapdir $keymapdir" if (not defined $keymapdir) || (! -d $keymapdir)); 
     497my $keymapre = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-keymapre")); 
     498die "Unable to read the keymapre $keymapre" if (not defined $keymapre); 
     499 
     500# if a direct keymap file is given as keyfile, use only the first existing one it and return 
     501my $foundkmap = 0; 
     502foreach my $f (split(/,/,$keyfile)) { 
     503    next if ($f !~ /\.gz$/); 
     504    $foundkmap = 1; 
     505    if (-l $f) { 
     506        $tgtree->{$f} = "link:$f"; 
     507        pb_log(1,"Using Keymap file $f\n"); 
     508        last; 
     509    } elsif (-r $f) { 
     510        $tgtree->{$f} = "file"; 
     511        pb_log(1,"Using Keymap file $f\n"); 
     512        last; 
     513    } else { 
     514        next; 
     515    } 
     516} 
     517return() if ($foundkmap eq 1); 
     518 
     519pb_log(1,"Using Keyfile $keyfile and Keymap directory $keymapdir\n"); 
     520my $locale=""; 
     521open(KEYMAP,"$keyfile") || die "Unable to read $keyfile"; 
     522# Depending on the format of the keymap we look for various strings 
     523while (<KEYMAP>) { 
     524    $locale =~ $keymapre; 
     525} 
     526close(KEYMAP); 
     527pb_log(1,"Found locale $locale\n"); 
    490528 
    491529pb_log(1,"End of keyboard analysis\n"); 
Note: See TracChangeset for help on using the changeset viewer.