|
|
@@ -1,5 +1,6 @@
|
|
|
#!/usr/bin/python
|
|
|
import sys
|
|
|
+import pwd
|
|
|
import os
|
|
|
import json
|
|
|
import re
|
|
|
@@ -32,16 +33,29 @@ with open(infile[0], 'rb') as fpin:
|
|
|
fpout.write(json.dumps(data, indent=4))
|
|
|
print(theid)
|
|
|
|
|
|
+user = getpwnam('fourier')
|
|
|
+src_fourier_path = '/media/datadrive/fourier'
|
|
|
fourier_path = '/var/fourier'
|
|
|
box_path = os.path.join(fourier_path, theid)
|
|
|
db_path = os.path.join(box_path, 'files.db')
|
|
|
-if os.path.isdir(fourier_path):
|
|
|
- if not os.path.isdir(box_path):
|
|
|
- print('** Creating Box ID folder')
|
|
|
- os.mkdir(box_path)
|
|
|
- if not os.path.isfile(db_path):
|
|
|
- print('** Preparing local database')
|
|
|
- subprocess.call(['fourier', 'db', 'setup'])
|
|
|
- print('** Applying migrations')
|
|
|
- subprocess.call(['fourier', 'db', 'migrate'])
|
|
|
- print('** Creating database')
|
|
|
+
|
|
|
+if not os.path.isdir(src_fourier_path):
|
|
|
+ os.mkdir(src_fourier_path)
|
|
|
+ os.chown(src_fourier_path, user.pw_uid, user.pw_gid)
|
|
|
+
|
|
|
+if not os.path.islink(fourier_path):
|
|
|
+ os.src_fourier_path(src_fourier_path, fourier_path)
|
|
|
+
|
|
|
+if not os.path.isdir(box_path):
|
|
|
+ print('** Creating Box ID folder')
|
|
|
+ os.mkdir(box_path)
|
|
|
+ os.chown(box_path, user.pw_uid, user.pw_gid)
|
|
|
+
|
|
|
+if not os.path.isfile(db_path):
|
|
|
+ print('** Preparing local database')
|
|
|
+ subprocess.call(['fourier', 'db', 'setup'])
|
|
|
+ print('** Applying migrations')
|
|
|
+ subprocess.call(['fourier', 'db', 'migrate'])
|
|
|
+ print('** Creating database')
|
|
|
+
|
|
|
+
|