Schriftenpaket

Antworten
Kay96
Beiträge: 85
Registriert: 06 Dez 2018, 09:23

Schriftenpaket

Beitrag von Kay96 »

Hallo,

hat schon jemand Erfahrungen damit gemacht, Schriften bzw. ein Schriftenpaket per Opsi zu verteilen?
Ich habe mich mal in älteren Beiträgen umgesehen und versucht die "Lösungen" zu überarbeiten und zu testen, aber bisher blieben die Versuche erfolglos.

Bei uns wurde früher mal ein Schriftenpaket für Opsi gebaut, hierfür wurde ein MSI erstellt, das dann über Opsi installiert wurde. Diese Lösung finde ich aber sehr umständlich, falls dann doch mal eine Schrift hinzugefügt werden muss.

Mir wäre am Liebsten, wenn die Schriften im Ordner CLIENT_DATA\Fonts liegen und anschließend über ein Skript an C:\Temp verschoben werden und von dort aus installiert und registriert werden. So kann man beliebig Schriften hinzufügen und muss nur noch eine neue Version des Pakets erstellen.
Verwendet werden sollen im Prinzip nur lizenzfreie Schriften, sodass keine Abfrage erfolgen muss.

Bisher habe ich folgendes gefunden und versucht zu testen.

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

[Actions]
requiredWinstVersion >= "4.11.2.6"

DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$ 
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $InstPrg$
DefVar $TmpPath$

Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "fonts"
Set $MinimumSpace$    = "10 MB"
; the path were we find the product after the installation
Set $InstallDir$      = "%ProgramFiles32Dir%\Schriftenpaket"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
Set $InstPrg$         = "FontReg.exe"
Set $TmpPath$         = "%Systemdrive%\temp"
; ----------------------------------------------------------------

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
   LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
   isFatalError "No Space"
   ; Stop process and set installation status to failed
else
   comment "Show product picture"
   ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
   
   if FileExists("%ScriptPath%\delsub32.ins")
      comment "Start uninstall sub section"
      Sub "%ScriptPath%\delsub32.ins"
   endif
   
   Message "Installing " + $ProductId$ + " ..."
   
   if $LicenseRequired$ = "true"
      comment "Licensing required, reserve license and get license key"
      Sub_get_licensekey
   endif
   
   comment "Start setup program"
   Files_install
   DosInAnIcon_do /64Bit
   Files_uninstall   

endif

[Files_install]
copy %ScriptPath%\fonts\* $TmpPath$\fonts

[DosInAnIcon_do]
cd $TmpPath$\fonts
$InstPrg$ /copy

[Files_uninstall]
del -sf "$TmpPath$\"

[Sub_get_licensekey]
if opsiLicenseManagementEnabled
   comment "License management is enabled and will be used"

   comment "Trying to get a license key"
   Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
   ; If there is an assignment of exactly one licensepool to the product the following call is possible:
   ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
   ;
   ; If there is an assignment of a license pool to a windows software id, it is possible to use:
   ; DefVar $WindowsSoftwareId$
   ; $WindowsSoftwareId$ = "..."
   ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
   
   DefVar $ServiceErrorClass$
   set $ServiceErrorClass$ = getLastServiceErrorClass
   comment "Error class: " + $ServiceErrorClass$
   
   if $ServiceErrorClass$ = "None"
      comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
   else
      if $ServiceErrorClass$ = "LicenseConfigurationError"
         LogError "Fatal: license configuration must be corrected"
         LogError getLastServiceErrorMessage
         isFatalError
      else
         if $ServiceErrorClass$ = "LicenseMissingError"
            LogError "Fatal: required license is not supplied"
            isFatalError
         endif
      endif
   endif
else
   LogError "Fatal: license required, but license management not enabled"
   isFatalError
endif
d.haberland
Beiträge: 46
Registriert: 27 Sep 2017, 16:47

Re: Schriftenpaket

Beitrag von d.haberland »

Hallo Kay96,

ich hab auch mal Fonts über Opsi installiert und über die Setup.ins ein PowerShell Skript ausführen lassen.


Zuerst habe ich über das PowerShell Skript die Dateien in Windows Fonts Ordner Kopiert und dann per Registry die Fonts Aktiviert

Code: Alles auswählen

copy "C:\temp\fonts\fontpaket\[b]FONTNAME[/b].ttf" "C:\Windows\Fonts"

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "[b]FONTNAME[/b] (TrueType)" /t REG_SZ /d "[b]FONTNAME[/b].ttf" /f
in der Steup.ins musst du (Glaub ich) bevor du die PowerShell Datei ausführst

Code: Alles auswählen

[Dosinanicon_enable]
powershell.exe Set-ExecutionPolicy Bypass
powershell.exe Get-ExecutionPolicy
benutzen. Ich bin mir nicht mehr 100% Sicher dies war glaub ich für die Rechte. powershell.exe Get-ExecutionPolicy müsstest du ausprobieren das hab ich evtl. damals für die Logs benutzt damit ich sehe das er das gemacht hat.

In letzten Teil der Setup.ins hab ich dann die ExecutionPolicy zurückgesetzt.

Code: Alles auswählen

[Dosinanicon_disable]
powershell.exe Set-ExecutionPolicy Restricted
powershell.exe Get-ExecutionPolicy
Kay96
Beiträge: 85
Registriert: 06 Dez 2018, 09:23

Re: Schriftenpaket

Beitrag von Kay96 »

Hallo d.haberland,
danke für die schnelle Antwort.
Die Idee mit Powershell ist wirklich gut (hab ich garnicht drüber nachgedacht).
Der Get Befehl wird sicherlich für die Logs gewesen sein, den könnte man dementsprechend weg lassen.
Ich würde wahrscheinlich auch den letzten Teil weg lassen, da ich Bedenken hätte, wenn Rechner bei uns Powershell Skripte nutzen, dass diese später nicht mehr funktionieren.
Eventuell könnte man vorher auch eine Abfrage machen, sodass Rechner nach der Installation wieder Ihre ExecutionPolicy bekommen.

Ich werde die ganze Sache mal probieren!
ineedhelp
Beiträge: 12
Registriert: 07 Nov 2019, 08:56

Re: Schriftenpaket

Beitrag von ineedhelp »

Hi,

falls daran noch wer Interesse hat: Ich hab' das mit dem Aktionsprozessor gelöst:
Beginnend als vereinfachung der Pfad zu der/den Schriftarten:

Code: Alles auswählen

DefVar $FontsSourceDir$
set $FontsSourceDir$ = "%scriptpath%\Fonts"
Im Anschluss dann unter [Actions] "Files_FontsCopy" und die Registrationseditor abfrage "Registry_Add_Font_Propertys" gesetzt:

Code: Alles auswählen

Files_FontsCopy
Registry_Add_Font_Propertys /64bit
zu guter letzt, natürlich noch die Verweise angeführt:

Code: Alles auswählen

[Files_FontsCopy]
copy -s "$FontsSourceDir$\*.ttf" "C:\Windows\Fonts"

[Registry_Add_Font_Propertys]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
set "Lato Black (TrueType)"=REG_SZ:"Lato-Black.ttf"
(Mein beispiel hier mit der schriftart Lato Black als TrueType)

Es werden dabei alle Schriftarten endend mit *ttf (TrueTypeFont) ins Zielsystem Kopiert die sich im Verzeichnis "%scriptpath%\Fonts" befinden.
Für jede Schriftart muss allerdings ein "REG_SZ" gesetzt werden.

Beste Grüße
ineedhelp
Benutzeravatar
SisterOfMercy
Beiträge: 1522
Registriert: 22 Jun 2012, 19:18

Re: Schriftenpaket

Beitrag von SisterOfMercy »

ineedhelp hat geschrieben: 04 Jan 2024, 10:13

Code: Alles auswählen

[Registry_Add_Font_Propertys]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
set "Lato Black (TrueType)"=REG_SZ:"Lato-Black.ttf"
Just don't bother with that. Use FontReg. So much easier when you have a shitton of fonts.
http://code.kliu.org/misc/fontreg/
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Antworten