Browse Source

add linux arm support: RaspberryPi(armv7l) and aarch64

j 2 years ago
parent
commit
4c34cbed3c
4 changed files with 22 additions and 3 deletions
  1. 7
    0
      ctl
  2. 6
    1
      install
  3. 3
    1
      oml/tor.py
  4. 6
    1
      oml/update.py

+ 7
- 0
ctl View File

@@ -44,6 +44,13 @@ else
44 44
         else
45 45
             ARCH=32
46 46
         fi
47
+        if [ $PLATFORM == "aarch64" ]; then
48
+            ARCH="_aarch64"
49
+            PLATFORM_PY=3.5
50
+        fi
51
+        if [ $PLATFORM == "armv7l" ]; then
52
+            ARCH="_armv7l"
53
+        fi
47 54
         PLATFORM="linux$ARCH"
48 55
     fi
49 56
     if [ $SYSTEM == "Darwin" ]; then

+ 6
- 1
install View File

@@ -20,7 +20,12 @@ def get_platform():
20 20
         name = 'darwin64'
21 21
     elif name.startswith('linux'):
22 22
         import platform
23
-        if platform.architecture()[0] == '64bit':
23
+        machine = platform.machine()
24
+        if machine == 'armv7l':
25
+            name = 'linux_armv7l'
26
+        elif machine == 'aarch64':
27
+            name = 'linux_aarch64'
28
+        elif machine == 'x86_64':
24 29
             name = 'linux64'
25 30
         else:
26 31
             name = 'linux32'

+ 3
- 1
oml/tor.py View File

@@ -56,7 +56,7 @@ DirReqStatistics 0
56 56
             with open(torrc, 'r') as fd:
57 57
                 data = fd.read()
58 58
             modified_data = re.sub('DataDirectory.*?TorData',
59
-                    'DataDirectory {tor_data}'.format(tor_data=tor_data), data)
59
+                                   'DataDirectory {tor_data}'.format(tor_data=tor_data), data)
60 60
             if data != modified_data:
61 61
                 with open(torrc, 'w') as fd:
62 62
                     fd.write(modified_data)
@@ -298,6 +298,8 @@ def get_tor():
298 298
         for path in (
299 299
             os.path.join(settings.base_dir, '..', 'platform_linux64', 'tor', 'tor'),
300 300
             os.path.join(settings.base_dir, '..', 'platform_linux32', 'tor', 'tor'),
301
+            os.path.join(settings.base_dir, '..', 'platform_linux_armv7l', 'tor', 'tor'),
302
+            os.path.join(settings.base_dir, '..', 'platform_linux_aarch64', 'tor', 'tor'),
301 303
         ):
302 304
             if os.path.isfile(path) and os.access(path, os.X_OK):
303 305
                 return os.path.normpath(path)

+ 6
- 1
oml/update.py View File

@@ -113,7 +113,12 @@ def get_platform():
113 113
         name = 'darwin64'
114 114
     elif name.startswith('linux'):
115 115
         import platform
116
-        if platform.architecture()[0] == '64bit':
116
+        machine = platform.machine()
117
+        if machine == 'armv7l':
118
+            name = 'linux_armv7l'
119
+        elif machine == 'aarch64':
120
+            name = 'linux_aarch64'
121
+        elif machine == 'x86_64':
117 122
             name = 'linux64'
118 123
         else:
119 124
             name = 'linux32'