Fixed lots of issues with installing a low-caps version of fshell from SIS file.
* Fixed issue in CCommandFactory whereby some APIs like GetCommandInfoL could trigger allocations on the wrong heap or signals to the wrong thread. The symptoms were often seen as a crash in the which_00 thread when running ciftest.
* Lots of build fixes for when FSHELL_PROTECTED_UIDS isn't defined and when all capabilities aren't available.
* Added new platform.mmh macro FSHELL_OPEN_SIGNED.
* Open signing of fshell SIS files is now supported for production S60 handsets. Build fshell with the FSHELL_OPEN_SIGNED macro defined (and without defining FSHELL_CAP_ALL or FSHELL_PROTECTED_UIDS) in your platform.mmh and submit \epoc32\fshell\fshell.unsigned.sis to https://www.symbiansigned.com/app/page/public/openSignedOnline.do . The following commands are not available when using Open Signing due to Platform Security restrictions: fdb; kerninfo; chunkinfo; svrinfo; objinfo; sudo; fsck; localdrive; ramdefrag; readmem; reboot; setcritical; setpriority. Others such as chkdeps, e32header, ps, and fshell itself will run but in a restricted capacity (for example, fshell will no longer allow you to modify files in the \sys\bin directory).
* Removed commands objinfo, svrinfo, chunkinfo, readmem, fsck completely when memory access isn't present - previously they would still appear in the help but would give an error if you tried to run them.
#!perl
# fshu.pm
#
# Copyright (c) 2007 - 2010 Accenture. All rights reserved.
# This component and the accompanying materials are made available
# under the terms of the "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Accenture - Initial contribution
#
# Description:
# fshu.pm - A collection of common utility sub-routines used by other fshell scripts.
package fshu;
use strict;
use File::Path;
use File::Copy;
use File::Basename;
#
# Subs.
#
sub RelativePath {
my $path = TidyPath(shift);
my $relativeTo = TidyPath(shift);
die "Error: \"$relativeTo\" is not absolute\n" unless ($relativeTo =~ /^([a-zA-Z]:)?\\/);
$relativeTo =~ s/^([a-zA-Z]:)?\\//; # Remove drive letter and leading '\'.
$path =~ s/^([a-zA-Z]:)?\\//; # Remove leading '\' and drive letter if present.
foreach (split /\\/, $relativeTo) {
$path = "..\\$path";
}
return $path;
}
sub AbsolutePath {
my $path = TidyPath(shift);
my $absoluteTo = TidyPath(shift);
my @workingDir = ($path =~ /^\\/) ? () : split(/\\/, $absoluteTo);
my @path = split(/\\/, $path);
foreach my $pathBit (@path) {
next if ($pathBit eq '.');
if ($pathBit eq '..') {
pop @workingDir;
next;
}
push @workingDir, $pathBit;
}
return join('\\', @workingDir);
}
sub TidyPath {
my $path = shift;
$path =~ s/\//\\/g; # Change forward slashes to back slashes.
$path =~ s/\\\.\\/\\/g; # Change "\.\" into "\".
$path =~ s/\\$//; # Removing trailing slash.
if ($path =~ /^\\\\/) { # Test for UNC paths.
$path =~ s/\\\\/\\/g; # Change "\\" into "\".
$path =~ s/^\\/\\\\/; # Add back a "\\" at the start so that it remains a UNC path.
}
else {
$path =~ s/\\\\/\\/g; # Change "\\" into "\".
}
# Remove leading ".\" if doing so doesn't empty the string.
$path =~ s/^\.\\(.+)/$1/;
# Collapse ".."s in the middle of the path.
my $foundFirstDirName = 0;
my @path = split(/\\/, $path);
my @collapsedPath;
foreach my $pathBit (@path) {
if (not $foundFirstDirName) {
if ($pathBit ne '..') {
$foundFirstDirName = 1;
}
push (@collapsedPath, $pathBit);
}
else {
if ($pathBit eq '..') {
pop (@collapsedPath);
}
else {
push (@collapsedPath, $pathBit);
}
}
}
$path = join('\\', @collapsedPath);
if ($path =~ m|^\\epoc32|) {
# If it starts with \epoc32, chop the leading backslash and stick on $EPOCROOT
$path =~ s|^\\|$ENV{EPOCROOT}|;
}
return $path;
}
sub MakePath ($) {
my $dir = shift;
$dir =~ s/\//\\/g; # Convert all forward slashes to back slashes in path.
unless (-e $dir) {
if ($dir =~ /^\\\\/) {
# This is a UNC path - make path manually because UNC isn't supported by mkpath.
my $dirToMake = '';
my @dirs = split /\\/, $dir;
shift @dirs; # Get rid of undefined dir.
shift @dirs; # Get rid of undefined dir.
my $server = shift @dirs;
my $share = shift @dirs;
$dirToMake .= "\\\\$server\\$share";
unless (-e $dirToMake) {
die "Network share \"$dirToMake\" does not exist\n";
}
foreach my $thisDir (@dirs) {
$dirToMake .= "\\$thisDir";
unless (-e $dirToMake) {
mkdir($dirToMake,0) or die "Couldn't make directory $dirToMake: $!\n";
}
}
}
else {
mkpath($dir) or die "Couldn't make path \"$dir\": $!\n";
}
}
if ($dir =~ m|^\\epoc32|) {
# If it starts with \epoc32, chop the leading backslash and stick on $EPOCROOT
$dir =~ s|^\\|$ENV{EPOCROOT}|;
}
}
sub CopyFile {
my $from = TidyPath(shift);
my $to = TidyPath(shift);
my $verbose = shift;
MakePath(dirname($to));
print "Copying '$from' to '$to'...\n" if $verbose;
copy ($from, $to) or die "Error: Couldn't copy '$from' to '$to' - $!\n";
}
sub Version {
my $version = 'Unknown';
my $kChangeHistoryFileName = "../../documentation/change_history.pod";
open (HISTORY, $kChangeHistoryFileName) or die "Error: Couldn't open \"$kChangeHistoryFileName\" for reading: $!\n";
while (my $line = <HISTORY>) {
if ($line =~ /(Release \d+.*)/i) {
$version = $1;
last;
}
}
close (HISTORY);
return $version;
}
1;
__END__
=head1 NAME
fshu.pm - A collection of common utility sub-routines used by other fshell scripts.
=head1 COPYRIGHT
Copyright (c) 2007-2010 Accenture. All rights reserved.
=cut