forked from tudadesign/tudadesign
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInstall_for_MikTeX.ps1
80 lines (66 loc) · 6.16 KB
/
Install_for_MikTeX.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#Unterdrücke Fehlermeldungen des Systems
$ErrorActionPreference = "SilentlyContinue"
write-host "--LOADING FONTS--"
write-host "looking for fonts in current path"
if ((Test-Path tudfonts-tex_0.0.20090806.zip) -eq $True){
write-host "fonts found in current path"
$fontfile=(Get-Item -Path ".\" -Verbose).FullName + "\tudfonts-tex_0.0.20090806.zip"
}else{
write-host "ERROR: fonts not found" -foreground "red"
write-host "trying to download fonts"
$cl = new-object system.net.webclient
$cl.DownloadFile("http://exp1.fkp.physik.tu-darmstadt.de/tuddesign/latex/tudfonts-tex/tudfonts-tex_0.0.20090806.zip" , "tudfonts-tex_0.0.20090806.zip")
if ((Test-Path tudfonts-tex_0.0.20090806.zip) -eq $True){
write-host "downloaded fonts"
$fontfile=(Get-Item -Path ".\" -Verbose).FullName + "\tudfonts-tex_0.0.20090806.zip"
}else{
write-host "ERROR: fonts could not be downloaded" -foreground "red"
$DLfontfile = Read-Host -Prompt "Bitte Pfad angeben, in dem die Fonts heruntergeladen wurden:"
$DLfontfile = "${DLdirectory}" + "\tudfonts-tex_0.0.20090806.zip"
if ((Test-Path DLfontfile) -eq $True){
$fontfile = $DLfontfile
}else{
write-host "ERROR: fonts not found in path" -foreground "red"
Read-Host -Prompt "Press enter to exit"
Exit
}
}
}
write-host ""
write-host "--INSTALLING--"
$InstallDIR = "${env:programdata}"+"\tudadesign"
mkdir $InstallDIR
write-host "extracting fonts"
$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($fontfile)
$destinationFolder = $shellApplication.NameSpace($InstallDIR)
$destinationFolder.CopyHere($zipPackage.Items())
write-host "copying tudadesign"
$pfad = ((Get-Item -Path ".\" -Verbose).FullName)
Copy-Item $pfad\texmf* $InstallDIR\ -recurse
cd $InstallDIR
write-host "deleting texmf\fonts\map\dvipdfm"
rmdir /Q /S "texmf\fonts\map\dvipdfm"
write-host ""
write-host "--CONFIGURING--"
mo_admin
write-host "---------------------------------------------" -foreground "yellow"
write-host "| IMPORTANT |" -foreground "yellow"
write-host "| |" -foreground "yellow"
write-host "| 1. go to the ROOTS tab |" -foreground "yellow"
write-host "| 2. click ADD |" -foreground "yellow"
write-host "| 3. select C:\PROGRAMDATA\TUDADESIGN\TEXMF |" -foreground "yellow"
write-host "| 4. click OK |" -foreground "yellow"
write-host "| |" -foreground "yellow"
write-host "---------------------------------------------" -foreground "yellow"
start-sleep -s 2
Get-ChildItem $env:APPDATA"\MikTeX" | ForEach-Object {
$pfad = $_.FullName
write-host "editing "$pfad"\miktex\config\updmap.cfg"
$nl = [Environment]::NewLine
"Map 5ch.map"+$nl+"Map 5fp.map"+$nl+"Map 5sf.map" | Out-File $pfad"\miktex\config\updmap.cfg" -encoding ASCII
}
write-host "making maps"
initexmf --mkmaps
write-host "installation successfull" -foreground "green"
Read-Host -Prompt "Press Enter to Exit"