# keyboard config -*-perl-*-

$keyboard = "";
$keytablesloc = "/usr/lib/kbd/keytables";

sub configure_keyboard {
    local ( @maps );

    opendir(DIR, "$fsmount$keytablesloc");
    @maps = reverse sort grep(/\.map$/, readdir(DIR));
    closedir(DIR);

    if (@maps == 0) {
        &rhs_msgbox("Error",
<<EOM
>
No keytables found in $fsmount$keytablesloc !
>
Are you sure you have installed the base system?
> 
EOM
                     , 60);
        return 0;
    }

    if (! &rhs_menul("Keyboard Configuration",
<<EOM
>
Select a keymap.
>
EOM
		     , 50, scalar(@maps), @maps)) {
	return 0;
    }

    $keyboard = $dialog_result;

    return 1;
}

# This is used to select and load a keyboard mapping for
# the install procedure

sub finish_keyboard {

    open(FD, ">$fsmount/etc/sysconfig/keyboard");
    print FD "KEYTABLE=\"$keytablesloc/$keyboard\"\n";
    close FD;

    return 1;
}

####################
1;
