summaryrefslogtreecommitdiff
path: root/pkg/riseupvpn/snap/hooks/install
blob: 6d8a9d03da609983a75cc66217043b45b8ac12ca (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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
#!/usr/bin/env python
# This helper installs bitmask-root and polkit policy file
import subprocess
from base64 import decodestring as decode

BMROOT = """IyEvdXNyL2Jpbi9weXRob24yLjcKIyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KIwojIENvcHlyaWdo
dCAoQykgMjAxNCBMRUFQCiMKIyBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTogeW91IGNh
biByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeQojIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0
aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVkIGJ5CiMgdGhlIEZyZWUg
U29mdHdhcmUgRm91bmRhdGlvbiwgZWl0aGVyIHZlcnNpb24gMyBvZiB0aGUgTGljZW5zZSwgb3IK
IyAoYXQgeW91ciBvcHRpb24pIGFueSBsYXRlciB2ZXJzaW9uLgojCiMgVGhpcyBwcm9ncmFtIGlz
IGRpc3RyaWJ1dGVkIGluIHRoZSBob3BlIHRoYXQgaXQgd2lsbCBiZSB1c2VmdWwsCiMgYnV0IFdJ
VEhPVVQgQU5ZIFdBUlJBTlRZOyB3aXRob3V0IGV2ZW4gdGhlIGltcGxpZWQgd2FycmFudHkgb2YK
IyBNRVJDSEFOVEFCSUxJVFkgb3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VkCiAgICA6dHlwZSB2YWx1ZTogc3RyCiAgICA6
cnR5cGU6IGJvb2wKICAgICIiIgogICAgdHJ5OgogICAgICAgIHNvY2tldC5pbmV0X2F0b24odmFs
dWUpCiAgICAgICAgcmV0dXJuIFRydWUKICAgIGV4Y2VwdCBFeGNlcHRpb246CiAgICAgICAgbG9n
KCIlczogRVJST1I6IE1BTEZPUk1FRCBJUDogJXMhIiAlIChTQ1JJUFQsIHZhbHVlKSkKICAgICAg
ICByZXR1cm4gRmFsc2UKCgpkZWYgc3BsaXRfbGlzdChfbGlzdCwgcmVnZXgpOgogICAgIiIiCiAg
ICBTcGxpdCBhIGxpc3QgYmFzZWQgb24gYSByZWdleDoKICAgIGUuZy4gc3BsaXRfbGlzdChbInh4
IiwgInl5IiwgIngxIiwgInp6Il0sICJeeCIpID0+IFtbInh4IiwgInl5Il0sIFsieDEiLAogICAg
Inp6Il1dCgogICAgOnBhcmFtIF9saXN0OiB0aGUgbGlzdCB0byBiZSBzcGxpdC4KICAgIDp0eXBl
IF9saXN0OiBsaXN0CiAgICA6cGFyYW0gcmVnZXg6IHRoZSByZWdleCBleHByZXNzaW9uIHRvIGZp
bHRlciB3aXRoLgogICAgOnR5cGUgcmVnZXg6IHN0cgoKICAgIDpydHlwZTogbGlzdAogICAgIiIi
CiAgICBpZiBub3QgaGFzYXR0cihyZWdleCwgIm1hdGNoIik6CiAgICAgICAgcmVnZXggPSByZS5j
b21waWxlKHJlZ2V4KQogICAgcmVzdWx0ID0gW10KICAgIGkgPSAwCiAgICBpZiBub3QgX2xpc3Q6
CiAgICAgICAgcmV0dXJuIHJlc3VsdAogICAgd2hpbGUgVHJ1ZToKICAgICAgICBpZiByZWdleC5t
YXRjaChfbGlzdFtpXSk6CiAgICAgICAgICAgIHJlc3VsdC5hcHBlbmQoW10pCiAgICAgICAgICAg
IHdoaWxlIFRydWU6CiAgICAgICAgICAgICAgICByZXN1bHRbLTFdLmFwcGVuZChfbGlzdFtpXSkK
ICAgICAgICA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k
ZXRhY2ggb3IgX2lucHV0OgogICAgICAgIGlmIF9pbnB1dDoKICAgICAgICAgICAgcmV0dXJuIHN1
YnByb2Nlc3MuUG9wZW4ocGFydHMsIHN0ZGluPXN1YnByb2Nlc3MuUElQRSkKICAgICAgICBlbHNl
OgogICAgICAgICAgICBzdWJwcm9jZXNzLlBvcGVuKHBhcnRzKQogICAgICAgICAgICByZXR1cm4g
Tm9uZQogICAgZWxzZToKICAgICAgICB0cnk6CiAgICAgICAgICAgIGRldm51bGwgPSBvcGVuKCcv
ZGV2L251bGwnLCAndycpCiAgICAgICAgICAgIHN1YnByb2Nlc3MuY2hlY2tfY2FsbChwYXJ0cywg
c3Rkb3V0PWRldm51bGwsIHN0ZGVycj1kZXZudWxsKQogICAgICAgICAgICByZXR1cm4gMAogICAg
ICAgIGV4Y2VwdCBzdWJwcm9jZXNzLkNhbGxlZFByb2Nlc3NFcnJvciBhcyBleGM6CiAgICAgICAg
ICAgIGlmIF9leGl0Y29kZToKICAgICAgICAgICAgICAgIGlmIGV4Yy5yZXR1cm5jb2RlICE9IDE6
CiAgICAgICAgICAgICAgICAgICAgIyAwIG9yIDEgaXMgdG8gYmUgZXhwZWN0ZWQsIGJ1dCBhbnl0
aGluZyBlbHNlCiAgICAgICAgICAgICAgICAgICAgIyBzaG91bGQgYmUgbG9nZ2VkLgogICAgICAg
ICAgICAgICAgICAgIGRlYnVnKCJFUlJPUjogQ291bGQgbm90IHJ1biAlczogJXMiICUKICAgICAg
ICAgICAgICAgICAgICAgICAgICAoZXhjLmNtZCwgZXhjLm91dHB1dCksIGV4Y2VwdGlvbj1leGMp
CiAgICAgICAgICAgICAgICByZXR1cm4gZXhjLnJldHVybmNvZGUKICAgICAgICAgICAgZWxpZiBf
dGhyb3c6CiAgICAgICAgICAgICAgICByYWlzZSBleGMKICAgICAgICAgICAgZWxzZToKICAgICAg
ICAgICAgICAgIGJhaWwoIkVSUk9SOiBDb3VsZCBub3QgcnVuICVzOiAlcyIgJSAoZXh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IiIiCiAgICByZXN1bHQgPSBbXQogICAgdHJ5OgogICAgICAg
IGZvciBmbGFnIGluIHNwbGl0X2xpc3QoYXJncywgIl4tLSIpOgogICAgICAgICAgICBmbGFnX25h
bWUgPSBmbGFnWzBdCiAgICAgICAgICAgIGlmIGZsYWdfbmFtZSBpbiBBTExPV0VEX0ZMQUdTOgog
ICAgICAgICAgICAgICAgcmVzdWx0LmFwcGVuZChmbGFnX25hbWUpCiAgICAgICAgICAgICAgICBy
ZXF1aXJlZF9wYXJhbXMgPSBBTExPV0VEX0ZMQUdTW2ZsYWdfbmFtZV0KICAgICAgICAgICAgICAg
IGlmIHJlcXVpcmVkX3BhcmFtczoKICAgICAgICAgICAgICAgICAgICAjIGZsYXR0ZW4gaWYgc2Vw
YXJhdGVkIGJ5IHNwYWNlcwogICAgICAgICAgICAgICAgICAgIGZsYWdfcGFyYW1zID0gW2kgZm9y
IHN1Ymxpc3QgaW4gbWFwKAogICAgICAgICAgICAgICAgICAgICAgICBsYW1iZGEgczogcy5zcGxp
dCgpLCBmbGFnWzE6XSkgZm9yIGkgaW4gc3VibGlzdF0KICAgICAgICAgICAgICAgICAgICBpZiBs
ZW4oZmxhZ19wYXJhbXMpICE9IGxlbihyZXF1aXJlZF9wYXJhbXMpOgogICAgICAgICAgICAgICAg
ICAgICAgICBsb2coIiVzOiBFUlJPUjogbm90IGVub3VnaCBwYXJhbXMgZm9yICVzIiAlCiAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAoU0NSSVBULCBmbGFnX25hbWUpKQogICAgICAgICAgICAg
ICAgICAgICAgICByZXR1cm4gTm9uZQogICAgICAgICAgICAgICAgICAgIGZvciBwYXJhbSwgcGFy
YW1fdHlwZSBpbiB6aXAoZmxhZ19wYXJhbXMsIHJlcXVpcmVkX3BhcmFtcyk6CiAgICAgICAgICAg
ICAgICAgICAgICAgIGlmIFBBUkFNX0ZPUk1BVFNbcGFyYW1fdHlwZV0ocGFyYW0pOgogICAgICAg
ICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmFwcGVuZChwYXJhbSkKICAgICAgICAgICAgICAg
ICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZygiJXM6IEVSUk9S
OiBCYWQgYXJndW1lbnQgJXMiICUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoU0NS
SVBULCBwYXJhbSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTm9uZQogICAg
ICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgbG9nKCJXQVJOSU5HOiB1bnJlY29nbml6ZWQg
b3BlbnZwbiBmbGFnICVzIiAlIGZsYWdfbmFtZSkKICAgICAgICByZXR1cm4gcmVzdWx0CiAgICBl
eGNlcHQgRXhjZXB0aW9uIGFzIGV4YzoKICAgICAgICBsb2coIiVzOiBFUlJPUiBQQVJTSU5HIEZM
QUdTOiAlcyIgJSAoU0NSSVBULCBleGMpKQogICAgICAgIGlmIERFQlVHOgogICAgICAgICAgICBs
b2dnZXIuZXhjZXB0aW9uKGV4YykKICAgICAgICByZXR1cm4gTm9uZQoKCmRlZiBvcGVudnBuX3N0
YXJ0KGFyZ3MpOgogICAgIiIiCiAgICBMYXVuY2ggb3BlbnZwbiwgc2FuaXRpemluZyBpbnB1dCwg
YW5kIHJlcGxhY2luZyB0aGUgY3VycmVudCBwcm9jZXNzIHdpdGgKICAgIHRoZSBvcGVudnBuIHBy
b2Nlc3MuCgogICAgOnBhcmFtIGFyZ3M6IGFyZ3VtZW50cyB0byBiZSBwYXNzZWQgdG8gb3BlbnZw
bgogICAgOnR5cGUgYXJnczogbGlzdAogICAgIiIiCiAgICBvcGVudnBuX2ZsYWdzID0gcGFyc2Vf
b3BlbnZwbl9mbGFncyhhcmdzKQogICAgaWYgb3BlbnZwbl9mbGFnczoKICAgICAgICBPUEVOVlBO
ID0gZ2V0X29wZW52cG5fYmluKCkKICAgICAgICBmbGFncyA9IFtPUEVOVlBOXSArIEZJWEVEX0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SwKICAg
ICAgICAgICAgICAgICAgIi1wIiwgInVkcCIsICItLWRwb3J0IiwgIjUzIiwgIi0tanVtcCIsICJB
Q0NFUFQiKQogICAgICAgIGlwNHRhYmxlcygiLS1hcHBlbmQiLCBCSVRNQVNLX0NIQUlOLAogICAg
ICAgICAgICAgICAgICAiLS1zb3VyY2UiLCBsb2NhbF9uZXR3b3JrX2lwdjQsICItbyIsIGRlZmF1
bHRfZGV2aWNlLAogICAgICAgICAgICAgICAgICAiLXAiLCAidGNwIiwgIi0tZHBvcnQiLCAiNTMi
LCAiLS1qdW1wIiwgIkFDQ0VQVCIpCiAgICAgICAgIyBhbGxvdyBtdWx0aWNhc3QgU2ltcGxlIFNl
cnZpY2UgRGlzY292ZXJ5IFByb3RvY29sCiAgICAgICAgaXA0dGFibGVzKCItLWFwcGVuZCIsIEJJ
VE1BU0tfQ0hBSU4sCiAgICAgICAgICAgICAgICAgICItLXByb3RvY29sIiwgInVkcCIsCiAgICAg
ICAgICAgICAgICAgICItLWRlc3RpbmF0aW9uIiwgIjIzOS4yNTUuMjU1LjI1MCIsICItLWRwb3J0
IiwgIjE5MDAiLAogICAgICAgICAgICAgICAgICAiLW8iLCBkZWZhdWx0X2RldmljZSwgIi0tanVt
cCIsICJSRVRVUk4iKQogICAgICAgICMgYWxsb3cgbXVsdGljYXN0IEJvbmpvdXIvbUROUwogICAg
ICAgIGlwNHRhYmxlcygiLS1hcHBlbmQiLCBCSVRNQVNLX0NIQUlOLAogICAgICAgICAgICAgICAg
ICAiLS1wcm90b2NvbCIsICJ1ZHAiLAogICAgICAgICAgICAgICAgICAiLS1kZXN0aW5hdGlvbiIs
ICIyMjQuMC4wLjI1MSIsICItLWRwb3J0IiwgIjUzNTMiLAogICAgICAgICAgICAgICAgICAiLW8i
LCBkZWZhdWx0X2RldmljZSwgIi0tanVtcCIsICJSRVRVUk4iKQogICAgaWYgbG9jYWxfbmV0d29y
a19pcHY2OgogICAgICAgIGlwNnRhYmxlcygiLS1hcHBlbmQiLCBCSVRNQVNLX0NIQUlOLAogICAg
ICAgICAgICAgICAgICAiLS1kZXN0aW5hdGlvbiIsIGxvY2FsX25ldHdvcmtfaXB2NiwgIi1vIiwg
ZGVmYXVsdF9kZXZpY2UsCiAgICAgICAgICAgICAgICAgICItLWp1bXAiLCAiQUNDRVBUIikKICAg
ICAgICAjIGFsbG93IG11bHRpY2FzdCBTaW1wbGUgU2VydmljZSBEaXNjb3ZlcnkgUHJvdG9jb2wK
ICAgICAgICBpcDZ0YWJsZXMoIi0tYXBwZW5kIiwgQklUTUFTS19DSEFJTiwKICAgICAgICAgICAg
ICAgICAgIi0tcHJvdG9jb2wiLCAidWRwIiwKICAgICAgICAgICAgICAgICAgIi0tZGVzdGluYXRp
b24iLCAiRkYwNTo6QyIsICItLWRwb3J0IiwgIjE5MDAiLAogICAgICAgICAgICAgICAgICAiLW8i
LCBkZWZhdWx0X2RldmljZSwgIi0tanVtcCIsICJSRVRVUk4iKQogICAgICAgICMgYWxsb3cgbXVs
dGljYXN0IEJvbmpvdXIvbUROUwogICAgICAgIGlwNnRhYmxlcygiLS1hcHBlbmQiLCBCSVRNQVNL
X0NIQUlOLAogICAgICAgICAgICAgICAgICAiLS1wcm90b2NvbCIsICJ1ZHAiLAogICAgICAgICAg
ICAgICAgICAiLS1kZXN0aW5hdGlvbiIsICJGRjAyOjpGQiIsICItLWRwb3J0IiwgIjUzNTMiLAog
ICAgICAgICAgICAgICAgICAiLW8iLCBkZWZhdWx0X2RldmljZSwgIi0tanVtcCIsICJSRVRVUk4i
KQoKICAgICMgYWxsb3cgaXB2NCB0cmFmZmljIHRvIGdhdGV3YXlzCiAgICBmb3IgZ2F0ZXdheSBp
biBnYXRld2F5czoKICAgICAgICBpcDR0YWJsZXMoIi0tYXBwZW5kIiwgQklUTUFTS19DSEFJTiwg
Ii0tZGVzdGluYXRpb24iLCBnYXRld2F5LAogICAgICAgICAgICAgICAgICAiLW8iLCBkZWZhdWx0
X2RldmljZSwgIi0tanVtc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uIGFzIHJvb3QiKQoKICAgICAgICBpZiBjb21t
YW5kID09ICJvcGVudnBuX3N0YXJ0IjoKICAgICAgICAgICAgb3BlbnZwbl9zdGFydChhcmdzKQoK
ICAgICAgICBlbGlmIGNvbW1hbmQgPT0gIm9wZW52cG5fc3RvcCI6CiAgICAgICAgICAgIG9wZW52
cG5fc3RvcChhcmdzKQoKICAgICAgICBlbGlmIGNvbW1hbmQgPT0gImZpcmV3YWxsX3N0YXJ0IjoK
ICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgZmlyZXdhbGxfc3RhcnQoYXJncykKICAg
ICAgICAgICAgZXhjZXB0IEV4Y2VwdGlvbiBhcyBleDoKICAgICAgICAgICAgICAgIGlmIG5vdCBp
c19yZXN0YXJ0OgogICAgICAgICAgICAgICAgICAgIGZpcmV3YWxsX3N0b3AoKQogICAgICAgICAg
ICAgICAgYmFpbCgiRVJST1I6IGNvdWxkIG5vdCBzdGFydCBmaXJld2FsbCIsIGV4KQoKICAgICAg
ICBlbGlmIGNvbW1hbmQgPT0gImZpcmV3YWxsX3N0b3AiOgogICAgICAgICAgICB0cnk6CiAgICAg
ICAgICAgICAgICBmaXJld2FsbF9zdG9wKCkKICAgICAgICAgICAgZXhjZXB0IEV4Y2VwdGlvbiBh
cyBleDoKICAgICAgICAgICAgICAgIGJhaWwoIkVSUk9SOiBjb3VsZCBub3Qgc3RvcCBmaXJld2Fs
bCIsIGV4KQoKICAgICAgICBlbGlmIGNvbW1hbmQgPT0gImZpcmV3YWxsX2lzdXAiOgogICAgICAg
ICAgICBpZiBpcHY0X2NoYWluX2V4aXN0cyhCSVRNQVNLX0NIQUlOKToKICAgICAgICAgICAgICAg
ICMgdG9vIHZlcmJvc2Ugc2luY2UgYml0bWFzayBwb2xscyB0aGlzCiAgICAgICAgICAgICAgICBw
YXNzCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBiYWlsKCJJTkZPOiBiaXRtYXNr
IGZpcmV3YWxsIGlzIGRvd24iKQoKICAgICAgICBlbGlmIGNvbW1hbmQgPT0gImZ3LWVtYWlsX3N0
YXJ0IjoKICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgZndfZW1haWxfc3RhcnQoYXJn
cykKICAgICAgICAgICAgZXhjZXB0IEV4Y2VwdGlvbiBhcyBleDoKICAgICAgICAgICAgICAgIGlm
IG5vdCBpc19yZXN0YXJ0OgogICAgICAgICAgICAgICAgICAgIGZ3X2VtYWlsX3N0b3AoKQogICAg
ICAgICAgICAgICAgYmFpbCgiRVJST1I6IGNvdWxkIG5vdCBzdGFydCBlbWFpbCBmaXJld2FsbCIs
IGV4KQoKICAgICAgICBlbGlmIGNvbW1hbmQgPT0gImZ3LWVtYWlsX3N0b3AiOgogICAgICAgICAg
ICB0cnk6CiAgICAgICAgICAgICAgICBmd19lbWFpbF9zdG9wKCkKICAgICAgICAgICAgZXhjZXB0
IEV4Y2VwdGlvbiBhcyBleDoKICAgICAgICAgICAgICAgIGJhaWwoIkVSUk9SOiBjb3VsZCBub3Qg
c3RvcCBlbWFpbCBmaXJld2FsbCIsIGV4KQoKICAgICAgICBlbGlmIGNvbW1hbmQgPT0gImZ3LWVt
YWlsX2lzdXAiOgogICAgICAgICAgICBpZiBpcHY0X2NoYWluX2V4aXN0cyhCSVRNQVNLX0NIQUlO
X0VNQUlMKToKICAgICAgICAgICAgICAgIGxvZygiJXM6IElORk86IGJpdG1hc2sgZW1haWwgZmly
ZXdhbGwgaXMgdXAiICUgKFNDUklQVCwpKQogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAg
ICAgYmFpbCgiSU5GTzogYml0bWFzayBlbWFpbCBmaXJld2FsbCBpcyBkb3duIikKCiAgICAgICAg
ZWxzZToKICAgICAgICAgICAgYmFpbCgiRVJST1I6IE5vIHN1Y2ggY29tbWFuZCIpCiAgICBlbHNl
OgogICAgICAgIGJhaWwoIkVSUk9SOiBObyBzdWNoIGNvbW1hbmQiKQoKCmlmIF9fbmFtZV9fID09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iAgICA8aWNvbl9uYW1lPnBhY2thZ2UteC1n
ZW5lcmljPC9pY29uX25hbWU+IAogICAgPGRlZmF1bHRzPgogICAgICA8YWxsb3dfYW55Pnllczwv
YWxsb3dfYW55PgogICAgICA8YWxsb3dfaW5hY3RpdmU+eWVzPC9hbGxvd19pbmFjdGl2ZT4KICAg
ICAgPGFsbG93X2FjdGl2ZT55ZXM8L2FsbG93X2FjdGl2ZT4KICAgIDwvZGVmYXVsdHM+CiAgICA8
YW5ub3RhdGUga2V5PSJvcmcuZnJlZWRlc2t0b3AucG9saWN5a2l0LmV4ZWMucGF0aCI+L3Vzci9s
b2NhbC9zYmluL2JpdG1hc2stcm9vdDwvYW5ub3RhdGU+CiAgPC9hY3Rpb24+CjwvcG9saWN5Y29u
ZmlnPgo=
"""
BMROOT_DEST = "/usr/local/sbin/bitmask-root"
with open(BMROOT_DEST, "w") as bmroot:
    lines = str(decode(BMROOT)).split("\n")
    for line in lines:
        bmroot.write(line + "\n")
with open('/usr/share/polkit-1/actions/se.leap.bitmask.bundle.policy', 'w') as polkit:
    lines = str(decode(POLKIT)).split("\n")
    for line in lines:
        polkit.write(line + "\n")
subprocess.Popen(["chmod", "+x", BMROOT_DEST])