/usr/share/perl5/Debian/Defoma/User.pm is in defoma 0.11.12ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | package Debian::Defoma::User;
use strict;
use POSIX;
use Exporter;
use vars qw(@EXPORT @EXPORT_OK @ISA);
use Debian::Defoma::Font;
use Debian::Defoma::Common;
import Debian::Defoma::Common qw(&readfile &writefile);
@ISA = qw(Exporter);
@EXPORT = qw(&defoma_user_update_dotfile);
@EXPORT_OK = qw(&defoma_user_init &defoma_user_update_font);
my %SystemFontUpdateTime;
my $SystemUpdateTime;
my $SystemRoot = DEFOMA_TEST_DIR . "/var/lib/defoma";
sub defoma_user_init {
&Debian::Defoma::Configure::read_status_cache($SystemRoot);
&Debian::Defoma::Configure::get_status(\%SystemFontUpdateTime,
\$SystemUpdateTime);
&Debian::Defoma::Configure::clear_app_info();
}
sub defoma_user_update_font {
my %UserFontUpdateTime;
my $UserUpdateTime;
&Debian::Defoma::Configure::get_status(\%UserFontUpdateTime,
\$UserUpdateTime);
my @cs = ();
foreach my $c (keys(%SystemFontUpdateTime)) {
unless (defined($UserFontUpdateTime{$c}) &&
$UserFontUpdateTime{$c} >= $SystemFontUpdateTime{$c}) {
push(@cs, $c);
}
}
if (@cs) {
printm("Following font categories are updated in system: @cs");
printm("Updating ", USERLOGIN, "'s font caches...");
foreach my $c (@cs) {
printm(" Updating category $c..");
my $sfobj = new Debian::Defoma::FontCache($c, $SystemRoot);
$sfobj->read();
my $ufobj = defoma_font_get_object($c);
$ufobj->{updated} = 1;
foreach my $f (keys(%{$ufobj->{cache_list}})) {
if (! exists($sfobj->{cache_list}->{$f}) &&
! exists($ufobj->{ucache_list}->{$f})) {
defoma_font_unregister($c, $f);
}
}
foreach my $f (keys(%{$sfobj->{cache_list}})) {
if (! exists($ufobj->{ucache_list}->{$f})) {
my @hints = split(' ', $sfobj->{cache_list}->{$f});
$Debian::Defoma::Font::Userspace = 0;
defoma_font_reregister($c, $f, @hints);
}
}
}
} else {
printm("All font categories are configured up-to-date for ",
USERLOGIN, ".");
}
}
sub defoma_user_update_dotfile {
my $filename = shift;
my $begin = shift;
my $end = shift;
my @r = readfile(HOMEDIR . "/$filename");
my @w = ();
my $flag = 0;
foreach my $l (@r) {
if (defined($begin) && $begin ne '' && $begin eq $l) {
$flag = 1;
} elsif (defined($end) && $end ne '' && $end eq $l) {
$flag = 0;
} elsif ($flag == 0) {
push(@w, $l);
}
}
push(@w, $begin, @_, $end);
writefile(HOMEDIR . "/$filename", @w);
}
1;
|