|
@@ -6,7 +6,7 @@ import json
|
|
|
import re
|
|
import re
|
|
|
import base64
|
|
import base64
|
|
|
import argparse
|
|
import argparse
|
|
|
-import subprocess
|
|
|
|
|
|
|
+import subprocess as sp
|
|
|
|
|
|
|
|
b64id = base64.b64encode(os.urandom(9))
|
|
b64id = base64.b64encode(os.urandom(9))
|
|
|
|
|
|
|
@@ -39,6 +39,11 @@ fourier_path = '/var/fourier'
|
|
|
box_path = os.path.join(fourier_path, theid)
|
|
box_path = os.path.join(fourier_path, theid)
|
|
|
db_path = os.path.join(box_path, 'files.db')
|
|
db_path = os.path.join(box_path, 'files.db')
|
|
|
|
|
|
|
|
|
|
+p = sp.Popen(['sudo', 'fdisk', '/dev/sdb'],
|
|
|
|
|
+ stdin=sp.PIPE)
|
|
|
|
|
+p.communicate('n\np\n1\n\n\nw\n')
|
|
|
|
|
+sp.call(['sudo', 'mkfs', '-t', 'ext4', '/dev/sdb1'])
|
|
|
|
|
+
|
|
|
if not os.path.isdir(src_fourier_path):
|
|
if not os.path.isdir(src_fourier_path):
|
|
|
os.mkdir(src_fourier_path)
|
|
os.mkdir(src_fourier_path)
|
|
|
os.chown(src_fourier_path, user.pw_uid, user.pw_gid)
|
|
os.chown(src_fourier_path, user.pw_uid, user.pw_gid)
|
|
@@ -53,9 +58,9 @@ if not os.path.isdir(box_path):
|
|
|
|
|
|
|
|
if not os.path.isfile(db_path):
|
|
if not os.path.isfile(db_path):
|
|
|
print('** Preparing local database')
|
|
print('** Preparing local database')
|
|
|
- subprocess.call(['fourier', 'db', 'setup'])
|
|
|
|
|
|
|
+ sp.call(['fourier', 'db', 'setup'])
|
|
|
print('** Applying migrations')
|
|
print('** Applying migrations')
|
|
|
- subprocess.call(['fourier', 'db', 'migrate'])
|
|
|
|
|
|
|
+ sp.call(['fourier', 'db', 'migrate'])
|
|
|
print('** Creating database')
|
|
print('** Creating database')
|
|
|
|
|
|
|
|
|
|
|