summaryrefslogtreecommitdiffstats
path: root/perl-install/keyboard.pm
Commit message (Expand)AuthorAgeFilesLines
* looks like a pablo's typoGuillaume Cottenceau2003-07-021-2/+2
* added spaces to make perl_checker happyPablo Saratxaga2003-07-011-4/+4
* iAdded various new keyboard layoutsPablo Saratxaga2003-07-011-9/+19
* changed the name of the russian phonetic layoutPablo Saratxaga2003-05-311-1/+1
* Added new toggle possibilities to the menu; use "en_US" for US layoutPablo Saratxaga2003-05-241-1/+8
* Renamed Serbian po files to follow standard (sr -> cyrillic, sr@Latn -> latin).Pablo Saratxaga2003-05-061-2/+2
* perl_checker adaptations + fixesPascal Rigaux2003-04-241-5/+5
* 'Option "XkbCompat" "group_led"' is no good becausePascal Rigaux2003-04-211-1/+1
* Tagged cyrillic keyboard as non-latinPablo Saratxaga2003-03-121-1/+1
* Changed console Czech keyboardPablo Saratxaga2003-03-101-2/+2
* There is no arabic keyboard available for the consolePablo Saratxaga2003-02-261-1/+1
* translate grp_toggles at display-time, not compile-timePascal Rigaux2003-02-181-10/+10
* Enabled Arabic keyboard,Pablo Saratxaga2003-02-161-39/+43
* for GRP_TOGGLE'd keyboard layouts, have "us,XX" instead of simply "XX"Pascal Rigaux2003-02-111-1/+1
* language/country selection change:Guillaume Cottenceau2003-02-081-40/+12
* switched some languages to UTF-8 (they use ascii only, so it shouldn'tPablo Saratxaga2003-01-291-1/+1
* (read): fix return value when no configured keyboard is foundPascal Rigaux2003-01-231-1/+1
* small keyboard name changePablo Saratxaga2003-01-201-2/+2
* Added some more English locales; and changed all locale names using xxPablo Saratxaga2003-01-161-0/+4
* make return value name more explicitThierry Vignaud2003-01-091-3/+3
* simplifyThierry Vignaud2003-01-091-3/+3
* synchronized with XFree86 4.2.99 keyboard layout namesPablo Saratxaga2003-01-061-4/+4
* move any::keyboard_group_toggle_choose() to keyboard::group_toggle_choose()Pascal Rigaux2002-12-291-0/+17
* do not use "local *F"Pascal Rigaux2002-12-041-6/+5
* Added Malayalam keyboardPablo Saratxaga2002-11-191-1/+3
* add/remove spaces to make perl_checker happyPascal Rigaux2002-11-131-12/+12
* add or remove spaces where need to please perl_checkerPascal Rigaux2002-11-111-115/+115
* replace "_" with "N" and "__" with "N_"Pascal Rigaux2002-11-061-108/+108
* add XkbCompat "group_led" for all keyboards where a group layout switching is...Pascal Rigaux2002-11-041-2/+3
* Made Lithuanian numeric row keyboard bi-modePablo Saratxaga2002-09-231-1/+1
* most of the code of Xconfig::default::config_keyboard moved to keyboard::keyb...Pascal Rigaux2002-08-301-0/+17
* corrected DrakX internal keyboard name tr -> tr_qPablo Saratxaga2002-08-211-22/+1
* *** empty log message ***Pascal Rigaux2002-08-211-1/+1
* put back loadkeys_files which *is* used (by make_rescue_img)Pascal Rigaux2002-08-211-0/+33
* fix pablo... uh no, too hard. fix his typo instead ;pPascal Rigaux2002-08-201-1/+1
* merged keyboards with XFree86Pablo Saratxaga2002-08-201-3/+23
* - drop the loadkeys_files (it is unused)Pascal Rigaux2002-08-201-32/+4
* - fix reading previous keyboard config on upgrade (for displaying in summary)Pascal Rigaux2002-08-121-1/+2
* Added Tamils TSCII keyboardPablo Saratxaga2002-08-081-3/+4
* s/__END__/1;Thierry Vignaud2002-08-051-1/+1
* kill "wonderful perl"Thierry Vignaud2002-08-051-4/+1
* don't have "unsafe" in /etc/sysconfig/keyboardPascal Rigaux2002-08-011-0/+2
* - the old $o->{keyboard} is now $o->{keyboard}{KEYBOARD}Pascal Rigaux2002-08-011-51/+56
* make new perl_checker happyPascal Rigaux2002-07-311-1/+0
* make new perl_checker happy (and that's not easy!)Pascal Rigaux2002-07-311-3/+3
* use usb keyboard bCountryCode to choose the right keyboardPascal Rigaux2002-07-301-46/+15
* added xx_YY -> keyboard lines in addition of xx -> keyboard onesPablo Saratxaga2002-03-151-2/+25
* (unpack_keyboards): return undef on errorPascal Rigaux2002-03-151-1/+1
* corrected the locale->keyboard list buildingPablo Saratxaga2002-03-071-4/+4
* make keyboard selection choose first the 5 first chars of lang;Pablo Saratxaga2002-03-071-3/+4
xtdomains, 'libDrakX') { if ($o_plural) { $s2 = Locale::gettext::dngettext($_, $s, $o_plural, $o_nb); } else { $s2 = Locale::gettext::dgettext($_, $s); } # when utf8 pragma is in use, Locale::gettext() returns an utf8 string not tagged as such: c::set_tagged_utf8($s2) if !utf8::is_utf8($s2) && utf8::is_utf8($s); return $s2 if $s ne $s2 && $s2 ne $o_plural; } # didn't lookup anything or locale is "C": $s2; } sub remove_translate_context { my ($s) = @_; #- translation with context, kde-like $s =~ s/^_:.*\n//; $s; } sub translate { my $s = translate_real(@_); $::one_message_has_been_translated ||= join(':', (caller(1))[1,2]); #- see mygtk2.pm remove_translate_context($s); } sub from_utf8 { my ($s) = @_; Locale::gettext::iconv($s, "utf-8", undef); #- undef = locale charmap = nl_langinfo(CODESET) } sub to_utf8 { my ($s) = @_; my $str = Locale::gettext::iconv($s, undef, "utf-8"); #- undef = locale charmap = nl_langinfo(CODESET) c::set_tagged_utf8($str); $str; } #- This is needed because text printed by Gtk2 will always be encoded #- in UTF-8; #- we first check if LC_ALL is defined, because if it is, changing #- only LC_COLLATE will have no effect. sub set_l10n_sort() { my $collation_locale = $ENV{LC_ALL}; if (!$collation_locale) { $collation_locale = c::setlocale(c::LC_COLLATE()); $collation_locale =~ /UTF-8/ or c::setlocale(c::LC_COLLATE(), "$collation_locale.UTF-8"); } } sub setVirtual { my ($vt_number) = @_; my $vt = ''; sysopen(my $C, "/dev/console", 2) or die "failed to open /dev/console: $!"; ioctl($C, c::VT_GETSTATE(), $vt) && ioctl($C, c::VT_ACTIVATE(), $vt_number) && ioctl($C, c::VT_WAITACTIVE(), $vt_number) or die "setVirtual failed"; unpack "S", $vt; } sub nonblock { my ($F) = @_; fcntl($F, c::F_SETFL(), fcntl($F, c::F_GETFL(), 0) | c::O_NONBLOCK()) or die "can not fcntl F_SETFL: $!"; } #- return a size in sector #- ie MB(1) is 2048 sectors, which is 1MB sub MB { my ($nb_MB) = @_; $nb_MB * 2048; } sub removeXiBSuffix { local $_ = shift; /(\d+)\s*kB?$/i and return $1 * 1024; /(\d+)\s*MB?$/i and return $1 * 1024 * 1024; /(\d+)\s*GB?$/i and return $1 * 1024 * 1024 * 1024; /(\d+)\s*TB?$/i and return $1 * 1024 * 1024 * 1024 * 1024; $_; } sub formatXiB { my ($newnb, $o_newbase) = @_; my $newbase = $o_newbase || 1; my $sign = $newnb < 0 ? -1 : 1; $newnb = abs(int($newnb)); my ($nb, $base); my $decr = sub { ($nb, $base) = ($newnb, $newbase); $base >= 1024 ? ($newbase = $base / 1024) : ($newnb = $nb / 1024); }; my $suffix; foreach (N("B"), N("KB"), N("MB"), N("GB"), N("TB")) { $decr->(); if ($newnb < 1 && $newnb * $newbase < 1) { $suffix = $_; last; } } my $v = $nb * $base; my $s = $v < 10 && int(10 * $v - 10 * int($v)); int($v * $sign) . ($s ? "." . abs($s) : '') . ($suffix || N("TB")); } sub formatTime { my ($s, $m, $h) = gmtime($_[0]); if ($h) { sprintf "%02d:%02d", $h, $m; } elsif ($m > 1) { N("%d minutes", $m); } elsif ($m == 1) { N("1 minute"); } else { N("%d seconds", $s); } } sub expand_symlinks_with_absolute_symlinks_in_prefix { my ($prefix, $link) = @_; my ($first, @l) = split '/', $link; $first eq '' or die "expand_symlinks: $link is relative\n"; my ($f, $l); foreach (@l) { $f .= "/$_"; while ($l = readlink "$prefix$f") { $f = $l =~ m!^/! ? $l : MDK::Common::File::concat_symlink($f, "../$l"); } } "$prefix$f"; } sub expand_symlinks_but_simple { my ($f) = @_; my $link = readlink($f); my $f2 = expand_symlinks($f); if ($link && $link !~ m|/|) { # put back the last simple symlink $f2 =~ s|\Q$link\E$|basename($f)|e; } $f2; } sub sync { &MDK::Common::System::sync } BEGIN { undef *formatError } sub formatError { my ($err) = @_; ref($err) eq 'SCALAR' and $err = $$err; log::l("error: $err"); &MDK::Common::String::formatError($err); } sub group_by(&@) { my $f = shift; @_ or return; my $e = shift; my @l = my $last_l = [$e]; foreach (@_) { if ($f->($e, $_)) { push @$last_l, $_; } else { push @l, $last_l = [$_]; $e = $_; } } @l; } # Group the list by n. Returns a reference of lists of length n sub group_n_lm { my $n = shift; my @l; push @l, [ splice(@_, 0, $n) ] while @_; @l; } sub join_lines { my @l; my $s; foreach (@_) { if (/^\s/) { $s .= $_; } else { push @l, $s if $s; $s = $_; } } @l, if_($s, $s); } sub set_alternative { my ($command, $executable) = @_; #- check the existance of $executable as an alternative for $command #- (is this needed???) run_program::rooted_get_stdout($::prefix, 'update-alternatives', '--display', $command) =~ /^\Q$executable /m or return; #- this does not handle relative symlink, but neither does update-alternatives ;p symlinkf $executable, "$::prefix/etc/alternatives/$command"; } sub files_exist { and_(map { -f "$::prefix$_" } @_) } sub open_file { my ($file) = @_; my $F; open($F, $file) ? $F : do { log::l("Can not open $file: $!"); undef }; } sub secured_file { my ($f) = @_; c::is_secure_file($f) or die "can not ensure a safe $f"; $f; } sub chown_ { my ($b_recursive, $name, $group, @files) = @_; my ($uid, $gid) = (getpwnam($name) || $name, getgrnam($group) || $group); require POSIX; my $chown; $chown = sub { foreach (@_) { POSIX::lchown($uid, $gid, $_) or die "chown of file $_ failed: $!\n"; ! -l $_ && -d $_ && $b_recursive and &$chown(glob_($_)); } }; $chown->(@files); } sub set_permissions { my ($file, $perms, $o_owner, $o_group) = @_; # We only need to set the permissions during installation to be able to # print test pages. After installation udev does the business automatically. return 1 unless $::isInstall; if ($o_owner || $o_group) { $o_owner ||= (lstat($file))[4]; $o_group ||= (lstat($file))[5]; chown_(0, $o_owner, $o_group, $file); } chmod(oct($perms), $file) or die "chmod of file $file failed: $!\n"; } sub parse_release_file { my ($prefix, $f, $part) = @_; chomp(my $s = cat_("$prefix$f")); my $arch = $s =~ s/\s+for\s+(\S+)// && $1; log::l("find_root_parts found $part->{device}: $s for $arch" . ($f !~ m!/etc/! ? " in special release file $f" : '')); { release => $s, release_file => $f, part => $part, arch => $arch }; } sub release_file { my ($o_dir) = @_; my @names = ('mandrakelinux-release', 'mandrake-release', 'conectiva-release', 'release', 'redhat-release', 'fedora-release'); find { -r "$o_dir$_" } ( (map { "/root/drakx/$_.upgrading" } @names), (map { "/etc/$_" } @names), ); } sub mandrake_release_info() { parse_LDAP_namespace_structure(cat_('/etc/product.id')); } sub parse_LDAP_namespace_structure { my ($s) = @_; my %h = map { if_(/(.*?)=(.*)/, $1 => $2) } split(',', $s); \%h; } sub mandrake_release { my ($o_dir) = @_; my $f = release_file($o_dir); $f && chomp_(cat_("$o_dir$f")); } sub get_parent_uid() { cat_('/proc/' . getppid() . '/status') =~ /Uid:\s*(\d+)/ ? $1 : undef; } sub wrap_command_for_root { my ($name, @args) = @_; ([ 'consolehelper', $name ], @args); } sub require_root_capability() { return if $::testing || !$>; # we're already root my ($command, @args) = wrap_command_for_root($0, @ARGV); exec { $command->[0] } $command->[1], @args or die N("command %s missing", $command->[0]); # still not root ? die "you must be root to run this program" if $>; } sub check_for_xserver() { if (!defined $::xtest) { $::xtest = 0; eval { require xf86misc::main; $::xtest = xf86misc::main::Xtest($ENV{DISPLAY}); } if $ENV{DISPLAY}; } return $::xtest; } #- special unpack #- - returning an array refs for each element like "s10" #- - handling things like s10* at the end of the format sub unpack_with_refs { my ($format, $s) = @_; my $initial_format = $format; my @r; while ($format =~ s/\s*(\w(\d*))(\*?)\s*//) { my ($sub_format, $nb, $many) = ($1, $2, $3); $many && $format and internal_error("bad * in the middle of format in $initial_format"); my $done = $many && !length($s); while (!$done) { my @l = unpack("$sub_format a*", $s); $s = pop @l; push @r, $nb ? \@l : @l; $done = !$many || !length($s); } } @r; } #- used in userdrake and mdkonline sub md5file { require Digest::MD5; my @md5 = map { my $sum; if (open(my $FILE, $_)) { binmode($FILE); $sum = Digest::MD5->new->addfile($FILE)->hexdigest; close($FILE); } $sum; } @_; return wantarray() ? @md5 : $md5[0]; } sub load_modules_from_base { my ($base) = @_; $base =~ s|::|/|g; my $base_file = $base . ".pm"; require $base_file; my ($inc_path) = substr($INC{$base_file}, 0, -length($base_file)); my @files = map { substr($_, length($inc_path)) } glob_($inc_path . $base . '/*.pm'); require $_ foreach @files; #- return the matching modules list map { local $_ = $_; s|/|::|g; s|\.pm$||g; $_ } @files; } sub get_alternatives { my ($name) = @_; my $dir = '/var/lib/rpm/alternatives'; my ($state, $main_link, @l) = chomp_(cat_("$dir/$name")) or return; my @slaves; while (@l && $l[0] ne '') { my ($name, $link) = splice(@l, 0, 2); push @slaves, { name => $name, link => $link }; } shift @l; #- empty line my @alternatives; while (@l && $l[0] ne '') { my ($file, $weight, @slave_files) = splice(@l, 0, 2 + @slaves); push @alternatives, { file => $file, weight => $weight, slave_files => \@slave_files }; } { name => $name, link => $main_link, state => $state, slaves => \@slaves, alternatives => \@alternatives }; } sub symlinkf_update_alternatives { my ($name, $wanted_file) = @_; run_program::rooted($::prefix, 'update-alternatives', '--set', $name, $wanted_file); } sub update_gnomekderc_no_create { my ($file, $category, %subst_) = @_; if (-e $file) { update_gnomekderc($file, $category, %subst_); } } 1;