equal
deleted
inserted
replaced
19 use File::Spec::Functions; |
19 use File::Spec::Functions; |
20 use Getopt::Long; |
20 use Getopt::Long; |
21 use Pod::Usage; |
21 use Pod::Usage; |
22 |
22 |
23 # Version of the script - just use the date |
23 # Version of the script - just use the date |
24 $main::VERSION = '02-August-2010'; |
24 $main::VERSION = '26-August-2010'; |
25 |
25 |
26 # New getopt::long provides this - but old version doesn't? |
26 # New getopt::long provides this - but old version doesn't? |
27 sub version |
27 sub version |
28 { |
28 { |
29 print sprintf("$0: $main::VERSION\n$^X: %vd\nos: $^O", $^V); |
29 print sprintf("$0: $main::VERSION\n$^X: %vd\nos: $^O", $^V); |
134 use constant KEY_ATTR_SEPERATOR => ':'; |
134 use constant KEY_ATTR_SEPERATOR => ':'; |
135 |
135 |
136 our $w3c_widget = 0 ; |
136 our $w3c_widget = 0 ; |
137 our $hashval; |
137 our $hashval; |
138 our $non_nokia_widget = 0; |
138 our $non_nokia_widget = 0; |
139 our ($isSharedLibrary, $sharedFolderName ,$isSharedWidget, $isSharedIcon)= (0,'',0,0); |
139 our ($isSharedLibrary, $sharedFolderName ,$isSharedWidget, $isSharedIcon, $isHiddenIcon)= (0,'',0,0,0); |
140 our (@staticUidWrtIntList,@staticUidCwrtIntList,@staticUidWrtExtList,@staticUidCwrtExtList) = ({},{},{},{}); |
140 our (@staticUidWrtIntList,@staticUidCwrtIntList,@staticUidWrtExtList,@staticUidCwrtExtList) = ({},{},{},{}); |
141 our $isSecureWidget = 0; |
141 our $isSecureWidget = 0; |
142 |
142 |
143 # Create a new object |
143 # Create a new object |
144 sub new |
144 sub new |
406 $isSharedLibrary = 0; |
406 $isSharedLibrary = 0; |
407 $isSharedWidget = 0; |
407 $isSharedWidget = 0; |
408 $isSharedIcon = 0; |
408 $isSharedIcon = 0; |
409 $sharedFolderName =''; |
409 $sharedFolderName =''; |
410 $isSecureWidget = 0; |
410 $isSecureWidget = 0; |
|
411 $isHiddenIcon = 0; |
411 |
412 |
412 print "Installing files for drive $drive\n" if $self->{'args'}->{'verbose'}; |
413 print "Installing files for drive $drive\n" if $self->{'args'}->{'verbose'}; |
413 |
414 |
414 # Unregister any existing widgets as otherwise when the registry is rewritten their icons will appear in the emulator but they won't work |
415 # Unregister any existing widgets as otherwise when the registry is rewritten their icons will appear in the emulator but they won't work |
415 $self->unregisterWidgets($drive); |
416 $self->unregisterWidgets($drive); |
440 |
441 |
441 $isSharedLibrary = 0; |
442 $isSharedLibrary = 0; |
442 $isSharedWidget = 0; |
443 $isSharedWidget = 0; |
443 $isSharedIcon = 0; |
444 $isSharedIcon = 0; |
444 $sharedFolderName =''; |
445 $sharedFolderName =''; |
|
446 $isHiddenIcon = 0; |
445 |
447 |
446 my ( $root, $extracted, $size ) = $self->getFiles($tempdir); |
448 my ( $root, $extracted, $size ) = $self->getFiles($tempdir); |
447 die "No files extracted from $filename" if !@$extracted; |
449 die "No files extracted from $filename" if !@$extracted; |
448 |
450 |
449 if ($self->{'operator'}{lc $filename}) |
451 if ($self->{'operator'}{lc $filename}) |
450 { |
452 { |
451 print "\nNON NOKIA WGT \n"; |
453 print "\nNON NOKIA WGT \n"; |
452 $non_nokia_widget = 1; |
454 $non_nokia_widget = 1; |
453 } |
455 } |
454 else |
456 else |
455 { |
457 { |
456 print "\nNOKIA WGT \n"; |
458 print "\nNOKIA WGT \n"; |
457 $non_nokia_widget = 0; |
459 $non_nokia_widget = 0; |
458 } |
460 } |
459 |
461 |
460 |
462 |
461 if (($filename =~ /.wgz/ )&& (my $plist = catfile($tempdir, $root, 'Info.plist'))) |
463 if (($filename =~ /.wgz/ )&& (my $plist = catfile($tempdir, $root, 'Info.plist'))) |
462 { |
464 { |
467 $widgetdata = parsePList($plist); |
469 $widgetdata = parsePList($plist); |
468 } |
470 } |
469 elsif (($filename =~ /.wgt/ ) && ( my $confxml = catfile($tempdir, $root, 'config.xml'))) |
471 elsif (($filename =~ /.wgt/ ) && ( my $confxml = catfile($tempdir, $root, 'config.xml'))) |
470 { |
472 { |
471 print ("W3C widget \n"); |
473 print ("W3C widget \n"); |
472 |
474 |
473 # Parse the XML file into a hash |
475 # Parse the XML file into a hash |
474 $widgetdata = parseConfXml($confxml,$self->{'args'}->{'l10n'}); |
476 $widgetdata = parseConfXml($confxml,$self->{'args'}->{'l10n'}); |
475 $w3c_widget = 1; |
477 $w3c_widget = 1; |
476 } |
478 } |
477 else |
479 else |
659 |
661 |
660 # Create the MBM file icon - in case of sharedlibrary, create only if NOKIA:widget is true |
662 # Create the MBM file icon - in case of sharedlibrary, create only if NOKIA:widget is true |
661 my $mbm; |
663 my $mbm; |
662 |
664 |
663 print("\nIs shared library - $isSharedLibrary \nIs sharedlib widget - $isSharedWidget \nIs Secure WGZ - $self->{'secure'}{lc $filename}\n"); |
665 print("\nIs shared library - $isSharedLibrary \nIs sharedlib widget - $isSharedWidget \nIs Secure WGZ - $self->{'secure'}{lc $filename}\n"); |
664 |
666 |
665 if( ((!$isSharedLibrary) || ($isSharedLibrary && $isSharedIcon)) && (!$self->{'secure'}{lc $filename})) |
667 if( ((!$isSharedLibrary) || ($isSharedLibrary && $isSharedWidget)) && (!$self->{'secure'}{lc $filename})) |
666 { |
668 { |
667 print "Creating mbm !!!\n"; |
669 print "Creating mbm !!!\n"; |
668 die "ERROR: Can't find PNG2MBM command in PATH." if !(my $cmd = findCmd('png2mbm.exe')); |
670 die "ERROR: Can't find PNG2MBM command in PATH." if !(my $cmd = findCmd('png2mbm.exe')); |
669 $mbm = $self->regFileName($drive, sprintf("[%08x].mbm", $widgetdata->{'Uid'})); |
671 $mbm = $self->regFileName($drive, sprintf("[%08x].mbm", $widgetdata->{'Uid'})); |
670 print "Generating: $mbm\n"; |
672 print "Generating: $mbm\n"; |
725 } |
727 } |
726 |
728 |
727 # Copy the MBM file into the widget install directory |
729 # Copy the MBM file into the widget install directory |
728 # because native installation does and uses it after |
730 # because native installation does and uses it after |
729 # installation to manage UID consistency. |
731 # installation to manage UID consistency. |
730 if( (!$isSharedLibrary) || ($isSharedLibrary && $isSharedIcon)) |
732 if( (!$isSharedLibrary) || ($isSharedLibrary && $isSharedWidget)) |
731 { |
733 { |
732 my $mbmName = sprintf("[%08x].mbm", $widgetdata->{'Uid'}); |
734 my $mbmName = sprintf("[%08x].mbm", $widgetdata->{'Uid'}); |
733 my $destFile; |
735 my $destFile; |
734 if($w3c_widget) |
736 if($w3c_widget) |
735 { |
737 { |
982 } |
984 } |
983 |
985 |
984 # Make INI file describing widget - this is passed to widgetregfiles.exe |
986 # Make INI file describing widget - this is passed to widgetregfiles.exe |
985 sub makeIni |
987 sub makeIni |
986 { |
988 { |
|
989 my $hidden = 0; |
|
990 if ($isSharedWidget && !$isSharedIcon) {$hidden = 1;} |
|
991 if ($isHiddenIcon) {$hidden = 1;} |
987 my ( $self, $data, $file ) = @_; |
992 my ( $self, $data, $file ) = @_; |
988 open INI, ">$file" or die "Failed to open $file for writing: $!"; |
993 open INI, ">$file" or die "Failed to open $file for writing: $!"; |
989 binmode INI, ":utf8" if $] >= 5.008; |
994 binmode INI, ":utf8" if $] >= 5.008; |
990 |
995 |
991 # Get directory where mbm should go |
996 # Get directory where mbm should go |
995 print INI sprintf("uid=%08x\n", $data->{'Uid'}); |
1000 print INI sprintf("uid=%08x\n", $data->{'Uid'}); |
996 print INI "app_file=$data->{'MainHTML'}\n"; |
1001 print INI "app_file=$data->{'MainHTML'}\n"; |
997 print INI "caption=$data->{'BundleDisplayName'}\n"; |
1002 print INI "caption=$data->{'BundleDisplayName'}\n"; |
998 print INI "drive_name=$data->{'DriveName'}\n"; |
1003 print INI "drive_name=$data->{'DriveName'}\n"; |
999 print INI "results_dir=$dir\n"; |
1004 print INI "results_dir=$dir\n"; |
|
1005 print INI "hidden=$hidden\n"; |
1000 |
1006 |
1001 if( $w3c_widget ) |
1007 if( $w3c_widget ) |
1002 { |
1008 { |
1003 print INI "app_type=200267DC\n"; |
1009 print INI "app_type=200267DC\n"; |
1004 print " WGT Widget:: app_type added to ini of widgetregfiles.exe \n" if $debug; |
1010 print " WGT Widget:: app_type added to ini of widgetregfiles.exe \n" if $debug; |
1530 { |
1536 { |
1531 $isSharedIcon = 1; |
1537 $isSharedIcon = 1; |
1532 } |
1538 } |
1533 $attributeMap = $attributeMap.WIDGET_NOKIA_SHAREDLIB_ICON.KEY_VALUE_SEPERATOR.$val.KEY_VALUE_PAIR_SEPERATOR; |
1539 $attributeMap = $attributeMap.WIDGET_NOKIA_SHAREDLIB_ICON.KEY_VALUE_SEPERATOR.$val.KEY_VALUE_PAIR_SEPERATOR; |
1534 } |
1540 } |
|
1541 elsif ($el eq "NOKIAEX:hideicon") |
|
1542 { |
|
1543 chomp($val); |
|
1544 if( lc($val) eq "true" ) |
|
1545 { |
|
1546 $isHiddenIcon = 1; |
|
1547 print "Found NOKIAEX:hideicon == true"; |
|
1548 } |
|
1549 } |
1535 $val = '' |
1550 $val = '' |
1536 } |
1551 } |
1537 |
1552 |
1538 } |
1553 } |
1539 |
1554 |
1591 # If the WRT registry already exists, remove apparc registry info for those widgets |
1606 # If the WRT registry already exists, remove apparc registry info for those widgets |
1592 # This should avoid problems with unregistered widget icons in the emulator? |
1607 # This should avoid problems with unregistered widget icons in the emulator? |
1593 if (-e $registry) |
1608 if (-e $registry) |
1594 { |
1609 { |
1595 print("\n UNREGISTERING WGZ WIDGETS \n"); |
1610 print("\n UNREGISTERING WGZ WIDGETS \n"); |
1596 |
1611 |
1597 my $ref = XMLin($registry, 'forcearray' => [ 'entry' ], 'keyattr' => { 'prop' => 'content' } ); |
1612 my $ref = XMLin($registry, 'forcearray' => [ 'entry' ], 'keyattr' => { 'prop' => 'content' } ); |
1598 foreach my $entry ( @{ $ref->{entry} } ) |
1613 foreach my $entry ( @{ $ref->{entry} } ) |
1599 { |
1614 { |
1600 my $uid = $entry->{prop}->{Uid}->{val}->{content}; |
1615 my $uid = $entry->{prop}->{Uid}->{val}->{content}; |
1601 |
1616 |
1618 # If the CWRT registry already exists, remove apparc registry info for those widgets |
1633 # If the CWRT registry already exists, remove apparc registry info for those widgets |
1619 # This should avoid problems with unregistered widget icons in the emulator? |
1634 # This should avoid problems with unregistered widget icons in the emulator? |
1620 if (-e $registry) |
1635 if (-e $registry) |
1621 { |
1636 { |
1622 print("\n UNREGISTERING WGT WIDGETS \n"); |
1637 print("\n UNREGISTERING WGT WIDGETS \n"); |
1623 |
1638 |
1624 my $ref = XMLin($registry, 'forcearray' => [ 'entry' ], 'keyattr' => { 'prop' => 'content' } ); |
1639 my $ref = XMLin($registry, 'forcearray' => [ 'entry' ], 'keyattr' => { 'prop' => 'content' } ); |
1625 foreach my $entry ( @{ $ref->{entry} } ) |
1640 foreach my $entry ( @{ $ref->{entry} } ) |
1626 { |
1641 { |
1627 my $uid = $entry->{prop}->{Uid}->{val}->{content}; |
1642 my $uid = $entry->{prop}->{Uid}->{val}->{content}; |
1628 |
1643 |
1649 $non_nokia_widget = 1; |
1664 $non_nokia_widget = 1; |
1650 } |
1665 } |
1651 #sharedFolderName TBD |
1666 #sharedFolderName TBD |
1652 my $dir = $self->installDir($drive, $id); |
1667 my $dir = $self->installDir($drive, $id); |
1653 rmtree $dir; |
1668 rmtree $dir; |
1654 |
1669 |
1655 $dir =~ s/widgets_21D_4C7/data/; |
1670 $dir =~ s/widgets_21D_4C7/data/; |
1656 rmtree $dir; |
1671 rmtree $dir; |
1657 } |
1672 } |
1658 } |
1673 } |
1659 #delete CWRT webapp DB if exists |
1674 #delete CWRT webapp DB if exists |
1660 my $cwrtdbPath = catfile($self->destLocation($drive), CWRT_WEBAPP_REGISTRY); |
1675 my $cwrtdbPath = catfile($self->destLocation($drive), CWRT_WEBAPP_REGISTRY); |