Wiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007 (779887), страница 32
Текст из файла (страница 32)
The program’s name and versionare displayed while installing (or uninstalling) the software. The nameand version are also used to identify the program for reference by otherpackage file commands (see section 5.9.3).All SIS files must have a UID. In the example I used the one assignedto the application contained in the SIS file.Package optionsThere are two package options that can be specified in the packageheader: SHUTDOWNAPPS (SH) and NOCOMPRESS (NC). The optionscan be spelled out in full, or the two-letter abbreviation can be used.The SHUTDOWNAPPS option will cause all applications to be closed onthe smartphone before the installation starts.
NOCOMPRESS will cause thefiles to be put in the SIS file in an uncompressed format. Generally thisshould not be used.INSTALLING APPLICATIONS ON THE SMARTPHONE153The operation of these options may vary between phones, and they arenot normally used. Our example does not define any package options.Package typePackage type should be set to indicate what kind of component is beinginstalled. It is used for presenting this information to the user and applyingcertain characteristics or restrictions for installing or uninstalling.The default package type is SISAPP, which indicates a standardstand-alone application, and this default is likely what you will typicallyuse.Reference the SDK documentation for the complete list of packagetypes (they differ between Symbian OS pre-v9 and v9).Product targetThe line after the package header indicates the target platform for theinstallation.
Consider the product target line from the example above:[0x101F7961], 0, 0, 0, {"S60ProductID"}The first number is the platform’s UID, the last string is the name of theplatform. This string will work on all S60 platforms.Here are some platform UIDs, along with product names:S60 2nd EditionS60 3rd EditionUIQ v2.0UIQ v2.1UIQ 30x101F79600x101F79610x101F617B0x101F61CE0x101F6300S60ProductIDS60ProductIDUIQ20ProductIDUIQ21ProductIDUIQ30ProductIDSpecifying files to installTo specify the files that will be installed, enter lines of the followingformat:"source"-"destination"where source specifies the file to include in the SIS file, and destination indicates the name and location of the file when it is installed onthe smartphone.
For example, in the previous example, the line:"c:\Symbian\9.2\S60_3rd_FP1\epoc32\release\gcce\urel\SimpleEx.exe"-"!:\sys\bin\SimpleEx.exe"154SYMBIAN OS BUILD ENVIRONMENTcopies, into the SIS file, the file named simpleEx.exe from thec:\Symbian\9.2\S60 3rd FP1\epoc32\release\gcce\urel directory on the PC. Then, on installation, this file is copied to thesmartphone, to \sys\bin. In this example, the destination file hasthe same name as the source file, but you can, if necessary, change thedestination name.But what about the target drive – what is drive ‘!:’? When installing aSIS file, the user is prompted to select which drive to install the softwareon. The ‘!:’ just means to use the drive that is specified in responseto this prompt. So, if the user selects C, then SimpleEx.exe is placedin c:\sys\bin\.
You can hardcode the drive too. For example, if youspecify ‘c:’ instead of ‘!:’ as the target path, then the file is alwayscopied to C, irrespective of which drive the user selects. However, thisis not recommended because it means that the user will not be given achoice of drive to use.Relative paths can also be specified for the source file in these statements. Such paths are relative to the location from which you runmakesis. You can also use the makesis -d option to specify the directory you want relative file paths to be based on. For example, if you runthe command:makesis -d c:\Symbian\9.2\S60_3rd_FP1a file specified as ‘\epoc32\release\gcce\urel\simpleEx.exe’will be interpreted as being relative to the S60 SDK path specified in the-d option.
This can be useful if the software is built on different systemsand you do not want to hardcode SDK paths in the PKG file.5.9.3 Advanced PKG File OptionsFor most programs, the PKG file is simple, and similar to the minimumexample described above. But there are some more powerful features ofthe installation tool that can be taken advantage of. I will not go throughall of them here – see the SDK documentation for that – but I will go overa few useful and interesting ones.Text noticesYou can specify a text file to be displayed to the user during theinstallation process.
The file itself is not copied to the target. This is usefulfor displaying basic readme information or license agreements. To dothis, add the line below to the PKG file:"license.txt" - " ", FILETEXT, TEXTCONTINUEINSTALLING APPLICATIONS ON THE SMARTPHONE155FILETEXT indicates to display the file during install. TEXTCONTINUEwill provide a continue button that will dismiss the text file and continuethe installation.Instead of TEXTCONTINUE, you can specify one of the following:•TEXTSKIP displays a Yes/No option.
If Yes is selected, installation continues. If No is selected, the next statement is skipped, butinstallation continues normally afterwards.•TEXTEXIT displays a Yes/No option. If Yes is selected, installationcontinues. If No is selected, the installation stops and any files thathave already been installed are removed.•TEXTABORT displays a Yes/No option, but when No is selected, theinstallation just stops, without removing any installed files.Removing runtime-generated filesWhen you uninstall a program via its SIS file, the uninstaller will removeall the files that were copied to the phone by the installer as specified inthe file specification lines of the .PKG file.
But what if a file is generatedat runtime? Since the file is not copied to the target during the installation,it is not listed for removal when the program is uninstalled. However,the runtime files will be deleted on installation if you place them in theapplication’s private directory, which is in \private\<applicationSID> (described in section 5.3.2).
This is because the application’sprivate directory, along with its contents, is deleted upon uninstalling theapplication.In Symbian OS versions before v9, you could specify that you wantsuch files to be removed by using the FILENULL specification asfollows:""-"C\system\data\my_runtime_generated_file",FILENULLHowever, FILENULL has been deprecated in Symbian OS v9, althoughit continues to be supported to ease PKG file migrations from previousSymbian OS versions. In the case of Symbian OS v9, FILENULL is notneeded if you always store your data in the application’s secure directoryunder \private\<SID>.Note that runtime-created data files are only removed during a trueuninstallation, and not on update installations, where an old versionof the program is first removed, then replaced by a later version.
Theassumption is that you will want to keep your existing runtime-generatedfiles when installing a new version of your program.156SYMBIAN OS BUILD ENVIRONMENTEmbedding SIS filesYou can include another SIS file within your SIS file with the followingline:@"sis file name",{UID}For example, @"prog1.sis",{0x12341234} installs prog1.sis,with UID 0x12341234, at the point where this line is encountered.Note that, on uninstallation, this embedded SIS file will not be uninstalled until the system determines that no other currently installedcomponents use it (i.e., there is no other installed component that alsoincludes that SIS file in its PKG file.Running executables on install or uninstallDepending on how the device manufacturer has configured the phone’sinstallation policy, you can specify that an executable be run during aninstallation by adding FILERUN (FR) and RUNINSTALL (RI) keywordsat the end of the executable’s file specification line.
For example:"c:\Symbian\9.2\S60_3rd_FP1\epoc32\release\gcce\urel\myprogram.exe""!:\sys\bin\myprogram.exe",FR,RIwill install myprogram.exe and execute it during the installation.The RUNINSTALL keyword can be replaced by either of the followingalternatives:• RUNREMOVE (RR) causes execution to occur only during uninstallation.• RUNBOTH (RB) causes the executable to be run on both installationand uninstallation.Any of these three options may be further qualified by use of theRUNWAITEND (RW) keyword, which causes the installation to wait forthe executable to complete before continuing.
If not specified, theninstallation continues immediately after the executable is launched.Requisite linesYou can use a requisite line to specify that a particular component mustalready be installed in order for the current installation to continue. It hasthe following format:(UID), Major_Version_#,Minor_Version_#,Build_#,{"Product Name"}INSTALLING APPLICATIONS ON THE SMARTPHONE157This means that the component with the specified UID and ProductName, with a version number not earlier than the one specified, mustexist for the installation to continue.For example:(0x10000123),1,0,0,{"MyDll"}indicates that a component named MyDll, with UID 0x10000123 anda version number of at least 1.0.0, must exist already before installationcan proceed.The requisite line should look familiar – it is how the target platformline is implemented.