/usr/bin/icontool-map is in icontool 0.1.0-0ubuntu2.
This file is owned by root:root, with mode 0o755.
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 | #!/usr/bin/perl -w
# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#############################################################################
## Copyright (C) 2005-2007 Novell, Inc.
## Copyright (C) 2005-2009 Rodney Dawes
##
## Authors: Rodney Dawes <dobey@gnome.org>
##
## This program is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Public License version 2, as published
## by the Free Software Foundation.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranties of
## MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
## PURPOSE. See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along
## with this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use XML::Simple;
use Getopt::Long;
my $PROGRAM = "icontool-map";
my $condir;
my $LN_S = ($^O eq 'MSWin32' ? 'cp' : 'ln -s');
my $mapdir = $ENV{ICONTOOL_DATA_DIR} || "/usr/share/icontool";
############################################################################
my @default_getopt_config = ("permute", "pass_through", "bundling",
"no_auto_abbrev", "no_ignore_case");
Getopt::Long::Configure (@default_getopt_config);
GetOptions ("help|h" => \&usage,
"context|c=s" => \$condir);
############################################################################
sub tls_load_mapping {
my $filename = shift;
my $mapping = XML::Simple::XMLin ($filename,
keyattr => [ qw(dir) ],
forcearray => [ qw(context icon link) ]);
return $mapping;
}
sub tls_map_icons {
my $mapping = shift;
my $dirname = shift;
print "Setting up icon mapping for: $dirname\n";
chomp (my $cwd = `pwd`);
chdir $dirname;
foreach my $icon (@{$mapping->{context}->{$dirname}->{icon}}) {
if (-f "$icon->{name}.png") {
foreach my $legacy (@{$icon->{link}}) {
system ("$LN_S $icon->{name}.png $legacy.png")
if (! -e "$legacy.png");
}
} elsif (-f "$icon->{name}.svg") {
foreach my $legacy (@{$icon->{link}}) {
system ("$LN_S $icon->{name}.svg $legacy.svg")
if (! -e "$legacy.svg");
}
}
if (-f "$icon->{name}.icon") {
foreach my $legacy (@{$icon->{link}}) {
system ("$LN_S $icon->{name}.icon $legacy.icon")
if (! -e "$legacy.icon");
}
}
}
chdir $cwd;
}
sub usage {
print "Usage: $PROGRAM [OPTIONS] ...
-c, --context=<dirname> Set up mapping for Context <dirname>
This utility must be run from the <theme>/<size> directory, with a
context passsed in as the argument.
";
exit 1;
}
if (not defined $condir) {
usage ();
} else {
my $iconmap = tls_load_mapping ("$mapdir/legacy-icon-mapping.xml");
tls_map_icons ($iconmap, $condir);
}
|