[wpkg-users] Remove Packages with forced reboot in uninstaller

Nils Thiele it.service.kultur at uni-hamburg.de
Thu Jul 23 11:46:20 CEST 2015


Am 2015-07-21 17:20, schrieb Will Aoki:
> On Tue, Jul 21, 2015 at 12:00:51PM +0200, Nils Thiele wrote:
>> This results in a loop when running wpkg again.
>> Because its still in local package DB but checks failed it will
>> reinstall, after that it tries to remove the package again and this
>> goes on forever.
> 
> Perhaps you could touch a file during the uninstall process and write
> checks so that the file satisfies the package's check conditions and
> prevents the install from running if for some reason it doesn't?
> 
>   <check type="logical" condition="or" />
>     <check type="file" condition="exists"
> path="%PROGRAMDATA%\wpkg\uninstall-netware-pls" />
>     <check type="uninstall" condition="exists" path="Novell Client.*" 
> />
>   </check>
> 
>   <install cmd='%SOFTWARE%\NetWare\clntwhatever.exe'>
>     <!-- avoid installing again if main checks were somehow not 
> satisfied -->
>     <check type="logical" condition="not">
>       <check type="file" condition="exists"
> path="%PROGRAMDATA%\wpkg\uninstall-netware-pls" />
>     </check>
>   </install>
> 
>   <remove cmd='%COMSPEC% /c copy nul
> "%PROGRAMDATA%\wpkg\uninstall-netware-pls"' >
>     <exit code="any" />
>   </remove>
> 
>   <!-- Clean up the file if we're not going to run NWUninstallClient 
> -->
>   <remove cmd='%COMSPEC% /c del 
> "%PROGRAMDATA%\wpkg\uninstall-netware-pls" />
>     <check type="logical" condition="not">
>       <check type="uninstall" condition="exists" path="Novell Client.*" 
> />
>     </check>
>     <exit code="any" />
>   </remove>
> 
>   <!-- ... otherwise, kill it -->
>   <remove cmd='rundll32.exe "%PROGRAMFILES%\Novell\Client\ncsetup.dll"
> NWUninstallClient /s">
>     <check type="uninstall" condition="exists" path="Novell Client.*" 
> />
>   </remove>
> 
> 
> -------------------------------------------------------------------------
> SSLrack - get your cheap cheap SSL certificates (standard, wildcard, 
> EV)
> http://www.sslrack.com/
> -------------------------------------------------------------------------
> wpkg-users mailing list archives >> 
> http://lists.wpkg.org/pipermail/wpkg-users/
> _______________________________________________
> wpkg-users mailing list
> wpkg-users at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/wpkg-users

Thanks for the great Idea,
this works perfectly, here is my full package for reference:

<package
	id="novellclient_sp3"
	name="Novell Client 2"
	revision="%version%"
	priority="100">

	<variable name="version" value="2 SP3 (IR10)" />
	<check type="logical" condition="or" >
		<check type="uninstall" condition="versiongreaterorequal" path="Novell 
Client.+" value="%version%" />
		<check type="file" condition="exists" 
path="%PROGRAMDATA%\novell-is-removing" />
	</check>

	<!-- Install Novell Certificate: 
https://www.novell.com/support/kb/doc.php?id=7008140 -->
	<!-- Remove all certificates from trusted publishers -->
	<install cmd='"%SOFTWARE%\novell\certmgr.exe" -del -all -s -r 
localMachine trustedpublisher' />

	<!-- Install new Certificate -->
	<install cmd='"%SOFTWARE%\novell\certmgr.exe" -add 
"%SOFTWARE%\novell\%version%\cert\nwcert.cer" -s -r localMachine 
trustedpublisher' >
		<condition>
			<check type="logical" condition="not" >
				<check type="file" condition="exists" 
path="%PROGRAMDATA%\novell-is-removing" />
			</check>
		</condition>
	</install>

	<!-- Install Novell Client with supplied configuration, condition: 
check if novell is in wpkg uninstall process -->
	<install cmd='"%SOFTWARE%\novell\%version%\setup.exe" 
/ncpf:unattend.txt' >
		<condition>
			<check type="logical" condition="not">
				<check type="file" condition="exists" 
path="%PROGRAMDATA%\novell-is-removing" />
			</check>
		</condition>
		<exit code="0" reboot="delayed" />
	</install>

	<!-- only upgrade if software update is available,  not a package 
update -->
     <upgrade include="install" >
		<condition>
			<check type="uninstall" condition="versionsmallerthan" path="Novell 
Client.+" value="%version%" />
		</condition>
	</upgrade>


	<!-- Create dummy file to show uninstall was executed -->
	<remove cmd='%COMSPEC% /c copy nul "%PROGRAMDATA%\novell-is-removing"' 
 >
		<exit code="any" />
	</remove>

	<!-- Remove dummy file if Novell is allready uninstalled -->
	<remove cmd='%COMSPEC% /c del "%PROGRAMDATA%\novell-is-removing"' >
		<condition>
			<check type="logical" condition="not">
				<check type="uninstall" condition="exists" path="Novell Client.*" />
			</check>
		</condition>
		<exit code="any" />
	</remove>

	<!-- Remove Novell if it is still installed -->
	<remove cmd='%COMSPEC% /C if exist "C:\Program 
Files\Novell\Client\ncsetup.dll" rundll32 "C:\Program 
Files\Novell\Client\ncsetup.dll" NWUninstallClient /s'>
		<condition>
			<check type="uninstall" condition="exists" path="Novell Client.+" />
		</condition>
	</remove>

</package>


@Marco:
This could work as well but i needed the upgrade before remove feature 
in the past allready and i dont want to change this option systemwide.

Greetings,
Nils


-- 
IT-Support - Fachbereich 09 Kulturgeschichte und Kulturkunde
Universität Hamburg
Email: it.service.kultur at uni-hamburg.de


More information about the wpkg-users mailing list