summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cdf177d1d9f8e95a529b97320a0239fea87b7589 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# Maintainer: Loryeam <loryeam aaaatttt gmail ddooottt com>
# Maintainer: Christopher Snowhill <kode54@gmail.com>
# Contributor: Vaporeon <vaporeon@vaporeon.io>
# Contributor: Zepman <the_zep_man@hotmail.com>
# Contributor: Michael Lass <bevan@bi-co.net>
# Contributor: Doug Newgard <scimmia at archlinux dot info>
# Contributor: reflexing <reflexing@reflexing.ru>

# Instructions were copied from ttf-ms-win10-auto and slightly modified:
#
# BUILD INSTRUCTIONS:
# -------------------
#
# Please note, that usage of Microsoft fonts outside running Windows
# system is prohibited by EULA (although in certain countries EULA is invalid).
# Please consult Microsoft license before using fonts.
#
# This PKGBUILD attempts to download fonts directly from Microsoft, by
# retrieving selective parts of the Windows 11 Enterprise 90-day evaluation
# edition. This only works if the user is allowed to mount filesystems through
# udisks2. This is determined by Polkit, which by default only allows users to
# do this when they are logged in locally (e.g. not through SSH).
#
# If it is possible to download fonts directly, around 200 MiB of data will be
# downloaded. Downloading the fonts this way can take 8-20 minutes, even on a
# fast connection. Be patient. Note that for this method, it is necessary to
# mount an HTTP source and an ISO file as a loop device using FUSE. If the
# build fails, it might be that these must be unmounted manually. This can be
# done with:
#
#  $ udisksctl unmount -b /dev/loopX
#  $ udisksctl loop-delete -b /dev/loopX
#  $ fusermount -uz src/mnt/http
#
# Replace /dev/loopX with the relevant loop device, which is reported during
# package build. If it isn't reported then loop device creation is not yet
# finished and it errored out due to timeout. It usually happens due to slow or
# inconsistent network. In such a case, you can do one of the following:
#  1. wait for the loop device to be created and run the above commands, or
#  2. just run the above 'fusermount' command (doing this might leave redundant
#     loop devices which can be later removed with a simple system reboot);
# and then try building the package again.
#
# A file integrity check is performed after download. Due to the unconventional
# way that the data is downloaded, the verification is done in prepare().
#
# This package uses HTTPDirFS with permanent cache. Due to this the maximum
# download speed is around 15MiB/s. To disable cache, find and remove the
# '--cache' option from httpdirfs. Read more about HTTPDirFS permanent cache
# here: https://github.com/fangfufu/httpdirfs#permanent-cache-system
#
# If fonts cannot be downloaded directly, the ISO fill will be fully
# downloaded. Due to that install.wim will be extracted from the ISO, it is
# assumed that twice its size (almost 8 GiB) is necessary as temporary disk
# space. A free disk space check is performed before the ISO is downloaded.
#
# Please ignore any 'ln' errors when building this package. This is expected
# behavior.
#
# If for some reason you want to download the full ISO file, please visit:
#
#       https://www.microsoft.com/en-us/evalcenter/evaluate-windows-11-enterprise
#
# This package is based on ttf-ms-win11. Use that package if font files from
# a local source need to be used.
#
# ttf-ms-win11 and ttf-ms-win10-auto are considered to be upstream for this
# package, which is why its maintainers and contributors are added as
# contributors to this package. Without their effort this package would not
# exist, nor be updated.
#

pkgbase=ttf-ms-win11-auto
pkgname=($pkgbase{,-japanese,-korean,-sea,-thai,-zh_cn,-zh_tw,-other})
pkgver=10.0.26100.1742
pkgrel=1
arch=(any)
url='https://www.microsoft.com/typography/fonts/product.aspx?PID=164'
license=(custom)
provides=(ttf-font ttf-ms-win11)
conflicts=(ttf-vista-fonts)
makedepends=(udisks2 p7zip httpdirfs)

# URL of ISO file from which to extract the fonts.
_iso="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1742.240906-0331.ge_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"

_ttf_ms_win11=(
########################################################################################
# Normal         Bold          Italic        Bold+Italic    # Full name                #
########################################################################################
arial.ttf      arialbd.ttf    ariali.ttf     arialbi.ttf    # Arial
ariblk.ttf                                                  # Arial Black
bahnschrift.ttf                                             # Bahnschrift
calibri.ttf    calibrib.ttf   calibrii.ttf   calibriz.ttf   # Calibri
calibril.ttf                  calibrili.ttf                 # Calibri Light
cambria.ttc    cambriab.ttf   cambriai.ttf   cambriaz.ttf   # Cambria
Candara.ttf    Candarab.ttf   Candarai.ttf   Candaraz.ttf   # Candara
Candaral.ttf                  Candarali.ttf                 # Candara Light
comic.ttf      comicbd.ttf    comici.ttf     comicz.ttf     # Comic Sans MS
consola.ttf    consolab.ttf   consolai.ttf   consolaz.ttf   # Consolas
constan.ttf    constanb.ttf   constani.ttf   constanz.ttf   # Constantia
corbel.ttf     corbelb.ttf    corbeli.ttf    corbelz.ttf    # Corbel
corbell.ttf                   corbelli.ttf                  # Corbel Light
cour.ttf       courbd.ttf     couri.ttf      courbi.ttf     # Courier New
framd.ttf                     framdit.ttf                   # Franklin Gothic Medium
Gabriola.ttf                                                # Gabriola
georgia.ttf    georgiab.ttf   georgiai.ttf   georgiaz.ttf   # Georgia
#holomdl2.ttf                                               # HoloLens MDL2 Assets
impact.ttf                                                  # Impact
Inkfree.ttf                                                 # Ink Free
l_10646.ttf                                                 # Lucida Sans Unicode
lucon.ttf                                                   # Lucida Console
marlett.ttf                                                 # Marlett
micross.ttf                                                 # Microsoft Sans Serifc
pala.ttf       palab.ttf      palai.ttf      palabi.ttf     # Palatino Linotype
segmdl2.ttf                                                 # Segoe MDL2 Assets
SegoeIcons.ttf                                              # Segoe Fluent Icons
segoepr.ttf    segoeprb.ttf                                 # Segoe Print
segoesc.ttf    segoescb.ttf                                 # Segoe Script
segoeui.ttf    segoeuib.ttf   segoeuii.ttf   segoeuiz.ttf   # Segoe UI
segoeuil.ttf                  seguili.ttf                   # Segoe UI Light
segoeuisl.ttf                 seguisli.ttf                  # Segoe UI Semilight
seguibl.ttf                   seguibli.ttf                  # Segoe UI Black
seguiemj.ttf                                                # Segoe UI Emoji
seguihis.ttf                                                # Segoe UI Historic
seguisb.ttf                   seguisbi.ttf                  # Segoe UI Semibold
seguisym.ttf                                                # Segoe UI Symbol
SegUIVar.ttf                                                # Segoe UI Variable
SitkaVF.ttf                   SitkaVF-Italic.ttf            # Sitka
sylfaen.ttf                                                 # Sylfaen
symbol.ttf                                                  # Symbol
tahoma.ttf     tahomabd.ttf                                 # Tahoma
times.ttf      timesbd.ttf    timesi.ttf     timesbi.ttf    # Times New Roman
trebuc.ttf     trebucbd.ttf   trebucit.ttf   trebucbi.ttf   # Trebuchet MS
verdana.ttf    verdanab.ttf   verdanai.ttf   verdanaz.ttf   # Verdana
webdings.ttf                                                # Webdings
wingding.ttf                                                # Wingdings
)

_ttf_ms_win11_japanese=(
#########################################################################################
# Normal         Bold          Italic        Bold+Italic    #  Full name                #
#########################################################################################
msgothic.ttc                                                # MS Gothic
YuGothR.ttc   YuGothB.ttc                                   # Yu Gothic
YuGothM.ttc                                                 # Yu Gothic Medium
YuGothL.ttc                                                 # Yu Gothic Light
)

_ttf_ms_win11_korean=(
#########################################################################################
# Normal         Bold          Italic        Bold+Italic    #  Full name                #
#########################################################################################
malgun.ttf     malgunbd.ttf                                 # Malgun Gothic
malgunsl.ttf                                                # Malgun Gothic Semilight
)

_ttf_ms_win11_sea=(
#########################################################################################
# Normal         Bold          Italic        Bold+Italic    #  Full name                #
#########################################################################################
javatext.ttf                                                # Javanese Text
himalaya.ttf                                                # Microsoft Himalaya
ntailu.ttf     ntailub.ttf                                  # Microsoft New Tai Lue
phagspa.ttf    phagspab.ttf                                 # Microsoft PhagsPa
taile.ttf      taileb.ttf                                   # Microsoft Tai Le
msyi.ttf                                                    # Microsoft Yi Baiti
monbaiti.ttf                                                # Mongolian Baiti
mmrtext.ttf    mmrtextb.ttf                                 # Myanmar Text
Nirmala.ttc                                                 # Nirmala UI
)

_ttf_ms_win11_thai=(
#########################################################################################
# Normal         Bold          Italic        Bold+Italic    #  Full name                #
#########################################################################################
LeelawUI.ttf   LeelaUIb.ttf                                 # Leelawadee UI
LeelUIsl.ttf                                                # Leelawadee UI Semilight
)

_ttf_ms_win11_zh_cn=( # Chinese (Simplified)
#########################################################################################
# Normal         Bold          Italic        Bold+Italic    #  Full name                #
#########################################################################################
simsun.ttc                                                  # NSimSun
simsunb.ttf                                                 # SimSun-ExtB
msyh.ttc       msyhbd.ttc                                   # Microsoft YaHei
msyhl.ttc                                                   # Microsoft YaHei Light
)

_ttf_ms_win11_zh_tw=( # Chinese (Traditional)
#########################################################################################
# Normal         Bold          Italic        Bold+Italic    #  Full name                #
#########################################################################################
msjh.ttc       msjhbd.ttc                                   # Microsoft JhengHei
msjhl.ttc                                                   # Microsoft JhengHei Light
mingliub.ttc                                                # MingLiU_HKSCS-ExtB
)

_ttf_ms_win11_other=(
#########################################################################################
# Normal         Bold          Italic        Bold+Italic    #  Full name                #
#########################################################################################
ebrima.ttf     ebrimabd.ttf                                 # Ebrima
gadugi.ttf     gadugib.ttf                                  # Gadugi
mvboli.ttf                                                  # MV Boli
)

DLAGENTS=('http::/usr/bin/true'
          'https::/usr/bin/true'
          'file::/usr/bin/true')

source=("$_iso"
        "${_ttf_ms_win11[@]/#/file://}"
        "${_ttf_ms_win11_japanese[@]/#/file://}"
        "${_ttf_ms_win11_korean[@]/#/file://}"
        "${_ttf_ms_win11_sea[@]/#/file://}"
        "${_ttf_ms_win11_thai[@]/#/file://}"
        "${_ttf_ms_win11_zh_cn[@]/#/file://}"
        "${_ttf_ms_win11_zh_tw[@]/#/file://}"
        "${_ttf_ms_win11_other[@]/#/file://}"
        file://license.rtf)

_sha256sums=('74d696e666f696e93db685a85c94bfbfcc0796dfcf8a2e2e2e2c908a54e82949'
            '9e77165c7bfb4a5436f1ab683f1592bb2a9826e15aecad8dc9ed278ce03e8882'
            '6ac9e0ec4d55bfa29e16a7b74e9109efb344bff80d87cc664e1af63bd6c45f94'
            '02d374333edc09827f8b6afb4b95be63317418c2270574dc6579cdc0df698553'
            '10df702864b1f89cb29ba0d6b97c04228338d16807e13e8d8c74b91aba5e5f23'
            'eaad201da94cb323401fdb8cc760650803ddf8fd704cb9fa56317e6c69bc6fd6'
            'df2c69a18a462e5cbc97d04a033f3bd7cd0abfe818381641f8c2dee7b7c43dbd'
            '5e8b2eb430f543eb304f08f44f5eb02ccbc39ffdc95400aae96f5dcd2aea73d8'
            '21390a7e84b61224916e810fd00344ad9ad4f1d9115151a551845a4387d20b10'
            'b699a59faad65272ee48a4d118d6bc743d4cc4ba338cb1c6347deec58aa1e1a0'
            '744d3ec1b277e3652ba8f8d45c89f83c99b7ecf3eb2dfa27306d7be56d3ee030'
            '67ac784ac390f6c48119e76f9e34589f9a86b8974f561a6159545b858ab4cd41'
            '84e70ccc1664482f4a960442c7a166c91a1b2cf98ff88c33cb73f79403f66d7b'
            '6685c657a7e292083e28f19bbf1a1e90509ce3e1130dbc4ed1c62ba3f9140543'
            '6905f0ac846d1ec4326cd14a46cb7379204940aa293b098ee4c1a69723bbd165'
            'fa90f376ad37f308a819b341c8185f788d30a1012829278592eab45a41818d1a'
            '002c1e3378d02ed7dbdb3df1c94d433413a56f3f2f3aa8315a57720ee851dc45'
            'ec0dce5170aaaf2cf485d4ba39d86fbba1dd1c76d9140cbf75a6b84b50fb20de'
            'c165dbbc35bbf1fefae865c3e6b02404c8d182074fe04e78e221bab7d35ce3f8'
            'a873581d9f0886441bd45c5e425a734e86e063ef583b9cf8081b1aa03b871f1c'
            'c35742957794a81b6c73aa43d2f19e3d3d0c45a6dafbc2efcddd04ad6b3aeac8'
            'ff22b2841bc0aa0664b50c9215e8440f1da4f74bedd27ab33865f63f433b2681'
            'fc7fbc3fb456a363f1f719b0ec62ae093c78124bb6da046006ae7e217a6b8575'
            '128fdcfdfdd358e1624c15dd1f84a4d0689e59afcdefb81f8105efb2253b9c00'
            '872cdefea79e25ff1a8a814109593c23ed66ba46f5bb843815d49e1ab4e0be3c'
            '36eb300a76582b7d39f3d34834ce1255f0b9b2830fb2e81485c4b85a5ff7f03b'
            'c6e6ce8119fdd47ec6a5449a08e2d2ad7f41ea03143aae193068ed9fa58eaebc'
            '8fa803e5abc7fff0c78c62cd22d07c705f3273c53312380c36ff484246ed3c1b'
            '81e2a95d3c49468029c07e58f71a5f0ca4cfcb617eaf6bd77576fb03aa430bb2'
            '1df27cbcc8a9fb7f843bc24e257b78e8ff93de70e8c1ad2caab8379e7d6a1eab'
            '495577bf8ef74deab6ecc2e7acf63cd966184148f9bc2044a1068cd58501577e'
            'b6c66a1858370fe575629e19d53c05350738bf5105e18ceac07fe9efc9cd008d'
            '2314a03c53506fa79525bc479ea4be9c036d1ebd86a1ffb5837ca5b43ff51f07'
            '9311aadcbd919746f50d222fa0215fb44266d6993221c14a196f0725fdae464f'
            'a183b77b655df66793639af7874828fb50f748dc4af57ae40f758156f7f34634'
            'fa008372f8a94945d0daef9daf0bfb9e3fba3a25fd17f2607d47ac6861bd0303'
            '9be778c9ed418770f6b5a02064d9c0b47a8fdea1137618f0bec9ac4072430a45'
            '588f090ae3a6d31370457312683d14ee3a5bfbdaaa0a070b7c80225b55b23e78'
            '0e36ddf90102e476c6739ca4c8cc18ba8309d880c12558981d2e4d42de78fc00'
            'a031500bccd32b5d6e819699b774fc679c696ed4965b643d51a94eb398475550'
            '6aab1f79264ccda1e7129dba62dbe3750b10eaa27408a327dadb808724e62c84'
            'e376f24c9f27eb7370b25aa366d78da731834a1aea651858801c9a14e8906943'
            '546406ddbb3e3f6b876a5e8a5dee62ac090d1448662e98d8844b22393813dd13'
            'ac3b362cf998eb33475655e12ab7cb2f6a35d1f2eff6f76af00ebb6f81c53ee7'
            'bac844bd41f847cf138737026d41c983387a1065535c32e78aa22c48708b52ad'
            'df59f9ea915957b22a389d68580bf40dc5bd05822cc65b5fdcc188c706a694e7'
            'ddd852f9e43a5e81af62a3f6654324ba7553d7d66101ab848abc1bd2d626ac4b'
            '38dffcaf1fac89492f7c56c600a14daf36ae42f7c21985cd4134ae113124a58f'
            '72a6cd94fab6c179392075d3fb361e269cdddfad41bb7ab385fa22a37e49a900'
            'd3e4bad27651d120ac8f2cea42cf4b4f077264fb243f66b3caffcfd35465f49b'
            '3f9e512f82eaf6f1b7869b82013fb79f6eaf1a41e75a0e7b96f31f35b1022ae4'
            'd8bbdb72e3f930157824b2e59677d3a912d4512c14a948e6656a2e3fb0c935ad'
            'c8ab96bc49ec1dc36936b5973fc143ca222c1a33ab27b87071a3bbc44d34ca9a'
            '97226e81f19eff8c8fb191745748bab920472c005d3ec4e23d9a50a12c471d92'
            '2ca2cfde263fa420e8d39420f075ee9ac80bc0794272c53ac4571a88f8a075a6'
            'b7397adf2dcc24ca790348a3c26deb2122b45e5728fd25fc588de4cf5a75b469'
            '9621f0043b451d266255ac6229e729d476b76dd908635924f0bcdc4bb6719de1'
            'e47d594e2e2bc31b28f87b6f66483d32f925843ceb002f919c7a403aca48813d'
            '8e14668bbae03f78ed668dbe3261218881960dcd9fb80ad6c1d1dfb4226a57c3'
            '99f0af2d1941707fecda23da38bafbed5144a73a3720d773c05b9d4c445920ed'
            'd0e722b91ffd5391cc2e7d6e976f274d5aee9fe0b8d0fedfffe093763e695cde'
            'a2efc8b8e51fbd031a7142a1ade8866fa904c0c349511abc579ee53f8a926f31'
            'eca6e631fc5d3bb7369b1e73af062a9b91831d1e1098f230020ab7fee962eb14'
            '91046862e08fbade0bdd648e81c4efbe6a963947f8b6e32b64a28fe39073c468'
            '3cced0162ddb9e5f1e63ee1b36fd6e581c090318dce1a0af01b77f5ea9952c80'
            'b24aa49a4bcb99a0ffc60cad77f00941e4b121153d8b0a519c03719d9be6004e'
            '6cd482205e1390b32a2b6327e1e5039424e346172c187074eac12006bc51935e'
            '73db31e13ef5151beb6a5272cff4c6de6ae2f0bbc3688f4046e5e63593f9953a'
            '34ed88e3895e0d6b17c862014b6ba4fc0113ec007453de3edf72619150cf4d2c'
            '9bdc0241dc3a37ee8b23468ec14d875bd9b94939a3cfefb635d02718a7c2f00f'
            '4ce2a8f4ceb2058b01e073fab23991dcfdba76b9266283496b56484d8984c289'
            '3c574f3990c94e13823a6a9ed32fe42969181b8c707f7d949702ddbb068d1359'
            '09bff29e9a15ab35e9b31390b1174fe495e8a1aa79ee7a45f2bed92b5374bbac'
            '0d7c47ad801fcfe8ab61353a39a076369fcdba46bb53212b1b104147609d2aa0'
            'e7921e223e51281fe9e793133aba8bff0b3065b94818fc8c416e8598dde9b613'
            'e17738f092c8b02f4443867a7dfcdde66fb4cd6f6b10de8e40b2f3192f8a5835'
            '33212faa85fad61785cd6917172378b798bc9f5d4c47c121437354f47980aa6f'
            '12c5253251f45c57fa57e2a1c748f821d3ca030a3e757e049a5da6316f213bcb'
            'a162ceeaf701b55d11c542daf1c39c52bfaf686496505bff2eb75ca24814c136'
            '5a7421ef8999c70e960b79d5806a96cd1a35349e759123e07b83631c80df398e'
            'ac45cce4abfdd8aba8498c2120795f5027e4ebf44a7b6f0b53f4609c8547f6ee'
            'a4a35dcc62cd30e1a6c97b695ecef83e59d2b149e3af834f6a49f11851d56b37'
            '27ca1ab4bd5ad3b0404ee6a9a03b143408dbd7e5a4c9e4b2054639c03fc0f682'
            '9f71aabf76ccc757d25e18801d6a37e45cacc8b74c8b42a19e9f36ca99eef594'
            '74d4b98aabe85e16cb2fa6583c93f9f17642234d030a38462c36d1bcdde65928'
            'ac278d932d59558a76817e98051b1dae53867aa81ad83e5198b1b4c4b8066a08'
            'bbf1192965e5266fbf23370416337d2861fc1e8bd349def93f2994ba67382fc3'
            'dbccddcd68ffa5f9e4d2b9f8ca2507145e0c1f02f8f03298cb1f6281fe3ad12e'
            '13187d9b4746c442e0b0050809038fc78a23607c812baf612c07246e1ecbb8de'
            'f2cb777422a10368904d3f691e650e39da862fe723389056324927df540a35ec'
            '85b680fc9d8fee549191dc823f31d777b37181d298b470bd615cf066920a4a51'
            '4b6d2004937d292f183af258c27d7f7f931783ad0e03d441822768dc02145ded'
            'ffb7862e680bfa5967a4ed34d0cdd2b01417e9c698e8d0dc1fcc5302e3f26dbf'
            'fe3e8bdd64c1c9f3b9cf5189d06510c80d72cec28e03d04bffc560f77eec58d1'
            'dfcc306777a594d2815368547dd897e2ac82aff8073e55d9e682569939e49b81'
            '9c9dc0cd0fd6b1a06e8f406d04bb15a88aaf20328d3e166c12d6bc7994b781d2'
            '87942234ab0cc4400088648bef8d1f7afc4c44e676c7ed6b32ca31462c18307d'
            '6a8481fe107ee547893c018b13dba291c2020bec3de5da6525d9ac09f6bc2105'
            'f3245f5f38f61bd1ceefb0f1338a5b88a21e6220832c2f43a38bbc7e1547c36f'
            '14f2ebcdaa1b77e5993a8533662e4bd3ebfe2c5771b6daafd8ccb39b2ad588b9'
            'd71f81c83ec63eaa32d36d5df7be1d9e71d3ea9150f47cebda2924923cbbf18a'
            '67461fabd8329d0d8ad62689cac642b34fac81c754ff9077ad211160ec62282d'
            '9bcd6064e3b52fa30a347edd6e82506e2ec8b1602930b423c629a82c10468a5b'
            '4bde3e6392b96910fb59094c6c1a4dbfae18fee78d0bf13dc30616837c4f95db'
            '599ae7ecd382254ec077661c6cac1ff98e559c7f1948cf1bea18d0b62ac2ab3e'
            '9d0437d151ddd907d72ba9ba348d670575a86e4f5cbf018de18645f2353140e5'
            '7de36ce08c41514f0ea1a25681dca833353eed5b07b5d1b056af46cee3e2cb22'
            '95392428a804b937919526fec91bab64200664f7f22f777211da6bb244988f56'
            '7a183cf1c6c56b9609fcc16eda8b5229fbc11758a21e669ec00343239b02192f'
            'e8cbc0b2afcc14fb45dfb6086d5102c0b23a96e7b6e708f3122acde1b86c9082'
            'c0ca810a242c4482594182db40f0f9d35a3d51bb2eeac750e6e867b2110eb00e'
            'df8d94382f73e6d2197b60653c3d55c28ab5cf127a82e65b8af4ed1b52fdc412'
            'fdec3a7efacd57913d3c14111837908ccbabea5b0b44ec62527eb73acf743afb'
            'de0b632015447f28c2db41c8e07c745cedb05ead5dbc2e73f19da14d2e5f2151'
            'cfc2acbf9ae0205a0a258e564bdbf5466a4e49a95281a1d2e72690f149ec837b'
            '538949482d964e9f353a3a8d860bb3eda93b46b830f3b677e4f53eb2ff3a6e7d'
            '03e4e45bb8ebb6d055a5584166cc26712bf7e746ea29cb6e548341361d31dc85'
            'f5151d081f6afea4c26464e0cd5e695f57a99209cfeea2f483c3108684660eb6'
            '1878842d8dbdf8489794af0bace95a956db270dfa506ddcaabf94fa827b769ac'
            '80aef1c25135b945e9de7d09e6445c386405eb2e0ea7032d4cd00a2fe3eef0ae'
            '707585b9acfc1507d9bd943bb5435f75768274b1a12b1f71de76ad78be4d7e7b'
            '289bfc7da2a20102b0e00bc86d939cc1e3a41b2492bf61f87acdc49a493cb748'
            '8b20b869b1fb1ab26b8e7b90e28a34a575a097c41662a9f17cd9875e2688eaa3'
            'ad02cdfc06e144ac45f318e8e5a64cbe04c7479d4beb91d25f5a319a466b1767'
            '796dc7e97b357f9c2ad10044d01a86d3fb49cf80e3693011eb055c466c995de0'
            '16d0c83e99ca3cd56a85966c4ff2c5f0c0f8a5a7140a7594b2ec3e404c8e96a0'
            '2e2fabd71aa30f0d7039b879ee58441a791e095a6656064eb9d4a84a071e5e8f'
            '05068fa1acae212120dcc7e98c884b174a6eca252a636b4b64030235473ec27e'
            'a67e70adce24390c43a0c5dfc0856dc81660e91489db930999aa0973780e8a67'
            '3084f1f88369af6bf9989c909024164d953d1e38d08734f05f28ef24b2f9d577'
            '519309b7ab0479c4dc3ace5e291de5a8702175be5586e165bc810267bd4619a5'
            'f25f39a6d56ec6d1b356254dd776219d71b7e6f3584b3ec1b83aab0ceb08881a'
            '1fd5fc7046e0eea753988ee06d1a5a731df68475614e2174fbba9b4800f392ac'
            '7d55cd4801102131d991630cea74534dcf73a9fabf4a33e54fe05dfb4f5aa790'
            '15f1162a68b5859f246d89ea62aed711b1994817c72e78e3df5d205c89c5c6e8'
            '8f8afdb3ec7047118f6dc51b29d395e697ee6770d0afd0cd407457e2ad6e93cb'
            '1dcd304f0ba642dbc3c3f3ccb70c24e9fad7ada2e2d5d0061c7cacab86e8df92'
            'a7bc75937950d0f217f79313631d81f5b92459c414a4099d6ea3c0c0262a716b'
            '0ec2bdbfc2ba99d9fb05b6f7c511e7ab8b7c055e2d644570ad777455d6e9796d'
            'c96226cba7f50e94b534a5f8ade6a54f48a03be7c73360524eda5cbce4de34b6'
            '5dfd7a4c708caeefae42cdb9540946de042beeb8c069dfde0dbc14c2fa0705ae'
            'e542a214d8b3b18c8eaec07489c773a8344b7f44850208c7c3e8badcaa35e355')

_totalSource=$(expr \
  1 + \
  ${#_ttf_ms_win11[@]} + \
  ${#_ttf_ms_win11_japanese[@]} + \
  ${#_ttf_ms_win11_korean[@]} + \
  ${#_ttf_ms_win11_sea[@]} + \
  ${#_ttf_ms_win11_thai[@]} + \
  ${#_ttf_ms_win11_zh_cn[@]} + \
  ${#_ttf_ms_win11_zh_tw[@]} + \
  ${#_ttf_ms_win11_other[@]} + \
  1)

sha256sums=($(awk "BEGIN{for(c=0;c<${_totalSource};c++) printf \"SKIP\n\"}"))

prepare() {
  echo "- Examining locally available fonts"
  for _font in \
    ${_ttf_ms_win11[@]} \
    ${_ttf_ms_win11_japanese[@]} \
    ${_ttf_ms_win11_korean[@]} \
    ${_ttf_ms_win11_sea[@]} \
    ${_ttf_ms_win11_thai[@]} \
    ${_ttf_ms_win11_zh_cn[@]} \
    ${_ttf_ms_win11_zh_tw[@]} \
    ${_ttf_ms_win11_other[@]} \
  ; do
    _allFiles+=( $_font )
    [ ! -f $_font ] && _missingFonts+=( $_font )
  done
  allFiles+=( license.rtf )

  if [ ${#_missingFonts[@]} -gt 0 ]; then
    echo "- Fonts are missing"
    echo -ne "- Mount filesystems as a non-privileged user: "
    touch test.mount
    _unprivilegedMountAllowed=false
    _udisksctlOutput=$(udisksctl loop-setup -r -f test.mount --no-user-interaction) && {
      _unprivilegedMountAllowed=true
      _testLoopDev=$(echo "$_udisksctlOutput" | awk '{print $NF}' RS='.\n')
      udisksctl loop-delete -b "$_testLoopDev" --no-user-interaction
    }
    rm test.mount

    if [ "$_unprivilegedMountAllowed" = "true" ]; then
      echo "allowed"
      echo "- Downloading fonts directly"
      mkdir -p mnt/http
      echo "  - Mounting HTTP file"
      # Remove '--cache' here to disable HTTPDirFS permanent cache.
      httpdirfs --cache --single-file-mode "$_iso" mnt/http
      echo "  - Creating loop device"
      _isoFile="mnt/http/$(echo "$_iso" | awk -F "/" '{print $NF}')"
      _loopDev=$(udisksctl loop-setup -r -f "${_isoFile}" --no-user-interaction 2>&1 | grep -oE "'.*'" | sed -e "s/'//g")
      # Wait for the loop device to be automatically mounted.
      sleep 5
      # Mount the loop device if not automatically mounted.
      if ! grep -qs $_loopDev /proc/mounts; then
        echo "  - Mounting loop device: $_loopDev"
        udisksctl mount -t udf -b "$_loopDev" --no-user-interaction
      fi
      _mountpoint=$(findmnt -nfr -o target -S $_loopDev)
      echo "  - Loop device mounted as ISO at: $_mountpoint"

      echo "  - Extracting files from online Windows installation image"
      7z e -aoa "${_mountpoint}/sources/install.wim" \
        Windows/{Fonts/"*".{ttf,ttc},System32/Licenses/neutral/"*"/"*"/license.rtf}

      echo "  - Unmounting loop device $_loopDev as ISO at: $_mountpoint"
      udisksctl unmount -b "$_loopDev" --no-user-interaction
      echo "  - Deleting loop device: $_loopDev"
      udisksctl loop-delete -b "$_loopDev" --no-user-interaction
      echo "  - Unmounting HTTP file"
      fusermount -uz mnt/http
      rmdir -p mnt/http
    else
      echo "not allowed"
      echo "- Preparing download of full ISO"
      echo "  - Checking free disk space required for download and extraction"
      _freeDiskSpace=$(($(stat -f --format="%a*%S" .)))
      _downloadSize=$(curl -sIL "$_iso" | grep -i Content-Length | tail -n1 | awk '{print $2}' | tr -d '\r\n')
      [ -z $_downloadSize ] && echo -ne "Unable to determine file size of:\n${_iso}\n" && exit 255
      _requiredDiskSpace=$((${_downloadSize}*2))
      if [ $_requiredDiskSpace -gt $_freeDiskSpace ]; then
        echo "Not enough free disk space"
        echo "Needed: $((${_requiredDiskSpace}/1048576)) MiB"
        echo "Available: $((${_freeDiskSpace}/1048576)) MiB"
        exit 255
      fi

      echo "  - Downloading ISO"
      curl -JLO "$_iso"
      echo "  - Extracting Windows installation image"
      7z x $(echo "$_iso" | awk -F "/" '{print $NF}') sources/install.wim

      echo "  - Extracting files from local Windows installation image"
      7z e sources/install.wim \
        Windows/{Fonts/"*".{ttf,ttc},System32/Licenses/neutral/"*"/"*"/license.rtf}

      echo "  - Cleaning up temporary files"
      rm $(echo "$_iso" | awk -F "/" '{print $NF}')
      rm -rf sources
    fi
  fi

  echo "- Verifying file integrity"
  for _i in ${!_allFiles[@]}; do
    echo -ne "  - ${_allFiles[$_i]}: "
    if [ ! -f ${_allFiles[$_i]} ]; then
      echo "MISSING"
      _fail=1
    elif [ "${_sha256sums[$_i]}" == "SKIP" ]; then
      echo "Skipped"
    elif [ "${_sha256sums[$_i]}" == "$(sha256sum ${_allFiles[$_i]} | cut -d' ' -f1)" ]; then
      echo "Pass"
    else
      echo "FAIL"
      _fail=1
    fi
  done
  if [ $_fail ]; then
    echo "One or more files fail the integrity check or are missing. Exiting."
    exit 255
  fi
}

_package() {
    conflicts+=(${pkgname/11/8} ${pkgname/11/10} ttf-win7-fonts${pkgname##*11})

    install -Dm644 $@ -t "$pkgdir/usr/share/fonts/TTF"
    install -Dm644 license.rtf -t "$pkgdir/usr/share/licenses/$pkgname"
}

package_ttf-ms-win11-auto() {
    pkgdesc='Microsoft Windows 11 TrueType fonts'
    provides+=(emoji-font ttf-tahoma ttf-ms-fonts)
    conflicts+=(ttf-tahoma ttf-ms-fonts)
    _package ${_ttf_ms_win11[@]}
}

package_ttf-ms-win11-auto-japanese() {
    pkgdesc='Microsoft Windows 11 Japanese TrueType fonts'
    provides=(ttf-ms-win11-japanese)
    conflicts=(ttf-ms-win11-japanese)
    _package ${_ttf_ms_win11_japanese[@]}
}

package_ttf-ms-win11-auto-korean() {
    pkgdesc='Microsoft Windows 11 Korean TrueType fonts'
    provides=(ttf-ms-win11-korean)
    conflicts=(ttf-ms-win11-korean)
    _package ${_ttf_ms_win11_korean[@]}
}

package_ttf-ms-win11-auto-sea() {
    pkgdesc='Microsoft Windows 11 Southeast Asian TrueType fonts'
    provides=(ttf-ms-win11-sea)
    conflicts=(ttf-ms-win11-sea)
    _package ${_ttf_ms_win11_sea[@]}
}

package_ttf-ms-win11-auto-thai() {
    pkgdesc='Microsoft Windows 11 Thai TrueType fonts'
    provides=(ttf-ms-win11-thai)
    conflicts=(ttf-ms-win11-thai)
    _package ${_ttf_ms_win11_thai[@]}
}

package_ttf-ms-win11-auto-zh_cn() {
    pkgdesc='Microsoft Windows 11 Simplified Chinese TrueType fonts'
    provides=(ttf-ms-win11-zh_cn)
    conflicts=(ttf-ms-win11-zh_cn)
    _package ${_ttf_ms_win11_zh_cn[@]}
}

package_ttf-ms-win11-auto-zh_tw() {
    pkgdesc='Microsoft Windows 11 Traditional Chinese TrueType fonts'
    provides=(ttf-ms-win11-zh_tw)
    conflicts=(ttf-ms-win11-zh_tw)
    _package ${_ttf_ms_win11_zh_tw[@]}
}

package_ttf-ms-win11-auto-other() {
    pkgdesc='Microsoft Windows 11 Other TrueType fonts'
    provides=(ttf-ms-win11-other)
    conflicts=(ttf-ms-win11-other)
    _package ${_ttf_ms_win11_other[@]}
}

# vim: ts=4 sw=4 et