If Abfrage auf Wert bei Deinstallation

Post Reply
OV
Posts: 45
Joined: 18. Aug 2009, 11:38
Location: KS
Contact:

If Abfrage auf Wert bei Deinstallation

Post by OV » 03. Sep 2010, 14:44

Hallo zusammen,ichhabe da ein kleines Problem
Ok… von vorne ;)

Problem Paket ist der Novell Client. Das Programm soll bei allen deinstalliert werden, weil wir auf Windows Logon umstellen.
Die Deinstallation läuft dank der Hilfestellung hier aus dem Forum super. Jetzt ist aber aufgefallen, dass einige User ein Novelllauferk verbunden haben und dort darf der Novellclient nicht deinstalliert werden.

Deshalb prüfen wir ob ein bestimmtes Profil vorhanden ist und setzen wenn es vorhanden ist dann den String hklm\software\sma,NWClient auf 1.

- Das Paket soll sich weiterhin normal installieren lassen: Funktioniert...
- Bei der Deinstallation soll der String auf den Wert geprüft werden und wenn dieser 1 ist soll die Deinstallation abbrechen Ist der Wert 0 soll deinstalliert werden.

Testweise änder ich also den Wert auf 1 und drücke auf Deinstallieren...
Jetzt sollte ja eigtl. die Deinstallation abgebrochen werden. tut es aber nicht???
Hier der betr. Teil der Setup.inf

[Set:Product]

[SET:Installation]
Call "%SRC%\setupnw.exe" /u:unattended.txt
If %ErrorLevel% <> "0" Then "SET:InstallationError" EndIf

[SET:Deinstallation]
-Call %SystemRoot%\system32\rundll32 nwsetup.dll NWUninstallClient
-"%SRC%\AutoIt\AutoIt3.exe" "%SRC%\AutoIt\ClickButton.au3"
-AddMeter -1
-If %Ready4Uninstall% <> "0" Then "SET:DeinstallationError" EndIf
-SET Ready4Uninstall=%HKLM,"SOFTWARE\SMA","NWClient"%

User avatar
slueben
Posts: 54
Joined: 28. Aug 2009, 19:07
Location: Köln
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by slueben » 03. Sep 2010, 15:51

Moin,
nach meiner bisherigen Erfahrung darf vor IF in der Deinstallation kein "-" stehen.

Lass mal das "-" weg und setz einen ErrorLogMsg zum Debuggen.

Also ungefähr so:
[SET:Deinstallation]
-Call %SystemRoot%\system32\rundll32 nwsetup.dll NWUninstallClient
-"%SRC%\AutoIt\AutoIt3.exe" "%SRC%\AutoIt\ClickButton.au3"
-AddMeter -1
-ErrorLogMsg Deinstallation continued
If %Ready4Uninstall% <> "0" Then "SET:DeinstallationError" EndIf
-ErrorLogMsg %Ready4Uninstall%
-SET Ready4Uninstall=%HKLM,"SOFTWARE\SMA","NWClient"%
Mit freundlichen Grüßen

Stefan Lüben
______________________________________
Ev. Verwaltungsverband in Bonn
Leiter Informationstechnik

OV
Posts: 45
Joined: 18. Aug 2009, 11:38
Location: KS
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by OV » 03. Sep 2010, 18:09

Danke ;) oh das - vor dem if ist da auch nicht drin ;)
ich teste das gleich mal mit dem ErrorLogMsg %Ready4Uninstall%

OV
Posts: 45
Joined: 18. Aug 2009, 11:38
Location: KS
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by OV » 03. Sep 2010, 18:29

Errorlog sagt folgendes wenn ich den wert auf 1 setze:

ErrorLogMsg: 1
------------
ErrorLogMsg: Deinstallation continued


setz eich den wert auf kommt:

ErrorLogMsg: 0
------------
ErrorLogMsg: Deinstallation continued

also alles richtig... aber warum übergeht er das?

User avatar
slueben
Posts: 54
Joined: 28. Aug 2009, 19:07
Location: Köln
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by slueben » 03. Sep 2010, 18:35

wahrscheinlich hast du vergessen in der SET:DeinstallationError einen "Abort" oder "Exit" zu setzen.

In der setup.inf führt ein IF ... Then ... Else ... EndIf immer ein Gosub und Return aus, d. h. er findet die Bedingung für den SET:DeinstallationError, führt den Abschnitt aus, und setzt dann an der Stelle fort. Du musst also in dem SET:DeinstallationError dafür sorgen, dass die Installation abbricht.
Bei Abort kannst Du übrigens einen Fehlertext mit angeben, der in der SetupErrorLog auftaucht. So sollte das nun eigentlich gehen.
Mit freundlichen Grüßen

Stefan Lüben
______________________________________
Ev. Verwaltungsverband in Bonn
Leiter Informationstechnik

OV
Posts: 45
Joined: 18. Aug 2009, 11:38
Location: KS
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by OV » 03. Sep 2010, 19:07

hier mal alles wichtige:
soweit funktioniert es jetzt. das Programm wird nicht mehr deinstalliert dennoch wird es jetzt als deinstalliert im sw depot angezeigt und es kommt auch keine logmessage...
???
[SET:Product]

[SET:Installation]
Call "%SRC%\setupnw.exe" /u:unattended.txt
If %ErrorLevel% <> "0" Then "SET:InstallationError" EndIf

[SET:Deinstallation]
-ErrorLogMsg Deinstallation continued
If %Ready4Uninstall% == %Key1% Then "SET:Deinstallation2" Else "SET:DeinstallationError2" EndIf
-ErrorLogMsg %Key1%
-ErrorLogMsg %Ready4Uninstall%
-SET Key1 = 0
-SET Ready4Uninstall=%HKLM,"SOFTWARE\SMA","NWClient"%

[Set:Deinstallation2]
-Call %SystemRoot%\system32\rundll32 nwsetup.dll NWUninstallClient
-"%SRC%\AutoIt\AutoIt3.exe" "%SRC%\AutoIt\ClickButton.au3"
-AddMeter -1

[Reg:OnUninstallProduct]

[Reg:Product]

[Ini:Product]

[Security:Product]

[Shell:Installer]

[Shell:Product]


[SET:InstallationError]
ErrorLogMsg %ErrorText% %ErrorLevel% %CallingText% setupnw.exe
Abort

[SET:DeInstallationError]
ErrorLogMsg %ErrorText% %ErrorLevel% %CallingText% setupnw.exe
Abort

[SET:DeInstallationError2]
ErrorLogMsg Auf diesem PC darf der NovellClient aufgrund der Prüfung nicht deinstalliert werden
Abort

User avatar
slueben
Posts: 54
Joined: 28. Aug 2009, 19:07
Location: Köln
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by slueben » 03. Sep 2010, 20:34

Hmm, mal denken ...

[SET:Product]

[SET:Installation]
Call "%SRC%\setupnw.exe" /u:unattended.txt
If %ErrorLevel% <> "0" Then "SET:InstallationError" EndIf

[SET:Deinstallation]
;-ErrorLogMsg Deinstallation continued
;If %Ready4Uninstall% == %Key1% Then "SET:Deinstallation2" Else "SET:DeinstallationError2" EndIf
;-ErrorLogMsg %Key1%
;-ErrorLogMsg %Ready4Uninstall%
;-SET Key1 = 0
;-SET Ready4Uninstall=%HKLM,"SOFTWARE\SMA","NWClient"%
-Abort "Auf diesem PC darf der NovellClient aufgrund der Prüfung nicht deinstalliert werden"
IF %HKLM,"SOFTWARE\SMA","NWClient"% == "0" Then "Set:Deinstallation2" EndIf

[Set:Deinstallation2]
-Call %SystemRoot%\system32\rundll32 nwsetup.dll NWUninstallClient
-"%SRC%\AutoIt\AutoIt3.exe" "%SRC%\AutoIt\ClickButton.au3"
-AddMeter -1

[Reg:OnUninstallProduct]

[Reg:Product]

[Ini:Product]

[Security:Product]

[Shell:Installer]

[Shell:Product]


[SET:InstallationError]
ErrorLogMsg %ErrorText% %ErrorLevel% %CallingText% setupnw.exe
Abort

[SET:DeInstallationError]
ErrorLogMsg %ErrorText% %ErrorLevel% %CallingText% setupnw.exe
Abort

;[SET:DeInstallationError2]
;ErrorLogMsg Auf diesem PC darf der NovellClient aufgrund der Prüfung nicht deinstalliert werden
;Abort

So könnte es gehen.
Mit freundlichen Grüßen

Stefan Lüben
______________________________________
Ev. Verwaltungsverband in Bonn
Leiter Informationstechnik

OV
Posts: 45
Joined: 18. Aug 2009, 11:38
Location: KS
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by OV » 04. Sep 2010, 07:56

Jetzt wird das einfach wieder übersprungen

Wert ist 1 und das teil deinstalliert fröhlich. Ich bin dem Wahnsinn nahe! :shock:

User avatar
MSC
Posts: 324
Joined: 03. Jul 2006, 09:03
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by MSC » 06. Sep 2010, 14:23

Hi,

so läuft es bei mir durch:

...
[Environment]
V_NovellCheck=%HKLM,"SOFTWARE\SMA","NWClient"%

[Product]
ReplaceEnv V_NovellCheck
#SET:Installation, DONTDELETE
#SET:Deinstallation, DELETE

[SET:Installation]
Echo Install %V_NovellCheck% \n V_NovellCheck=%HKLM,"SOFTWARE\SMA","NWClient"%

[SET:Deinstallation]
If "%V_NovellCheck%" == "0" Then "SET:Deinstallation2" Else "SET:DeinstallationError2" EndIf


[Set:Deinstallation2]
exit
;Call...
-Echo Deinstall inprogress... %V_NovellCheck%
-AddMeter -1

[Set:DeinstallationError2]
-abort
-Echo DeinstallError %V_NovellCheck%
-AddMeter -1
...

mfg Mario
.

OV
Posts: 45
Joined: 18. Aug 2009, 11:38
Location: KS
Contact:

Re: If Abfrage auf Wert bei Deinstallation

Post by OV » 06. Sep 2010, 15:57

es geht ... habe es noch ein wenig modifiziert... Jetzt läuft es. Danke für die Hilfe



[Environment]
V_NovellCheck=%HKLM,"SOFTWARE\SMA","NWClient"%

[Product]
ReplaceEnv V_NovellCheck
#SET:Installation, DONTDELETE
#SET:Deinstallation, DELETE

[SET:Product]

[SET:Installation]
Call "%SRC%\setupnw.exe" /u:unattended.txt
If %ErrorLevel% <> "0" Then "SET:InstallationError" EndIf

[SET:Deinstallation]
If "%V_NovellCheck%" == "0" Then "SET:Deinstallation2" Else "SET:DeinstallationError2" EndIf


[SET:Deinstallation2]
exit
-Call %SystemRoot%\system32\rundll32 nwsetup.dll NWUninstallClient
-"%SRC%\AutoIt\AutoIt3.exe" "%SRC%\AutoIt\ClickButton.au3"

-Echo Deinstall inprogress... %V_NovellCheck%
-AddMeter -1

[Reg:OnUninstallProduct]

[Reg:Product]

[Ini:Product]

[Security:Product]

[Shell:Installer]

[Shell:Product]


[SET:InstallationError]
Abort

[SET:DeInstallationError]
Abort "Auf diesem PC darf der NovellClient aufgrund der Prüfung nicht dienstalliert werden"

[Set:DeinstallationError2]
-abort
-Echo DeinstallError %V_NovellCheck%
-AddMeter -1

Post Reply

Return to “Paketierung”

Who is online

Users browsing this forum: No registered users and 11 guests