67 lines
1.7 KiB
Perl
67 lines
1.7 KiB
Perl
use strict;
|
|
use warnings;
|
|
use 5.010;
|
|
|
|
use Getopt::Long;
|
|
|
|
my ( $customRoot, $webguiRoot );
|
|
|
|
GetOptions(
|
|
'customRoot=s' => \$customRoot,
|
|
'webguiRoot=s' => \$webguiRoot,
|
|
);
|
|
|
|
|
|
die 'No custom root, use --customRoot' unless $customRoot;
|
|
|
|
$webguiRoot ||= '/data/WebGUI';
|
|
|
|
for ( qw{ assets adminConsole } ) {
|
|
my $largeDest = "$webguiRoot/www/extras/$_";
|
|
my $smallDest = "$webguiRoot/www/extras/$_/small";
|
|
my $largeOrig = "$customRoot/www/extras/$_";
|
|
my $smallOrig = "$customRoot/www/extras/$_/small";
|
|
|
|
say "Proccesing $_ icons...";
|
|
|
|
die "Cannot find large icon directory $largeDest" unless -d $largeDest;
|
|
die "Cannot find small icon directory $smallDest" unless -d $smallDest;
|
|
|
|
my ( %large, %small );
|
|
opendir my $largeDir, "$largeOrig";
|
|
while ( my $file = readdir $largeDir ) {
|
|
next unless $file =~ m{ \.gif $ }xmsi;
|
|
|
|
say "\tFound large icon $file.";
|
|
|
|
$large{ $file } = 1;
|
|
};
|
|
closedir $largeDir;
|
|
|
|
opendir my $smallDir, "$smallOrig";
|
|
while ( my $file = readdir $smallDir ) {
|
|
next unless $file =~ m{ \.gif $ }xmsi;
|
|
|
|
say "\tFound small icon $file.";
|
|
|
|
$small{ $file } = 1;
|
|
};
|
|
closedir $smallDir;
|
|
|
|
foreach my $file ( keys %large ) {
|
|
if ( !exists $small{ $file } ) {
|
|
say "\tLarge icon $file has no small equivalent. Skipping.";
|
|
next;
|
|
}
|
|
|
|
print "\tInstalling large icon $file...";
|
|
symlink "$largeOrig/$file", "$largeDest/$file";
|
|
say -l "$largeDest/$file" ? "Ok" : "Failed";
|
|
|
|
print "\tInstalling small icon $file...";
|
|
symlink "$smallOrig/$file", "$smallDest/$file";
|
|
say -l "$smallDest/$file" ? "Ok" : "Failed";
|
|
}
|
|
}
|
|
|
|
say "Done.";
|