11.07.2015 Views

using the Package Builder - Community - LANDesk

using the Package Builder - Community - LANDesk

using the Package Builder - Community - LANDesk

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>LANDesk</strong> ® Management Suite 6.62Successful <strong>Package</strong> BuildingJune 4, 2003


Building Successful <strong>Package</strong>s - 2 - v1.0


Successful <strong>Package</strong> Building <strong>using</strong> <strong>LANDesk</strong>®Management SuiteABSTRACTSoftware <strong>Package</strong>s can be friends or foes. Follow <strong>the</strong> tips in this document tobuild successful Enhanced Software Distribution packages with <strong>the</strong> <strong>LANDesk</strong>®Management Suite <strong>Package</strong> <strong>Builder</strong>. <strong>Package</strong>s can consist of changes captured<strong>using</strong> <strong>the</strong> <strong>Package</strong> <strong>Builder</strong> Wizard, or carefully planned commands that arecreated as part of a configuration script. Using ei<strong>the</strong>r method, packages arecreated as a stand-alone monolithic executables. These executable files can belaunched independently on a workstation, or deployed to multiple workstations atone time <strong>using</strong> <strong>the</strong> <strong>LANDesk</strong> Desktop Manager console scheduling technology.Leveraging <strong>the</strong> power of <strong>the</strong> <strong>LANDesk</strong> Enhanced Software Distribution agentsinstalled on workstations, several layers of advanced functionality are exposed:• Application Healing - this function allows a package to be reinstalled or"healed" during a subsequent deployment. The healing function onlyreinstalls specific files that are missing or corrupt, not <strong>the</strong> entire contentsof a package.• Application Policy Management - a package can be scheduled as a policyto any workstation on a network, or to any NDS or ADS user. Complexqueries can be constructed that deploy <strong>the</strong>se policies to groups of users orgroups of target workstations.• Task Completion - this function enables management of <strong>the</strong> 'occasionallyconnected client' by checking for scheduled tasks that have failed in <strong>the</strong>past, or have not yet been run for a workstation. By default, this check ismade upon logon to <strong>the</strong> <strong>LANDesk</strong>® Management Suite domain.• Bandwidth Detection - use this feature to prevent flooding of slow WANlinks, or dial-up environments. For example, specifying WAN or LANbandwidth must be available for a package to be installed will prevent <strong>the</strong>package from being installed across a dial-up connection.Now, let's take a look at <strong>the</strong> <strong>Package</strong> <strong>Builder</strong> technology.PACKAGE BUILDER OVERVIEWThe <strong>Package</strong> <strong>Builder</strong> (herein referred to as PB) should be installed on a cleanOS installation. Having few applications installed will highly increase successwhen building a package.Building Successful <strong>Package</strong>s - 5 - v1.0


As a package contains files, registry keys, and o<strong>the</strong>r configuration items, it isimportant to build a package on <strong>the</strong> same platform to which it will be installed.For example, building a package on a Windows* XP operating system and <strong>the</strong>ninstalling that package to a Windows 98 operating system will probably fail.Library files, registry keys and directory structures are different on <strong>the</strong>seoperating systems and may cause improper installation or functionality of <strong>the</strong>resulting application installation.The package also includes engine files that manage <strong>the</strong> package installation on<strong>the</strong> target. The main installation engine is INST32.EXE.The PB Wizard uses snapshot technologyto take a ‘picture’ of <strong>the</strong> PB workstationbefore <strong>the</strong> installation of an application, andcompares that pre-installation snapshot to apost-installation snapshot to discover whatchanged on <strong>the</strong> workstation during <strong>the</strong>application installation. These changes are captured in a configuration (.CFG)file and <strong>the</strong>n, when <strong>the</strong> package is built, all files that are referenced in <strong>the</strong>configuration file are copied into <strong>the</strong> package, along with <strong>the</strong> configuration fileitself. The configuration file is <strong>the</strong>n used during package installation to list <strong>the</strong>changes that must be made to <strong>the</strong> target workstation.A package does not have to consist of an application, such as Microsoft Word,but can simply be a collection of files, several registry changes, printer driverupdates, or specific desktop configuration changes that must be delivered to adistributed group of workstations.The PB contains an extensive scripting language that can be manipulatedmanually. These commands can be inserted into a snapshot packageconfiguration file, after <strong>the</strong> PB wizard iscomplete, or by opening <strong>the</strong> PB itself,without <strong>the</strong> wizard, and creating a newpackage configuration script.When a package is built, <strong>the</strong> .CFG scriptfile, <strong>the</strong> installation engine and all filesidentified by <strong>the</strong> <strong>Package</strong> <strong>Builder</strong> Wizard are compressed and wrapped into onestand-alone .EXE file. This file can be executed locally on a machine as any.EXE file can, or it can be scheduled to multiple workstations <strong>using</strong> <strong>the</strong> Schedulerin <strong>LANDesk</strong>® Management Suite.PACKAGE BUILDER COMMANDS AND OPTIONSThe <strong>Package</strong> <strong>Builder</strong> commands are grouped into <strong>the</strong> following categories:Building Successful <strong>Package</strong>s - 6 - v1.0


• Base Installation• Appearance• Messages & Input• System Changes• IF Conditions• Defaults & CallsEach category has several functionscommands that can be chosen as parta package.orofBase installationTitleFirstScreenDirectoryFileWinItemLastScreenUnInstallVersionInfoThis command displays <strong>the</strong> title which appears in <strong>the</strong> top left corner of <strong>the</strong>screen during installation. The .CFG file can have two Title commands:one for <strong>the</strong> title and one for a subtitleThis command displays a personalized screen of text at <strong>the</strong> beginning of<strong>the</strong> installation process.The DefaultDir command is used to specify a default disk drive anddirectory for use during <strong>the</strong> installation.Use this command to tell <strong>the</strong> installation program which file(s) to copyfrom <strong>the</strong> installation diskette(s). Also use it to identify which directory <strong>the</strong>files should be copied to or copied fromThis command specifies a program group that adds <strong>the</strong> program to <strong>the</strong>Start | Programs menu in Windows.This command displays a personalized screen of text at <strong>the</strong> end of <strong>the</strong>installation process.This command specifies whe<strong>the</strong>r an uninstall program is to be created.This command defines <strong>the</strong> version information that will be associated withthis package and that can be viewed in Windows Explorer by right-clickingProperties.AppearanceAnimationIntroScreenIntroSoundScreenColorScreenGraphicThis command displays a series of bitmap files sequentially so that <strong>the</strong>yproduce an animation effect.This command displays a graphic (bipmap image) as <strong>the</strong> first step in <strong>the</strong>installation.This command plays a sound file (.WAV) as <strong>the</strong> first step in <strong>the</strong>installation.This command sets <strong>the</strong> background screen color.his command sets <strong>the</strong> background graphic to display during installation.Messages & inputsAskUse <strong>the</strong>se commands to generate a prompt to <strong>the</strong> user and assign <strong>the</strong>user's response to a variable.Building Successful <strong>Package</strong>s - 7 - v1.0


GroupInsertDiskPopMessagePromptsSetVariableShowReadmeThis set of commands allows you to provide <strong>the</strong> user with options (that is,a selection over which files are to be installed). This command set bothdefines <strong>the</strong> file groups and displays a message window giving <strong>the</strong> user aselection.This command is used only if you arrange you own diskettes. Do not usethis command if you use <strong>the</strong> Make Diskettes option in <strong>the</strong> Build menu tobuild <strong>the</strong> diskettes automatically.This command displays a test billboard during file copy.This command allows you to change <strong>the</strong> value of <strong>the</strong> default prompts.Click on any of <strong>the</strong> following prompts for a description of that prompt.This command creates a custom variable name and assigns a stringvalue to it.This command displays a text file at <strong>the</strong> conclusion of <strong>the</strong> installation.System changes·AddTextAutoexecBackupConfigCopyDeleteIniFileNTServiceRebootRegistryRegserverRenameShortcutWinGroupThis command modifies a text fileUse this command to specify changes to <strong>the</strong> user's AUTOEXEC.BAT file.This command creates a Backup subdirectory under <strong>the</strong> main installationdirectory ($DEFAULTDIR$), and makes a copy of any file that is to beoverwritten during installation. All overwritten files (in <strong>the</strong> same or differentdirectories) are copied into <strong>the</strong> Backup directory.Use this command to specify changes to <strong>the</strong> user's CONFIG.SYS file.This command copies a file (or files) from one location to ano<strong>the</strong>rThis command deletes a file or files from a user’s systemThis command is used to modify any type of .INI file on <strong>the</strong> end user’ssystem.This command stops or starts a Windows NT service on a Windows NT orWindows 2000 computer.This command restarts <strong>the</strong> end-user’s system after <strong>the</strong> installation.This command makes modifications to <strong>the</strong> file registry found in <strong>the</strong>Windows operating systems.This command registers a self-registering .OXC or .DLL file.This command renames a file on <strong>the</strong> end-user’s system or on <strong>the</strong>installation diskettes.This command creates a shortcut on <strong>the</strong> end-user’s systemThis command displays <strong>the</strong> current available Windows groups and allows<strong>the</strong> user to select from <strong>the</strong> list or create a new group by typing in a name.Building Successful <strong>Package</strong>s - 8 - v1.0


If conditionsIf $ASKn$If $SYSn$If $variable$If CPU()If DiskSpace()If FileVer()If FindModem()If CDROM()If GroupIf IsFile()If Locate()If MemoryIf SearchIfSearch(Registry)If SoundCard()If Video()If OSVer()ElseEndIfExitMessageThe $ASKn$ variable is assigned <strong>the</strong> value of whatever <strong>the</strong> user hastyped in response to an ASK command.The $SYSTEM$, $SYS2$, and $SYS3$ are assigned <strong>the</strong> values ofwhatever <strong>the</strong> user types on <strong>the</strong> command line when running <strong>the</strong>installation program.The SetVariable command assigns <strong>the</strong> value to $variable$This command detects <strong>the</strong> user's system and allows <strong>the</strong> installation toperform differently based on <strong>the</strong> type of CPU <strong>the</strong> user has.This command detects <strong>the</strong> available free space on <strong>the</strong> specified drive,and allows <strong>the</strong> installation to perform differently based on <strong>the</strong> availablespace.This command checks <strong>the</strong> timestamp or internal version number of aspecific file.This command checks for <strong>the</strong> existence of a modem on one of <strong>the</strong> serialports on <strong>the</strong> user's system.This command determines whe<strong>the</strong>r a CDROM drive is installed on <strong>the</strong>end-user’s systemhe Group command sets up groups that a user can select from.The If IsFile("[path]filename") command checks for <strong>the</strong> existence of a filewithin a specific directory on <strong>the</strong> user's system.The If Locate("filename", drive/dir) command searches <strong>the</strong> user’s systemfor a specific file. It will search all directories on some or all drives.This command checks <strong>the</strong> RAM of <strong>the</strong> computer.This command searches a text file for a specified text string.This command searches <strong>the</strong> registry for a specified key and name and<strong>the</strong>n stores <strong>the</strong> string value in specified variables.This command checks for <strong>the</strong> existence of a sound card on one of <strong>the</strong>serial ports on <strong>the</strong> user's system.This command allows you to create an IF condition based on three valuesof <strong>the</strong> computer’s video display capabilityThis command allows you to create an IF condition based on <strong>the</strong> enduser’s operating system.This command creates an “else” condition within an IF statementThis command is required to mark <strong>the</strong> end of an IF statement.This command enables you to terminate <strong>the</strong> installation based on <strong>the</strong>evaluation of an IF statement.Defaults & CallsBlankLineFontNameOverWriteFileProgressBarThis command adds a blank line to <strong>the</strong> script. It has no effect onexecution.This command is useful for international users because <strong>the</strong> default font(MS Sans Serif) does not display some international character sets suchas Chinese and Japanese.This command determines <strong>the</strong> default behavior for installing files thatalready exist on <strong>the</strong> user’s systemThis command is used only if you choose to manually build diskettes.Most people specify files to be installed, and let <strong>Package</strong> <strong>Builder</strong> collectfiles, compress <strong>the</strong>m, and build installation. In this case, you do not needBuilding Successful <strong>Package</strong>s - 9 - v1.0


RemRunAtStartRunAtMiddleRunAtExitthis command in your .CFG fileThis command adds a remark to <strong>the</strong> .CFG file.This command runs an executable before <strong>the</strong> installation starts.This command runs an executable during <strong>the</strong> installation.This command runs an executable at <strong>the</strong> end of <strong>the</strong> installation.SCRIPT ORDER OF EXECUTIONWhen <strong>the</strong> package is executed on <strong>the</strong> target workstation, <strong>the</strong> package script fileis not executed in a top-down manner as one may expect.<strong>Builder</strong> stores a version of <strong>the</strong> configuration file script (.cfg) inside <strong>the</strong> monolithicexecutable. This configuration script is used to determine what happens during<strong>the</strong> installation.The installation engine (INST32.EXE) does not execute all of <strong>the</strong> commands in<strong>the</strong> script in order. The purpose of this document is to explain why commandsare not executed in order, and <strong>the</strong> order of execution of commands.Reasons for Script ReorderingScript commands that produce user interface are at <strong>the</strong> heart of script reordering.Consider a script that installs a large number of files, and <strong>the</strong>n user interface thatallows <strong>the</strong> user to choose which set of remaining files should be installed. Thiscauses two problems. The lesser problem is that <strong>the</strong> user must watch <strong>the</strong> entireinstallation in order to complete all dialogs. The greater problem is that if <strong>the</strong>user selected <strong>the</strong> “Back” button, <strong>the</strong> large set of files must be uninstalled.The solution is to execute all user interface commands, and to execute “IF”statements that are based on <strong>the</strong> output of those interface commands beforeexecuting o<strong>the</strong>r commands like file and registry commands. If <strong>the</strong> “IF”statements return FALSE, <strong>the</strong> commands <strong>the</strong>y enclose will be marked such that<strong>the</strong>y will not be executed.Script Order DetailsThe installation engine makes multiple passes of <strong>the</strong> script; each time it attemptsto execute specific types of commands. The individual passes through <strong>the</strong> scriptare as follows:1. The following commands are processed:MINCPUTYPEANIMATIONPROMPTSBuilding Successful <strong>Package</strong>s - 10 - v1.0


FONTNAMESETRUNATSTART2. Static “IF” statements are executed. If <strong>the</strong> statement returns false, allcommands within <strong>the</strong> “IF” block (except those in <strong>the</strong> “ELSE” block) aremarked as non-executing. The static “IF” statements include:IF WINVER()IF DOSVER()IF ISFILE()IF MEMORY()IF CPU()IF VIDEO()IF SEARCH()IF SEARCH(Registry)IF SOUNDCARD()IF FINDMODEM()IF FILEVER()IF CDROM()3. Dynamic “IF” statements and user interface statements are executed, and<strong>the</strong> “IF” blocks marked for non-execution depending on <strong>the</strong> result of <strong>the</strong>“IF” execution. The dynamic “IF” statements include:IF GROUPIF $ASKN$IF DISKSPACE()IF LOCATE()IF $4. File commands are processed in <strong>the</strong> order <strong>the</strong>y occur in <strong>the</strong> script. O<strong>the</strong>rcommands, like registry commands, are still not executed at this timeregardless of <strong>the</strong> order in <strong>the</strong> configuration file. The file commands are<strong>the</strong>n flagged so <strong>the</strong>y will not be run again at a later stage. File commandsinclude:FILEINSERTDISKCOPYDELETERUNATMIDDLE5. All remaining commands, including registry, .ini file commands, andRUNATEXIT, are executed in <strong>the</strong> order <strong>the</strong>y occur in <strong>the</strong> script.Building Successful <strong>Package</strong>s - 11 - v1.0


This order of execution limits conditional blocks from performing any tests onchanges that occur during <strong>the</strong> installation of <strong>the</strong> package. They exist solely tocheck <strong>the</strong> state of <strong>the</strong> machine before any installation occurs.COMMON ISSUESRegistry SettingsIf changes have been made to <strong>the</strong> HKEY_CURRENT_USER registry key in apackage, <strong>the</strong> installer detects whe<strong>the</strong>r someone is logged in and applies changesto that user’s registry and that user’s “documents and settings” directories.Also, <strong>the</strong> <strong>Package</strong> <strong>Builder</strong> Wizard offers a “build options” button. This dialogallows <strong>the</strong> administrator to configure how registry changes made toKEY_CURRENT_USER and file changes made to <strong>the</strong> current user’s “documentsand settings” directory (like <strong>the</strong> desktop, program files shortcuts, etc.) will beinterpreted upon install. The changes, when applied to target machines, can beassociated with ei<strong>the</strong>r:1. Only <strong>the</strong> logged-in user2. All users profiles found in <strong>the</strong> registryDangerous Registry EntriesSometimes <strong>the</strong> <strong>Package</strong> <strong>Builder</strong> Wizard captures changes that can causecorruption of <strong>the</strong> system when deployed. These changes are typically registrysettings in <strong>the</strong> CurrentControlSet and Hardware subdirectories. Ra<strong>the</strong>r thanignore <strong>the</strong>se changes, we wrap <strong>the</strong> registry calls in an “IF” statement like this:IF $DANGEROUS$ = "TRUE"BEGINREGISTRYKEY:new,"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk"VALUE:reg_dword,replace,"type","1"ENDREGISTRYENDIFThe user <strong>the</strong>n has <strong>the</strong> choice of:1. Using <strong>the</strong> package without modification2. Defining <strong>the</strong> environment variable “$DANGEROUS$” equal to TRUE – thiswill allow <strong>the</strong> changes to be made on each machine with this variable set3. Editing <strong>the</strong> script to selectively delete “IF $DANGEROUS$” statementsBuild vs Rebuild All – Which Should I Choose?Adding files to a package is done in two main steps. In <strong>the</strong> first step, eachreferenced file is compressed into <strong>the</strong> working\temp directory to <strong>the</strong> namespecified in <strong>the</strong> .CFG script. The second step looks for files in <strong>the</strong> temp directoryBuilding Successful <strong>Package</strong>s - 12 - v1.0


and appends <strong>the</strong>m to <strong>the</strong> package.The “Build” command will only update files in <strong>the</strong> temp directory that were notpreviously <strong>the</strong>re.“Rebuild all” deletes all of <strong>the</strong> compressed files in <strong>the</strong> temp directory. Whenediting a monolithic exe, <strong>the</strong>re is no difference between build and rebuild all forany files that still have <strong>the</strong> “name=” parameter specified in <strong>the</strong> .CFG file because<strong>the</strong>y will be moved over directly from <strong>the</strong> previous instance of <strong>the</strong> package,unchanged.File replacement logicWhen rebuilding a monolithic .EXE, <strong>the</strong> builder will reuse all of <strong>the</strong> files put inside<strong>the</strong> original package that are still referenced in <strong>the</strong> .CFG script. In order to trigger<strong>the</strong> builder to grab existing files from your system instead of <strong>using</strong> <strong>the</strong> files in <strong>the</strong>previous instance of <strong>the</strong> package, you must update <strong>the</strong> .CFG line that refers to<strong>the</strong> file by manually removing <strong>the</strong> “name=” parameter. This will cause <strong>the</strong> builderto retrieve <strong>the</strong> file from your system each time. By default, <strong>the</strong> “name=”parameter is not included on <strong>the</strong> FILE: line of a script.Healing vs Reinstalling – Which is Best?Since version 6.5, when building a script to distribute a package, a “heal” or“repair” option is available. This feature is activated in a number of ways.o If a package is installed a second time and UI is disabled, <strong>the</strong>n <strong>the</strong>package automatically goes into heal mode.o If a package is installed a second time and <strong>the</strong> /Ah+ parameter isprovided, <strong>the</strong>n it goes into heal mode.o If a package is installed a second time and UI is enabled, <strong>the</strong> user will beprompted whe<strong>the</strong>r to heal <strong>the</strong> package or reinstall. If <strong>the</strong> user choosesheal, <strong>the</strong>n <strong>the</strong> package goes into heal mode.RunAtExitTo perform complex operations in a package, it may be desirable to nestfunctionality in a child package that is launched by <strong>the</strong> parent package. This canbe done by typing ei<strong>the</strong>r “~0000.exe” or “inst32.exe” followed by <strong>the</strong> desired childpackage name (which could be in <strong>the</strong> temp directory if flagged with <strong>the</strong> “temp”attribute in <strong>the</strong> parent’s CFG file). Path information is not important because <strong>the</strong>installer looks for ei<strong>the</strong>r of <strong>the</strong>se strings and automatically spawns ano<strong>the</strong>r copyof itself with <strong>the</strong> specified package name.The advantage of running child packages by <strong>using</strong> inst32 instead of typing <strong>the</strong>package name is that ano<strong>the</strong>r copy of inst32.exe, header32.exe, andenuinst32.dll need not be downloaded to <strong>the</strong> target computer (into <strong>the</strong> tempBuilding Successful <strong>Package</strong>s - 13 - v1.0


directory) before running <strong>the</strong> package. The disadvantage of <strong>using</strong> inst32 is that<strong>the</strong> child package’s temp.shr will NOT be processed.The installer attempts to block itself from being run multiple times simultaneously,but it only checks for this occurrence inside of header32 and aiclient. Runninginst32.exe directly from within a parent package will allow two packages to runsimultaneously.NOTE: Although this scenario will likely work quite well, it is not supported. Anyproblems you run into are yours to solve. As a result, we do not officially supportRunAtMiddle and RunAtStart commands that refer to o<strong>the</strong>r installer packages.Also, unless <strong>the</strong> child package has been flagged with <strong>the</strong> “temp” attribute, it willnot have been extracted from <strong>the</strong> parent package by <strong>the</strong> time <strong>the</strong> run commandis processed.Building Successful <strong>Package</strong>s - 14 - v1.0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!