blob: 3d60cb1105f9afe64765e61ee15dad502b95a564 (
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
|
# set ts=2:sw=2:expandtab
import snapcraft
import snapcraft.plugins.copy
import os, sys
from os.path import join
from stat import *
def fix_file_permissions(file):
mode = os.stat(file).st_mode
# copy read and execute bits
# rwx rwx rwx
# 987 654 321
# 0b10111111 = 0x17f
# print("{0:o}".format(mode), ' - ', file)
mode |= ((mode & 0x17f) >> 3) | ((mode & 0x17f) >> 6)
os.chmod(file, mode)
class TorBrowser(snapcraft.plugins.copy.CopyPlugin):
@classmethod
def schema(cls):
schema = super().schema()
return schema
def build(self):
super().build()
for root, dirs, files in os.walk(self.builddir):
for name in files:
fix_file_permissions(join(root,name))
for name in dirs:
fix_file_permissions(join(root,name))
|