#74703 - 2003-04-23 06:13 PM
Re-Write of the KIX32.EXE Deployment tool
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Doing a re-write of the KiX421Update.exe from MCA (again).
This is using the IExpress packager..
Done some distallation and consolidation of the code.. Also, trimmed down some of the long lines and removed uneeded parenthesis, spaces, etc.
However, when I run the update it generates the following in the Event Log as is directed by the script: quote:
Event Type: None Event Source: Kixtart UPDATE 4.21 Release Candidate 2c Event Category: None Event ID: 1 Date: 4/23/2003 Time: 8:31:25 AM User: N/A Computer: MACHINEID Description: The description for Event ID ( 1 ) in Source ( Kixtart UPDATE 4.21 Release Candidate 2c ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Kixtart-UPDATE 3.08 script completed successfully (08:31:25 - 08:31:25) (+kix421.ok +kix32.exe) to "c:\scripts\".
Now, if we look through this, we see that the code properly deploys KIX32.EXE and creates the Marker files .OK to the C:\ and to C:\Scripts to my NT-Classed system. Does this mean we can just simply ignore this?
Here is the modified INSTALL.KIX code:
code:
$prgrm_version='2.00' $sysdrv=SUBSTR('%WINDIR%',1,3) $destdir=$sysdrv+'Scripts' $message=Substr(@kix,1,1)+Substr(@kix,3,2) IF 0=EXIST($destdir) MD $destdir ELSE $destdir=$destdir+'\' ENDIF IF len($destdir)=0 $destdir=@lanroot+'\' ENDIF
$pgmvrs='3.08' $tmp=ExpandEnvironmentVars('%tmp%'+'\')
$timest=@time $srcdir=@curdir+'\'
;$consolemode='no' ; - kix32.exe - IF @inwin=1 $max=1 ELSE $max=4 ENDIF DIM $kixfl[$max+1] $kixfl[0]='kix'+$message+'.ok' ; - check file - $kixfl[1]='kix32.exe' $kixfl[2]='kx16.dll' $kixfl[3]='kx32.dll' $kixfl[4]='kx95.dll' $firstinst='yes' IF Exist($sysdrv+$kixfl[0]) DEL $sysdrv+'\kix*.ok' ENDIF ; - other installed kixtart versions removing always - IF Exist($destdir+$kixfl[0]) $firstinst='no' ELSE DEL $destdir+'kix*.ok' ; - other installed kixtart versions - ENDIF $update='no' $updinfo='' $i=0 WHILE $i<=$max $srcfl=$srcdir+$kixfl[$i] $destfil=$destdir+$kixfl[$i] IF Exist($destfil) $rc=SetFileAttr($destfil,128)<>0 ENDIF $update='yes' IF Exist($srcfl) $update='no' $srcflsz=GetFileSize($srcfl) $desflsz=GetFileSize($destfil) $srcfltm=GetFileTime($srcfl) $desfltm=GetFileTime($destfil) $srcfld=GetFileVersion($srcfl,'filedescription') $desfld=GetFileVersion($destfil,'filedescription') $srcflv=GetFileVersion($srcfl,'fileversion') $desflv=GetFileVersion($destfil,'fileversion') $srcfli=GetFileVersion($srcfl,'internalname') $desfli=GetFileVersion($destfil,'internalname') $srcfll=GetFileVersion($srcfl,'language') $desfll=GetFileVersion($destfil,'language') $srcflo=GetFileVersion($srcfl,'originalfilename') $desflo=GetFileVersion($destfil,'originalfilename') $srcflp=GetFileVersion($srcfl,'productname') $desflp=GetFileVersion($destfil,'productname') IF $srcflsz<>$desflsz $update='yes' ENDIF IF $srcfltm<>$desfltm $update='yes' ENDIF IF $srcfld<>$desfld $update='yes' ENDIF IF $srcflv<>$desflv $update='yes' ENDIF IF $srcfli<>$desfli $update='yes' ENDIF IF $srcfll<>$desfll $update='yes' ENDIF IF $srcflo<>$desflo $update='yes' ENDIF IF $srcflp<>$desflp $update='yes' ENDIF ENDIF IF $update='yes' COPY $srcfl $destfil /h $updinfo=$updinfo+' +'+Lcase($kixfl[$i]) ELSE $updinfo=$updinfo+' ='+Lcase($kixfl[$i]) ENDIF IF @error<>0 ? 'Warning INSTALL: error '+@error+' ('+@serror+')' ENDIF $i=$i+1 LOOP $updateok='yes' ; - all kixtart files must be available at $destdir - $i=1 $sfl=$sysdrv+$kixfl[0] $dfl=$destdir+$kixfl[0] WHILE $i<=$max $destfil=$destdir+$kixfl[$i] $dfltm=GetFileTime($destfil) $dflsz=GetFileSize($destfil) IF 0=Exist($destfil) $updateok='no' $updinfo=$updinfo+' unknown_file.'+$kixfl[$i] $rc=WriteProfileString($sfl,'KiX',$kixfl[$i],@date+' '+@time+' -> unknown file') $rc=WriteProfileString($dfl,'KiX',$kixfl[$i],@date+' '+@time+' -> unknown file') ELSE $buildinfo=GetFileVersion($destfil,'specialbuild') IF Len($buildinfo)>0 $buildinfo=' ('+Lcase($buildinfo)+')' ELSE $buildinfo='' ENDIF $rc=WriteProfileString($sfl,'KiX',$kixfl[$i],@date+' '+@time+' -> '+$dfltm+' '+$dflsz+$buildinfo) $rc=WriteProfileString($dfl,'KiX',$kixfl[$i],@date+' '+@time+' -> '+$dfltm+' '+$dflsz+$buildinfo) ENDIF $i=$i+1 IF @inwin=1 $i=$max+1 ENDIF LOOP $i=$max IF 2=@inwin $max=4 $i=2 ; - remove DLL's - WHILE $i<=$max $destfil=$destdir+$kixfl[$i] IF Exist($destfil) $rc=SetFileAttr($destfil,128)<>0 DEL $destfil $updinfo=$updinfo+' ?'+Lcase($kixfl[$i]) ELSE $updinfo=$updinfo+' ?'+Lcase($kixfl[$i]) ENDIF $i=$i+1 LOOP ENDIF ;$sysdrv+$kixfl[0] IF $updateok='yes' $updinfo='('+Ltrim(Rtrim(Lcase($updinfo)))+') to '+'"'+Ltrim(Rtrim(Lcase($destdir)))+'"' $rc=WriteProfileString($sfl,'KiX','KiX','install complete at '+@date+' '+@time+' '+$updinfo) $rc=WriteProfileString($dfl,'KiX','KiX','install complete at '+@date+' '+@time+' '+$updinfo) ELSE $updinfo='('+Ltrim(Rtrim(Lcase($updinfo)))+') to '+'"'+Ltrim(Rtrim(Lcase($destdir)))+'"' $rc=WriteProfileString($sfl,'KiX','KiX','install incomplete at '+@date+' '+@time+' '+$updinfo) $rc=WriteProfileString($dfl,'KiX','KiX','install incomplete at '+@date+' '+@time+' '+$updinfo) ENDIF IF $updateok<>'yes' IF Exist($sysdrv+$kixfl[0]) DEL $sysdrv+$kixfl[0] ENDIF ; - kixtart version is incompleted - IF Exist($destdir+$kixfl[0]) $destdir+$kixfl[0] ENDIF ; - kixtart version is incompleted - $rc=WriteProfileString($sfl,'KiX','KiX release',@PRODUCTTYPE+' -> kix '+@kix) $rc=WriteProfileString($dfl,'KiX','KiX release',@PRODUCTTYPE+' -> kix '+@kix) $rc=WriteProfileString($sfl,'KiX','KiX mode','update'+$message) $rc=WriteProfileString($dfl,'KiX','KiX mode','update'+$message) ENDIF :end_script $timestop=@time IF $update='yes' $loginfo='Kixtart-UPDATE '+$pgmvrs+' script completed successfully' $loginfo=$loginfo+' ('+$timest+' - '+$timestop+') '+Ltrim(Rtrim($updinfo)) IF $consolemode='yes' $loginfo=$loginfo+' (CONSOLE-LESS)' ENDIF IF $updateok='yes' $rc=LogEvent(0,1,$loginfo,'','Kixtart UPDATE @kix'+'c') ELSE $rc=LogEvent(0,1,$loginfo,'','Kixtart UPDATE @kix'+'e') ENDIF ENDIF IF $updateok='yes' $updateok='' ELSE $updateok='in' ENDIF IF $consolemode='yes' ? 'KiX '+@kix+' (console-less) update '+$updateok+'complete. (''+$srcdir+'' -> ''+$destdir+'')' ELSE ? 'KiX '+@kix+' update '+$updateok+'complete. (''+$srcdir+'' -> ''+$destdir+'')' ENDIF IF RedirectOutput('CON')=0 ENDIF IF $consolemode='yes' ? 'KiX '+@kix+' (console-less) update '+$updateok+'complete. ("'+$srcdir+"' -> '"+$destdir+'")' ELSE ? 'KiX '+@kix+' update '+$updateok+'completed. ("'+$srcdir+'" -> "'+$destdir+'")' ENDIF ? ? 'Informative INSTALL: no creation of debug list ''+$debug_file+''' :end IF $showmode='yes' $title='KiXtart '+@kix IF $firstinst='yes' IF Exist($sysdrv+'kix'+$message+'.ok') OR Exist($destdir+'kix'+$message+'.ok') $message='Install of KiX '+@kix+' complete' ELSE $message='Install of KiX '+@kix+' incomple' ENDIF ELSE IF Exist($sysdrv+'kix'+$message+'.ok') OR Exist($destdir+'kix'+$message+'.ok') $message='Install of KiX '+@kix+' complete' ELSE $message='Install of KiX '+@kix+' incomplete' ENDIF ENDIF ENDIF BREAK ON FLUSHKB IF Exist($sysdrv+'kix'+$message+'.ok') OR Exist($destdir+'kix'+$message+'.ok') EXIT(0) ELSE EXIT(1) ENDIF
Thanks for any feedback/updates to this.
Kent [ 24. April 2003, 14:24: Message edited by: kdyer ]
|
Top
|
|
|
|
#74705 - 2003-04-24 02:04 AM
Re: Re-Write of the KIX32.EXE Deployment tool
|
Les
KiX Master
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
Kent, I don't know why you would question the event log entry, your script deliberately puts it there.
IF $updateok='yes' $rc=LogEvent(0,1,$loginfo,'','Kixtart UPDATE @kix'+'c') ELSE $rc=LogEvent(0,1,$loginfo,'','Kixtart UPDATE @kix'+'e') ENDIF
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
Top
|
|
|
|
#74706 - 2003-04-24 02:33 PM
Re: Re-Write of the KIX32.EXE Deployment tool
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
quote:
get rid of the setconsole line!
Done..
quote:
anyway, why you use files if you already log to the eventlog?
The .OK file is used for a marker to see if the deployment has occurred..
Maybe we should share our NTLOGON.BAT to show what is going on. This is using 4.02 at this point, but you get the idea:
code:
@Echo OFF
:: LAST EDITED; kld 07.01.02 @10:38PM pst :: Trimmed down to use less stuff.. :: - From: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q318689 (Modified)
VER | find "NT" > nul IF not errorlevel 1 GOTO Win_NT
VER | find "2000" > nul IF not errorlevel 1 GOTO Win_NT
VER | find "XP" > nul IF not errorlevel 1 GOTO Win_NT
VER | find "98" > nul IF not errorlevel 1 GOTO Win_9X
VER | find "95" > nul IF not errorlevel 1 GOTO Win_9X
GOTO unknown_os
:win_NT @TITLE Company NT Logon Script ECHO HELLO %USERNAME%! Echo Welcome to %USERDOMAIN%, Inc. NT Domain Environment ::if not exist %windir%\kix410.ok %LOGONSERVER%\NETLOGON\kix410update.exe /q ::if not exist %windir%\kix411.ok %LOGONSERVER%\NETLOGON\kix411update.exe /q if not exist %SystemDrive%\Scripts\nul md %SystemDrive%\Scripts if not exist %SystemDrive%\Scripts\kix402.ok %LOGONSERVER%\NETLOGON\Programs\kix402update.exe /q %SystemDrive%\Scripts\kix32.exe %LOGONSERVER%\NETLOGON\Kixtart.kix /f :: -- call is reserved for calling another batch file - BAD MICROSOFT!! ::%windir%\kix32.exe %LOGONSERVER%\NETLOGON\Kixtest.kix goto end
:win_9X :: --- CHECK FOR FILES TO SET THE USER NAME IF NOT EXIST %WINDIR%\PUTINENV.EXE XCOPY \\SERVER\NETLOGON\Programs\Win9x\PUTINENV.EXE %WINDIR% IF NOT EXIST %WINDIR%\WINSET.EXE XCOPY \\SERVER\NETLOGON\Programs\Win9x\WINSET.EXE %WINDIR%
:: --- SET THE Environment Variables :: -- Execute the script ::%WINDIR%\SYSTEM\KIX32.EXE %WINDIR%\SYSTEM\W95ENV.KIX
%WINDIR%\PUTINENV.EXE L %WINDIR%\winset computername=%COMPUTERNAME% %WINDIR%\winset username=%USERNAME% %WINDIR%\winset LANGROUP=%LANGROUP% %WINDIR%\winset LOGONSERVER=%LOGONSERVER%
:: --- DISPLAY THE USER NAME/DOMAIN ECHO HELLO %USERNAME%! ECHO Welcome to %LANGROUP%, Inc. Windows 9x Domain Environment
:: ********************************************************************************************** :: ******************************REMOVE FILES NOT NEEDED***************************************** :: ********************************************************************************************** ::if not exist %windir%\kix410.ok %0\..\kix410update.exe /q ::if not exist %windir%\kix411.ok %0\..\kix411update.exe /q if not exist c:\scripts\nul md c:\scripts if not exist c:\scripts\kix402.ok %0\..\Programs\kix402update.exe /q ::%0\..\kix.exe %0\..\kix32.exe %0\..\kix95.kix C:\scripts\kix32.exe %0\..\kixtest.kix goto end
:unknown_os :end
quote:
I don't know why you would question the event log entry, your script deliberately puts it there.
I was concerned that a savvy user or Support Desk Tech would be a bit concerned with:
quote:
The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer.
I should probably not worry myself so much with this. I was just trying to put together a cleaner roll-out of this.
Thanks,
Kent
|
Top
|
|
|
|
#74708 - 2003-04-24 02:43 PM
Re: Re-Write of the KIX32.EXE Deployment tool
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
That is kind of what I thought.. I just wanted to be sure.
Additionally, I talked with a couple of my colleagues about this and they don't seem to have a problem with it.
Thanks,
Kent [ 24. April 2003, 14:50: Message edited by: kdyer ]
|
Top
|
|
|
|
#74709 - 2003-04-24 06:03 PM
Re: Re-Write of the KIX32.EXE Deployment tool
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
I would imagine with Lonkero and his "Script Magic" could clean this up even more..
But, here it is in a pretty good distilled down state..
It does seem to "bomb" if you remove the quotes from the following: code:
IF @inwin=1 $max='1' ELSE $max='4' ENDIF
{Edit} Never mind.. Me and those DIM Statements.. {/Edit}
Anyway, here is the code at this point.. code:
DIM $max,$kixfl[$max+1] $pgmvrs='3.10' $tmp=ExpandEnvironmentVars('%tmp%'+'\') $srcdir=@curdir+'\' $sysdrv=SUBSTR('%WINDIR%',1,3) $destdir=$sysdrv+'Scripts' $message=Substr(@kix,1,1)+Substr(@kix,3,2) IF 0=EXIST($destdir) MD $destdir ELSE $destdir=$destdir+'\' ENDIF IF len($destdir)=0 $destdir=@lanroot+'\' ENDIF IF @inwin=1 $max=1 ELSE $max=4 ENDIF ;DIM $kixfl[$max+1] $kixfl[0]='kix'+$message+'.ok' $kixfl[1]='kix32.exe' $kixfl[2]='kx16.dll' $kixfl[3]='kx32.dll' $kixfl[4]='kx95.dll' $firstinst='yes' IF Exist($sysdrv+$kixfl[0]) DEL $sysdrv+'\kix*.ok' ENDIF IF Exist($destdir+$kixfl[0]) $firstinst='no' ELSE DEL $destdir+'kix*.ok' ENDIF $update='no' $updinfo='' $i=0 WHILE $i<=$max $srcfl=$srcdir+$kixfl[$i] $destfil=$destdir+$kixfl[$i] IF Exist($destfil) $rc=SetFileAttr($destfil,128)<>0 ENDIF $update='yes' IF Exist($srcfl) $update='no' $srcflsz=GetFileSize($srcfl) $desflsz=GetFileSize($destfil) $srcfltm=GetFileTime($srcfl) $desfltm=GetFileTime($destfil) $srcfld=GetFileVersion($srcfl,'filedescription') $desfld=GetFileVersion($destfil,'filedescription') $srcflv=GetFileVersion($srcfl,'fileversion') $desflv=GetFileVersion($destfil,'fileversion') $srcfli=GetFileVersion($srcfl,'internalname') $desfli=GetFileVersion($destfil,'internalname') $srcfll=GetFileVersion($srcfl,'language') $desfll=GetFileVersion($destfil,'language') $srcflo=GetFileVersion($srcfl,'originalfilename') $desflo=GetFileVersion($destfil,'originalfilename') $srcflp=GetFileVersion($srcfl,'productname') $desflp=GetFileVersion($destfil,'productname') IF $srcflsz<>$desflsz $update='yes' ENDIF IF $srcfltm<>$desfltm $update='yes' ENDIF IF $srcfld<>$desfld $update='yes' ENDIF IF $srcflv<>$desflv $update='yes' ENDIF IF $srcfli<>$desfli $update='yes' ENDIF IF $srcfll<>$desfll $update='yes' ENDIF IF $srcflo<>$desflo $update='yes' ENDIF IF $srcflp<>$desflp $update='yes' ENDIF ENDIF IF $update='yes' COPY $srcfl $destfil /h $updinfo=$updinfo+' +'+$kixfl[$i] ELSE $updinfo=$updinfo+' ='+$kixfl[$i] ENDIF $i=$i+1 LOOP $upok='yes' $i=1 $sfl=$sysdrv+$kixfl[0] $dfl=$destdir+$kixfl[0] WHILE $i<=$max $destfil=$destdir+$kixfl[$i] $dfltm=GetFileTime($destfil) $dflsz=GetFileSize($destfil) IF 0=Exist($destfil) $upok='no' $updinfo=$updinfo+' unknown_file.'+$kixfl[$i] $rc=WriteProfileString($sfl,'KiX',$kixfl[$i],@date+' '+@time+' -> unknown file') $rc=WriteProfileString($dfl,'KiX',$kixfl[$i],@date+' '+@time+' -> unknown file') ELSE $buildinfo=GetFileVersion($destfil,'specialbuild') IF Len($buildinfo)>0 $buildinfo=' ('+Lcase($buildinfo)+')' ELSE $buildinfo='' ENDIF $rc=WriteProfileString($sfl,'KiX',$kixfl[$i],@date+' '+@time+' -> '+$dfltm+' '+$dflsz+$buildinfo) $rc=WriteProfileString($dfl,'KiX',$kixfl[$i],@date+' '+@time+' -> '+$dfltm+' '+$dflsz+$buildinfo) ENDIF $i=$i+1 IF @inwin=1 $i=$max+1 ENDIF LOOP $i=$max IF 2=@inwin $max=4 $i=2 WHILE $i<=$max $destfil=$destdir+$kixfl[$i] IF Exist($destfil) $rc=SetFileAttr($destfil,128)<>0 DEL $destfil $updinfo=$updinfo+' ?'+$kixfl[$i] ELSE $updinfo=$updinfo+' ?'+$kixfl[$i] ENDIF $i=$i+1 LOOP ENDIF IF $upok='yes' $state='install complete at ' $info=$state+@date+' '+@time+' '+$updinfo ELSE $state='install incomplete at ' $info='update'+$message IF Exist($sysdrv+$kixfl[0]) DEL $sysdrv+$kixfl[0] ENDIF IF Exist($destdir+$kixfl[0]) $destdir+$kixfl[0] ENDIF ENDIF $rc=WriteProfileString($sfl,'KiX','KiX release',@producttype+' -> kix '+@kix) $rc=WriteProfileString($dfl,'KiX','KiX release',@producttype+' -> kix '+@kix) $updinfo='('+Trim($updinfo)+') to '+'"'+Trim($destdir)+'"' $rc=WriteProfileString($sfl,'KiX','KiX',$info) $rc=WriteProfileString($dfl,'KiX','KiX',$info)
Thanks,
Kent [ 24. April 2003, 18:05: Message edited by: kdyer ]
|
Top
|
|
|
|
#74710 - 2003-04-27 07:42 AM
Re: Re-Write of the KIX32.EXE Deployment tool
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
MCA..
Where are you? What are your thoughts, since I stole your code?
Kent
|
Top
|
|
|
|
#74712 - 2003-04-27 05:44 PM
Re: Re-Write of the KIX32.EXE Deployment tool
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Either way.. It doesn't matter. I was just curious to see what he thought of the clean-up..
Kent
|
Top
|
|
|
|
#74713 - 2003-04-27 06:01 PM
Re: Re-Write of the KIX32.EXE Deployment tool
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Additionally, if we take this to the "next level."
If we are talking about KiXGolf scores: New install.kix 4,014 bytes
Original Install.kix 2,832 bytes Original Start1.kix 27,220 bytes Original Start2.kix 71,084 bytes ---- Total = 101,136
396.89% size increase. Yechh..
Some comments: (1) Why is START2.KIX in the archive if you are doing an automated install anyway? Yes, you can add switches, but if the code is solid enough, what is the point? (2) Why over-use parenthises? Is this to make this more "bullet-proof?" (4) Why not use variables? They cut down the length of lines and they can be re-used.
There is my 2 Pennies/Lira/DM/etc.
Kent
|
Top
|
|
|
|
#74715 - 2003-04-27 07:04 PM
Re: Re-Write of the KIX32.EXE Deployment tool
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Les,
As a Moderator, I have seen the Manual. However, you bring up a good point with KX95.DLL. In this example, we are "installing" KIX32.EXE and not WKIX32.EXE to the client and not the server. This leads to the question, from the client, under WINTENDO, would you run XNET to query if the service is running on your DC?
Kent
|
Top
|
|
|
|
#74719 - 2003-04-29 03:00 AM
Re: Re-Write of the KIX32.EXE Deployment tool
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Kent,
We had see your input already. We were just waiting on other reactions before we had the intention to return some input on your efforts. Possible, that we saw some interesting input.
Some elements in your versions show new ideas.
So we can make your script a little bit smaller when we are removing downward compatible requirements and when we doesn't need the debugging capabilities. Also we see some things which need some corrects.
Some remarks and suggestions:
- we aren't using variables when we are referencing them only once. variables without
any reference can be also comment f.e. $pgmvrs. - you are starting in the first WHILE/LOOP structure with the wrong $i value.
it should be $i=1. it isn't your intention to copy an existing control file to your "X:\Scripts" location we suppose. - one of your last lines in second example $updinfo= is missing any goal. you
aren't referencing them. - in the line IF Exist($destdir+$kixfl[0]) $destdir+$kixfl[0] ENDIF we are missing DELcommand.
- we are missing the last three lines, which makes it possible to do some error checking
from a batch job. - also you can replace the control file kix420.ok by registry entry, which makes
your code also a little bit smaller. also it is possible that you are creating only one control file in the %windir% directory. the other location is only for backwards compatibility. - of course you need only one script to start installation, but in our version we have introduce
both start1.kix and start2.kix versions to make it possible that we can help others with their problems by using our iexpress package. - of course the amount of information can reduced. for us it are only debugging issues.
to claim a reducing with 396,89% isn't fair. without any debugging facility you must make the comparison with the start1.kix script only. with the above remarks included we can reduce your script into start1.kix 2.862 bytes (reducing 140.25%) or start1.kix 2.596 bytes (reducing 154.62%) or start1.kix 2.217 bytes (reducing 181.11%) Also you shouldn't forget that IEXPRESS compress those information too. More important is how much time both versions will cost during an installation process. With the UPCTimer 1.6 we get for our versions:
code:
- kix421update.exe 0.112393 sec - kix421registry.exe 0.133719 sec - wkix421update.exe 0.088145 sec
So what is small. Reaction on your 2 Pennies
- (1)why? when we are running it on our environment we doesn't need a debugging script
liike start2.kix. more important is, that we can instruct people in an easy way to create debugging information about their iexpress installation when they have problems with it. Oh yeh, how did we solve the "terminal service" model? with a debug file. - (2)why over-use parenthises? indeed to make it more "bullet-proof" and to get
a better layout in our opinion. - (3) ???
- (4) why not use variables? in some situations it is possible, but we didn't.
general people aren't see anything from our code. in some situations we are doing things twice to make reading not too hard. currently we are running our twenties version. Reaction on the two Pennies of Les
- indeed we are also missing the WKIX32.EXE. But it is important to know
in which way Kent is creating his IEXPRESS package. It is f.e. possible that he is call WKIX32.EXE KIX32.EXE in his version. - sorry Les. Kent isn't installating DLL's when they aren't needed. He only
verifies "do they exist and when positive remove them". Script contains only one COPY statement. See the first WHILE/LOOP structure. Our version based on your second version
code:
DIM $max,$kixfl[$max+1] ; vs 3.10 $tmp=ExpandEnvironmentVars('%tmp%'+'\') $srcdir=@curdir+'\' $destdir=Substr('%WINDIR%',1,3)+'Scripts' $message=Substr(@kix,1,1)+Substr(@kix,3,2) ; IF Exist($destdir)=0 MD $destdir ENDIF IF Len($destdir)=0 $destdir=@lanroot ENDIF IF Substr($destdir,Len($destdir),1) <> '\' $destdir=$destdir+'\' ENDIF ; IF @inwin=1 $max=1 ELSE $max=4 ENDIF $kixfl[0]='kix'+$message+'.ok' $kixfl[1]='kix32.exe' $kixfl[2]='kx16.dll' $kixfl[3]='kx32.dll' $kixfl[4]='kx95.dll' $firstinst='yes' IF Exist($destdir+$kixfl[0]) $firstinst='no' ELSE DEL $destdir+'kix*.ok' ENDIF ; $updinfo='' $i=1 WHILE $i <= $max $srcfl=$srcdir+$kixfl[$i] $destfil=$destdir+$kixfl[$i] IF Exist($destfil) $rc=SetFileAttr($destfil,128) <> 0 ENDIF IF Exist($srcfl) IF GetFileSize($srcfl) <> GetFileSize($destfil) OR GetFileTime($srcfl) <> GetFileTime($destfil) OR GetFileVersion($srcfl,'filedescription') <> GetFileVersion($destfil,'filedescription') OR GetFileVersion($srcfl,'fileversion') <> GetFileVersion($destfil,'fileversion') OR GetFileVersion($srcfl,'internalname') <> GetFileVersion($destfil,'internalname') OR GetFileVersion($srcfl,'language') <> GetFileVersion($destfil,'language') OR GetFileVersion($srcfl,'originalfilename') <> GetFileVersion($destfil,'originalfilename') OR GetFileVersion($srcfl,'productname') <> GetFileVersion($destfil,'productname') COPY $srcfl $destfil /h $updinfo=$updinfo+' +'+$kixfl[$i] ELSE $updinfo=$updinfo+' ='+$kixfl[$i] ENDIF ENDIF $i=$i+1 LOOP ; $upok='yes' $i=1 WHILE $i <= $max $destfil=$destdir+$kixfl[$i] IF Exist($destfil) = 0 $upok='no' $updinfo=$updinfo+' unknown_file.'+$kixfl[$i] $rc=WriteProfileString($destdir+$kixfl[0],'KiX',$kixfl[$i],@date+' '+@time+' -> unknown file') ELSE $buildinfo=GetFileVersion($destfil,'specialbuild') IF Len($buildinfo) > 0 $buildinfo=' ('+Lcase($buildinfo)+')' ENDIF $rc=WriteProfileString($destdir+$kixfl[0],'KiX',$kixfl[$i],@date+' '+@time+' -> '+GetFileTime($destfil)+' '+GetFileSize($destfil)+$buildinfo) ENDIF $i=$i+1 IF @inwin=1 $i=$max+1 ENDIF LOOP $i=$max IF @inwin <> 1 $max=4 $i=2 WHILE $i <= $max $destfil=$destdir+$kixfl[$i] IF Exist($destfil) $rc=SetFileAttr($destfil,128) <> 0 DEL $destfil ENDIF $updinfo=$updinfo+' ?'+$kixfl[$i] $i=$i+1 LOOP ENDIF IF $upok='yes' $state='install complete at ' $info=$state+@date+' '+@time+' '+$updinfo ELSE $state='install incomplete at ' $info='update kix'+$message IF Exist($destdir+$kixfl[0]) DEL $destdir+$kixfl[0] ENDIF ENDIF $rc=WriteProfileString($dfl,'KiX','KiX release',@producttype+' -> kix '+@kix) $rc=WriteProfileString($dfl,'KiX','KiX',$info) ; IF Exist($destdir+'kix'+$message+'.ok') EXIT(0) ELSE EXIT(1) ENDIF
The reduced version
code:
dim $x1,$x2[$x1+1] $x3=ExpandEnvironmentVars('%tmp%'+'\') $x4=@curdir+'\' $x5=Substr('%WINDIR%',1,3)+'Scripts' $x6=Substr(@kix,1,1)+Substr(@kix,3,2) if Exist($x5)=0 md $x5 endif if Len($x5)=0 $x5=@lanroot endif if Substr($x5,Len($x5),1)<>'\' $x5=$x5+'\' endif if @inwin=1 $x1=1 else $x1=4 endif $x2[0]='kix'+$x6+'.ok' $x2[1]='kix32.exe' $x2[2]='kx16.dll' $x2[3]='kx32.dll' $x2[4]='kx95.dll' $x7='yes' if Exist($x5+$x2[0]) $x7='no' else del $x5+'kix*.ok' endif $x8='' $x9=1 while $x9<=$x1 $x10=$x4+$x2[$x9] $x11=$x5+$x2[$x9] if Exist($x11) $x12=SetFileAttr($x11,128)<>0 endif if Exist($x10) if GetFileSize($x10)<>GetFileSize($x11) OR GetFileTime($x10)<>GetFileTime($x11) OR GetFileVersion($x10,'filedescription')<>GetFileVersion($x11,'filedescription') OR GetFileVersion($x10,'fileversion')<>GetFileVersion($x11,'fileversion') OR GetFileVersion($x10,'internalname')<>GetFileVersion($x11,'internalname') OR GetFileVersion($x10,'language')<>GetFileVersion($x11,'language') OR GetFileVersion($x10,'originalfilename')<>GetFileVersion($x11,'originalfilename') OR GetFileVersion($x10,'productname')<>GetFileVersion($x11,'productname') copy $x10 $x11 /h $x8=$x8+' +'+$x2[$x9] else $x8=$x8+' ='+$x2[$x9] endif endif $x9=$x9+1 loop $x13='yes' $x9=1 while $x9<=$x1 $x11=$x5+$x2[$x9] if Exist($x11)=0 $x13='no' $x8=$x8+' unknown_file.'+$x2[$x9] $x12=WriteProfileString($x5+$x2[0],'KiX',$x2[$x9],@date+' '+@time+' -> unknown file') else $x14=GetFileVersion($x11,'specialbuild') if Len($x14)>0 $x14=' ('+Lcase($x14)+')' endif $x12=WriteProfileString($x5+$x2[0],'KiX',$x2[$x9],@date+' '+@time+' -> '+GetFileTime($x11)+' '+GetFileSize($x11)+$x14) endif $x9=$x9+1 if @inwin=1 $x9=$x1+1 endif loop $x9=$x1 if @inwin<>1 $x1=4 $x9=2 while $x9<=$x1 $x11=$x5+$x2[$x9] if Exist($x11) $x12=SetFileAttr($x11,128)<>0 del $x11 endif $x8=$x8+' ?'+$x2[$x9] $x9=$x9+1 loop endif if $x13='yes' $x15='install complete at ' $x16=$x15+@date+' '+@time+' '+$x8 else $x15='install incomplete at ' $x16='update kix'+$x6 if Exist($x5+$x2[0]) del $x5+$x2[0] endif endif $x12=WriteProfileString($x17,'KiX','KiX release',@producttype+' -> kix '+@kix) $x12=WriteProfileString($x17,'KiX','KiX',$x16) if Exist($x5+'kix'+$x6+'.ok') exit (0) else exit (1) endif
greetings.
|
Top
|
|
|
|
#74720 - 2003-04-29 06:47 AM
Re: Re-Write of the KIX32.EXE Deployment tool
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
btw: another important issue was and is "we are using same scripts for different kixtart releases. also the kixtart 3.6x releases". So some new functions, commands or macros can't be used in our scripts.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 980 anonymous users online.
|
|
|