Hey David,
I appreciate your post about how to deal with ProE. Based off that idea, I was
able to improve your method a little bit. You had wpkg simply wait 30 mins
before moving on, a brute force type of method, but effective nonetheless.
Since I need to support 3 concurrent installs of ProE (Wildfires 2, 3 and 4) I
couldn't wait for 1 and 1/2 hours total. I isolated the actual ProE installer
("ptc[###]_tmp.exe" where [###] is some random Hexadecimal character) and
decided to write a python script loop which checks for the existence of that
service before quitting. Also, to allow the same script to be used for each
ProE installation, I setup the script to take in 3 arguments as the network
drive, path to setup.exe and path to trail file. Also, cmd doesn't support UNC
paths, so we used the commands "net use" to mount and unmount the drives before
and after installation. Python is installed across the network VIA a network
share, the same way you would do for logon scripts. I'll include the WPKG
install commands and then attach the python script. I plan on posting this
information up to the silent installers list, so others can now hate PTC less
:). Thanks again Dave.
WPKG entries:
<package
id="proengineer2"
name="Pro/ENGINEER Wildfire 2.0"
revision="2.0"
reboot="false"
priority="4">
<check type="uninstall" condition="exists" path="Pro/ENGINEER Release
Wildfire 2.0 Datecode M280" />
<install cmd='%WPKGROOT%\tools\Python26\python.exe
%Software%\ProE\proe-installer.py y
"software\wpkg\Software\ProE\WildFire2\Disk1of3\setup.exe -uitrail"
software\wpkg\Software\ProE\WildFire2\Disk1of3\WF2TrailFile.txt' />
</package>
<package
id="proengineer3"
name="Pro/ENGINEER Wildfire 3.0"
revision="3.0"
reboot="false"
priority="3">
<check type="uninstall" condition="exists" path="Pro/ENGINEER Release
Wildfire 3.0 Datecode M170" />
<install cmd='%WPKGROOT%\tools\Python26\python.exe
%Software%\ProE\proe-installer.py y
"software\wpkg\Software\ProE\WildFire3\Disk1of3\setup.exe -uitrail"
software\wpkg\Software\ProE\WildFire3\Disk1of3\WF3TrailFile.txt' />
</package>
<package
id="proengineer4"
name="Pro/ENGINEER Wildfire 4.0"
revision="4.0"
reboot="false"
priority="2">
<check type="uninstall" condition="exists" path="Pro/ENGINEER Release
Wildfire 4.0 Datecode M040" />
<install cmd='%WPKGROOT%\tools\Python26\python.exe
%Software%\ProE\proe-installer.py y
"software\wpkg\Software\ProE\WildFire4\Disk1of5\setup.exe -uitrail"
software\wpkg\Software\ProE\WildFire4\Disk1of5\WF4TrailFile.txt' />
</package>
Brian Reese
IT Desktop Support
Boston Engineering
411 Waverly Oaks Rd. Suite 114
Waltham, MA, 02452
Phone: (781) 314-0753
www.Boston-Engineering.com
#!c:/Python26/python.exe -u
#######################################################################
# $Id: defaultTemplate.py,v 1.1.1.1 2005/07/22 13:35:49 slothrop Exp $
#######################################################################
#
# File: proe-installer.py
# Description: This script is used to install Pro/E from inside WPKG.
# The initial process used to install Pro/E, setup.exe,
# sponses a secondary process and exits. The exit of setup.exe
# cuases WPKG to think the install is over and the next package
# is installed. This script starts setup.exe and monitors the
# active process list for the secondary Pro/E install process.
# Once the secondary Pro/E install process has completed this
# script will exit. The script has a timeout to prevent
# an infinate loop.
#
# Return Values:
# 0 = Success
#
# Changelog:
# * 2008/12/12 breese <[email protected]>
# - Intial script
#######################################################################
import pywintypes
import win32com.client
from win32com.client import GetObject
import sys
import re
import time
import os
#************************************************#
# Local Vars
#************************************************#
SLEEP_TIME=20 # Time to sleep on each loop.
PROCESS_REGEX="^ptc.*_tmp\.exe$" # regex string to match Pro/E install process
MAX_LOOPS=50 # Maxium number of wait loops
REMOTE_DATA_PATH="\\\\samba2\\data"# Remote drive share that contains install
data
#************************************************#
# Inputs
#************************************************#
TRAIL_PATH=""
INSTALL_CMD=""
MOUNT_DRIVE=""
if len(sys.argv) >= 4:
MOUNT_DRIVE=sys.argv[1]
INSTALL_CMD=sys.argv[2]
TRAIL_PATH=sys.argv[3]
#************************************************#
# Local Functions
#************************************************#
def foundProcess(processes, processNamePattern):
"""
Search for a process name pattern in set of processes.
@type processes: Win32_Process
@param processes: A group of system processes
@type processNamePattern: string
@param processNamePattern: A regex pattern
"""
regex = re.compile(processNamePattern)
for process in processes:
processName = process.Properties_('Name').Value
if regex.match(processName) is not None:
print "Found process %s." % (processName)
return True
return False
def mountDrive(drive, systemToMount):
"""
Mount the given drive. ***WINDOWS ONLY***
@type drive: string
@param drive: The drive to mount
@type systemToMount: string
@param systemToMount: The system to mount
"""
unmountDrive(drive)
os.system("c:\\windows\\system32\\net.exe use %s: %s" % (drive,
systemToMount))
def unmountDrive(drive):
"""
Unmount the given drive. ***WINDOWS ONLY***
@type drive: string
@param drive: The drive to unmount
"""
os.system("c:\\windows\\system32\\net.exe use %s: /DELETE /YES" % (drive))
#************************************************#
#Main script start
#************************************************#
print "Preping system for install..."
mountDrive(MOUNT_DRIVE, REMOTE_DATA_PATH)
print "Installing Pro/E..."
print "%s:\%s %s:\%s" % (MOUNT_DRIVE, INSTALL_CMD, MOUNT_DRIVE, TRAIL_PATH)
os.system("%s:\%s %s:\%s" % (MOUNT_DRIVE, INSTALL_CMD, MOUNT_DRIVE, TRAIL_PATH))
# Setup windows system objects
wmi = GetObject('winmgmts:')
# Wait for Pro/E to complete install before exiting. This loop will
# sleep for SLEEP_TIME if the Pro/E install process is found. The loop will
# exit once the process is complete or if MAC_LOOP is reached.
loopCounter=1
while loopCounter < MAX_LOOPS:
print "Loop %s of %s. Waiting %s secs..." % (loopCounter, MAX_LOOPS,
SLEEP_TIME)
time.sleep(SLEEP_TIME)
processes = wmi.InstancesOf('Win32_Process')
if not foundProcess(processes, PROCESS_REGEX):
print "Install complete. Cleaning up system..."
unmountDrive(MOUNT_DRIVE)
sys.exit(0)
loopCounter = loopCounter + 1
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/wpkg-users