Umgebungsvariablen werden nicht übernommen(lokale bat Datei)

MPI.EVA
Posts: 170
Joined: 19. Jun 2008, 15:40
Contact:

Umgebungsvariablen werden nicht übernommen(lokale bat Datei)

Post by MPI.EVA » 12. Jul 2008, 18:42

Hallo,

wir sind gerade dabei unsere Root Zertifikate in den FireFox zu importieren, mit dem Mozilla eigenen Tool "certutil"

Dazu kopieren wir die *.db Dateien aus dem Mozilla\Profile\xxxxxxxx.default\ Verzeichnis in ein temp. Verzeichnis. Den *.db Dateien werden die Zertifikate hinzugefügt und danach sollen sie in das Profil des Benutzers zurück kopiert werden.

Per Setup.inf werden die benötigtens Datein kopiert und im anschluss die "cert.bat" gestartet

Die *.db Dateien werden ohne Problem aus dem Profile Ordner des Users nach c:cert-toolcert kopiert. Nur das zurück kopieren nach dem bearbeiten klappt nicht. Die *.db Dateien laden immer im Ordner des Paketes auf dem Server V:\Packages\INT\Mozilla\MPG_Certificates\1.0

Die Bezeichner [1], ..., [4] sind kein Bestandteil der Original cert.bat, sie sollen nur die Verbindung zwischen cert.bat und dem Output darstellen.

Schon bei [1] wird das Serververzeichnis als Output ausgegeben aber die Dateien werden aus dem Userprofil kopiert.
Über Vorschläge freuen ich mich!

Danke!

Dennis


Setup.inf

Code: Select all

[...]
[SET:Installation]
AddMeter 50
cd "%src%"
[...]
;; copy configuration files and certificates to disk
[...]
Call "C:\cert-tool\cert.bat"
[...]
cert.bat

Code: Select all

REM set PATH variable to cert-tool

set PATH_BACKUP=%PATH%
set PATH=%PATH%;C:\cert-tool\lib;C:\cert-tool\bin


REM copy user .db files

cd "%USERPROFILE%\Application Data\Mozilla\Firefox\Profiles\*.default"
echo ..
cd [1]
echo ..
copy /Y *.db C:\cert-tool\certs
cd C:\cert-tool\certs
echo ..
cd [2]
echo ..

REM add certs to .db
REM more Infos: http://www.mozilla.org/projects/security/pki/nss/tools/certutil.html

C:\cert-tool\bin\certutil -A -n "Deutsche Telekom Root CA 2 - Deutsche Telekom AG" -t TCP -d "." -i C\:cert-tool\certs\Telekom.crt
C:\cert-tool\bin\certutil -A -n "DFN-Verein PCA Global - G01 - Deutsche Telekom AG" -t TCP -d "." -i C\:cert-tool\certs\DFN.crt
C:\cert-tool\bin\certutil -A -n "MPG CA - DFN-Verein" -t TCP -d "." -i C:\cert-tool\certs\MPG.crt


REM copy user .db files back to profile

cd "%USERPROFILE%\Application Data\Mozilla\Firefox\Profiles\*.default"
echo ..
cd [3]
echo ..
set CurrentDir=%cd%
echo ..
echo Show Currnt Dir
echo %CurrentDir% [4]
echo ..
copy /Y "C:\cert-tool\certs*.db" "%CurrentDir%"
cd c:

REM PATH variable back to default

set PATH=%PATH_BACKUP%
pause

Output cert.bat

Code: Select all

..
[1] V:\Packages\INT\Mozilla\MPG_Certificates\1.0
..
cert8.db
key3.db
secmod.db
        3 file(s) copied.
..
[2]V:\Packages\INT\Mozilla\MPG_Certificates\1.0
..
[3] V:\Packages\INT\Mozilla\MPG_Certificates\1.0
..
Show Currnt Dir
[4] V:\Packages\INT\Mozilla\MPG_Certificates\1.0
..
C:\cert-tool\certs\cert8.db
C:\cert-tool\certs\key3.db
C:\cert-tool\certs\secmod.db
        3 file(s) copied.
Press any key to continue . . .

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 7965
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Post by Hendrik_Ambrosius » 12. Jul 2008, 22:30

Ich glaube, das generell Problem ist, dass diese Aktionen im Systemteil des Pakets ablaufen. Da gibt es gar keinen User mit Profil oder wenn nur das Profil des EmpirumAgent-Users.

Also den Bereich SET:Installation mit Option CLIENT im Userteil des Pakets aufrufen:

#SET:Installation, CLIENT
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

MPI.EVA
Posts: 170
Joined: 19. Jun 2008, 15:40
Contact:

Post by MPI.EVA » 13. Jul 2008, 02:29

Hallo Herr Ambrosius,

ich habe die Setup.inf wie folge verändert


Code: Select all

#Set:Installation, DONTDELETE
#Set:Installation2, CLIENT

[...]

[SET:Installation]
AddMeter 50
cd "%src%"

;; copy configuration files and certificates to disk

[...]

[SET:Installation2]
Call "C:\cert-tool\cert.bat"
Diese Änderung bewirkt leider nichts. Die *.db Dateien werden weiterhin auf den Server kopiert und die Umgebungsvariablen ändern sich nicht

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 7965
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Post by Hendrik_Ambrosius » 13. Jul 2008, 09:41

Dann liegt es laut Log daran, dass diese Befehle nicht funktionieren:
cd "%USERPROFILE%\Application Data\Mozilla\Firefox\Profiles\*.default"
echo ..
cd [3]

Sie bewirken keinen Wechsel des Verzeichnisses.

Wahrscheinlich funktioniert das mit dem Wildcard im Zielpfad nicht?!
Habe es mal von der Kommandzeile bei mir probiert - dort geht es auch nicht mit "*".

Also bleibt als Option nur den Pfad wirklich zu ermitteln und gezielt dorthin zu springen bzw. gleich dorthin zu kopieren. Falls nicht anders möglich z.B. über ein in die setup.inf eingebettetes WSH/VBS-Script.
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

foedisch
Posts: 104
Joined: 16. Oct 2006, 10:53
Location: Leipzig
Contact:

Post by foedisch » 13. Jul 2008, 11:14

In der Kommandozeile kann man mit Wildcards arbeiten.
Auf einem deutschen System heißt der Pfad dann "%USERPROFILE%\Anwendungsdaten\Mozilla\Firefox\Profiles\*.default".

Besser ist, wenn wir hier als Pfad "%AppData%\Mozilla\Firefox\Profiles\*.default" nutzen. Dann funktioniert es sprachunabhängig.

Viele Grüße

MPI.EVA
Posts: 170
Joined: 19. Jun 2008, 15:40
Contact:

Post by MPI.EVA » 13. Jul 2008, 11:24

Hallo,

der Pfadwechsel mit Wildcard funktioniert auf meinen Windows XP ohne Probleme.

Code: Select all

C:\>
C:\>cd %USERPROFILE%\Application Data\Mozilla\Firefox\Profiles\*.default

C:\Documents and Settings\dennis_reinhardt\Application Data\Mozilla\Firefox\Profiles\9gsu0cut.default>
Was mich etwas stutzig macht ist folgendes:
Im Abschnitt "copy user *.db Files" [1] gelingt es der cert.bat Datei nicht in das Firefox Profil des Benutzers zu wechseln (siehe echo), aber dennoch werden die *.db Datein nach C:\cert-tool\certs kopiert. Der copy Befehl enthält nur den Zielpfad und als Quelle das aktuelle Verzeichnis.

Ich habe den Pfad zum FireFox Profil nun direkt angeben aber auch dabei zeigt mir die echo Ausgabe nur den Server Pfad.

User avatar
mniemann
Administrator
Administrator
Posts: 574
Joined: 25. Nov 2005, 17:03
Location: Mainz
Contact:

Post by mniemann » 13. Jul 2008, 11:50

ich habe da noch eine andere Idee.
Mozilla legt unter im Verzeichnis %AppData%\Mozilla\Firefox profiles.ini ab, in der die für den angemeldeten Benutzer vorhandenen Profile mit Pfadnamen vermerkt sind:

##############
[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=1
Path=Profiles/8t9p3fx8.default
#############

......
[Environment]
FProfile=%%%AppData%\Mozilla\Firefox\profiles.ini,Profile0,Path%%
........
[Product]
ReplaceEnv FProfile
Echo %FProfile%
Set FProfile=RemoveFromLeft ("%FProfile%", 9)
Echo %FProfile%
#Set:Product

[Set:Product]
....

Diese kleinen Zeilen erstellen eine Variable FProfile mit dem Wert des Namens des Profilverzeichnisses (in meinem Fall 8t9p3fx8.default ).

Die Variable %FProfile% kann innerhalb der Setup.inf verwendet werden.
Visit my Blog: "DiEW - Das inoffizielle Empirum Weblog" (http://www.diew.eu)

Martin Niemann
Manager Support (Service Management)

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of matrix42 AG or of the support team.

MPI.EVA
Posts: 170
Joined: 19. Jun 2008, 15:40
Contact:

Post by MPI.EVA » 13. Jul 2008, 12:26

Hallo Herr Niemann,

vielen Dank für Ihren Hinweis mit der FProfile Variable.
Ihre Variable wird in unserer cert.bat richtig ausgelesen nur mit %AppData% gibt es weiterhin Probleme. Die Ausgabe der Variable klappt nur ein "cd %AppData%" ist nicht möglich obwohl "Set:Installation2, CLIENT" gesetzt ist

cert.bat

Code: Select all

[1] echo %FProfile%
[2] echo %AppData%
cd %AppData%
[3] dir
Output:

Code: Select all

[1] 9gsu0cut.default
[2] C:\Documents and Settings\dennis_reinhardt\Application Data
[3] Volume in drive V is System
 Volume Serial Number is 1C51-0A8E

 Directory of V:\Packages\INT\Mozilla\MPG_Certificates\1.0_dennis

07/13/2008  12:08 PM    <DIR>          .
07/13/2008  12:08 PM    <DIR>          ..
07/13/2008  11:54 AM    <DIR>          cert-tool
07/13/2008  12:09 PM            65,536 cert8.db
07/13/2008  11:54 AM    <DIR>          Install
07/13/2008  12:09 PM            16,384 key3.db
07/13/2008  12:08 PM            16,384 secmod.db
               3 File(s)         98,304 bytes
               4 Dir(s)  182,660,116,480 bytes free

User avatar
mniemann
Administrator
Administrator
Posts: 574
Joined: 25. Nov 2005, 17:03
Location: Mainz
Contact:

Post by mniemann » 13. Jul 2008, 20:06

Es zahlt sich immer aus, ECHO-Befehle in die Setup.inf als "Debug"-Punkte einzubauen. Versuch doch mal in deinem CLIENT-Abschnitt 'Echo Clientteil' einzubauen. Wird das nun angezeigt (Setup.exe ohne /S aber mit /AW aufrufen!)
Visit my Blog: "DiEW - Das inoffizielle Empirum Weblog" (http://www.diew.eu)

Martin Niemann
Manager Support (Service Management)

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of matrix42 AG or of the support team.

MPI.EVA
Posts: 170
Joined: 19. Jun 2008, 15:40
Contact:

Post by MPI.EVA » 14. Jul 2008, 10:44

Hallo,

der Fehlerteufel mit der Variable %AppData% ist nun auch gefunden. Es lag weder an der Setup.inf noch an den Variablen.

Melde ich mich mit meinem Useraccount an der Domain an werden automatisch die Netzlaufwerke gemountet. Darunter auch "\\empirum\empirum\Configurator$" als Laufwerk V:\.
Ich habe immer die Setup.inf aus dem Ordner "V:\Packages\INT\Mozilla\MPG_Certificates\1.0\Install" auf die Setup.exe gezogen und jedesmal gab es Probleme mit der Variable %AppData%.

Greift man im Explorer direkt auf die Freigabe "\\empirum\empirum\Configurator$" zu und fuehrt darueber die Setup.inf aus, gibt es keine Probleme mit den Variablen.

Danke fuer Ihre Hilfe.

MPI.EVA
Posts: 170
Joined: 19. Jun 2008, 15:40
Contact:

Post by MPI.EVA » 14. Jul 2008, 23:30

...
Last edited by MPI.EVA on 15. Jul 2008, 09:57, edited 1 time in total.

MPI.EVA
Posts: 170
Joined: 19. Jun 2008, 15:40
Contact:

Post by MPI.EVA » 14. Jul 2008, 23:49

Guten Abend Herr Niemann,

wir verfeinern unsere Setup.inf gerade in folgende Richtungen:

- erkennen ob ein Firefox Profil vohanden
- Firefox Default Profil erstellen und standard Dateien kopieren

Folgende Probleme treten auf:

Die erste "If DoesPathExist" Abfrage bei [Set:Installation] funktioniert. Nach dem Wechsel zu [Set:CreateProfile] funktioniert das erstellen eines Profiles ohne Probleme aber der nächste Sprung zu [Set:CopyProfile] innerhalb der If Schleife wird nicht mehr ausgeführt. Das Setup springt direkt zu [Set:Installation2]

Desweiteren gibt es Probleme beim auslesen der Profilvariable. Da die Profil.ini beim starten des Scripts nicht exisitert, kann der Aufruf im Abschnitt [Environment] den Pfad nicht finden und alle weiteren Aufrufe von %FProfile% bleiben leer. Gibt es eine Möglichkeit die Variable später nochmal auszulesen [Environment2] ?

Setup.inf

Code: Select all

[Environment]
[...]
FProfile=%%%AppData%\Mozilla\Firefox\profiles.ini,Profile0,Path%%

[Product]
;#FileCheckMachine, MACHINE
;#FileCheckClient, CLIENT
;ReplaceEnv <Variable>
#Reg:ProductPreInstall

ReplaceEnv FProfile
Set FProfile=RemoveFromLeft ("%FProfile%", 9)

#Set:Installation, DONTDELETE
#Set:Installation2, CLIENT
#Reg:ProductPostInstall
#Set:Deinstallation, DELETE
#Security:Product
#Security:AddMember

[Reg:ProductPreInstall]


[Set:Installation]
Echo CheckProfile
If DoesPathExist ("%APPDATA%\Mozilla\Firefox\") == "1" Then "Set:Install" else "Set:CreateProfile" EndIf

[Set:CreateProfile]
Echo CreateProfile
;create new .default Firefox profile
CMD /C ""%ProgramFiles%"\"Mozilla Firefox"\Firefox.exe -CreateProfile default"
If DoesPathExist ("%APPDATA%\Mozilla\Firefox\Profiles\") == "1" Then "Set:CopyProfile" EndIf

[Set:CopyProfile]
Echo CopyProfile
Echo %FProfile%
AddMeter 25
cd "%src%\firefox.profile"

;copy .default Firefox profile files 
1:bookmarks.bak,									%APPDATA%\Mozilla\Firefox\Profiles\%FProfile%, CLIENT MACHINE,


[Set:Install]
Echo Installation
AddMeter 50
cd "%src%"

;; copy configuration files and certificates to disk
1:cert-tool\bin\atob.exe,                C:\, CLIENT MACHINE,   53264
1:cert-tool\bin\bltest.exe,              C:\, CLIENT MACHINE, 2732368
[...]

[Set:Installation2]
Echo Installation2
Call "C:\cert-tool\cert.bat"

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 7965
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Post by Hendrik_Ambrosius » 15. Jul 2008, 11:20

Ich vermute das kommt daher, weil SET:INSTALLATION im Systemteil des Pakets läuft und der Empirum-Agent-User kein %APPDATA%... hat.
Also einfach mit
#SET:Installation, CLIENT DONTDELETE
aufrufen.
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

MPI.EVA
Posts: 170
Joined: 19. Jun 2008, 15:40
Contact:

Post by MPI.EVA » 15. Jul 2008, 11:31

Hallo Herr Amrosius,

daran liegt es leider nicht. Die Variable %AppData% funktioniert im Abschnitt [Set:Installation]. Rufe ich das Setup bei bestehendem Firefox Profil auf, springt das Setup nach der Prüfung ordnungsgemäß zu [Set:Install]. Somit wird die Variable richtig ausgelesen.

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 7965
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Post by Hendrik_Ambrosius » 15. Jul 2008, 11:42

Dann kommt es dadurch, dass Sie die "CMD" nicht mit "CALL" aufrufen.
Dann stoppt das Script nicht so lange bis es wirklich das Zielverzeichnis gibt.
Also "CALL CMD.EXE ...".
Außerdem sieht der Kopierbefehl für bookmarks.bak weiter unten komisch aus: Bitte nur "CLIENT" und hinten dran noch eine Dateigröße oder "0":
1:bookmarks.bak, %APPDATA%\Mozilla\Firefox\Profiles\%FProfile%, CLIENT , 0
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

Post Reply

Return to “Paketierung”

Who is online

Users browsing this forum: Google [Bot] and 2 guests