Root check removed
This commit is contained in:
parent
61435791fc
commit
39df2adef5
@ -100,9 +100,9 @@ _Внимание_! Только Python 2.7, только PostgreSQL, тольк
|
|||||||
|
|
||||||
```
|
```
|
||||||
sudo mkdir -p /var/www/py-phias
|
sudo mkdir -p /var/www/py-phias
|
||||||
sudo chown www-fias: /var/www/py-phias
|
sudo chown phias: /var/www/py-phias
|
||||||
wget https://github.com/jar3b/py-phias/archive/v0.0.1.tar.gz
|
wget https://github.com/jar3b/py-phias/archive/v0.0.1.tar.gz
|
||||||
sudo -u www-fias tar xzf v0.0.1.tar.gz -C /var/www/py-phias --strip-components=1
|
sudo -u phias tar xzf v0.0.1.tar.gz -C /var/www/py-phias --strip-components=1
|
||||||
cd /var/www/py-phias
|
cd /var/www/py-phias
|
||||||
sudo pip install -r requirements.txt
|
sudo pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
19
manage.py
19
manage.py
@ -1,10 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import ctypes
|
|
||||||
import logging
|
import logging
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import platform
|
|
||||||
|
|
||||||
from aore.miscutils.sphinx import SphinxHelper
|
from aore.miscutils.sphinx import SphinxHelper
|
||||||
from aore.updater.soapreceiver import SoapReceiver
|
from aore.updater.soapreceiver import SoapReceiver
|
||||||
@ -13,15 +10,6 @@ from aore.updater.updater import Updater
|
|||||||
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
|
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
def is_root():
|
|
||||||
try:
|
|
||||||
is_admin = os.getuid() == 0
|
|
||||||
except AttributeError:
|
|
||||||
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
|
|
||||||
|
|
||||||
return is_admin
|
|
||||||
|
|
||||||
|
|
||||||
def print_fias_versions():
|
def print_fias_versions():
|
||||||
imp = SoapReceiver()
|
imp = SoapReceiver()
|
||||||
current_version = Updater.get_current_fias_version()
|
current_version = Updater.get_current_fias_version()
|
||||||
@ -116,10 +104,6 @@ def main():
|
|||||||
|
|
||||||
# Manage DB
|
# Manage DB
|
||||||
if options.database:
|
if options.database:
|
||||||
if 'Linux' in platform.system() and not is_root():
|
|
||||||
print "This option need to be run with elevated privileges."
|
|
||||||
return
|
|
||||||
|
|
||||||
# create new database
|
# create new database
|
||||||
aoupdater = Updater(options.source)
|
aoupdater = Updater(options.source)
|
||||||
allowed_updates = None
|
allowed_updates = None
|
||||||
@ -135,9 +119,6 @@ def main():
|
|||||||
|
|
||||||
# Manage Sphinx
|
# Manage Sphinx
|
||||||
if options.sphinx and options.indexer_path and options.output_conf:
|
if options.sphinx and options.indexer_path and options.output_conf:
|
||||||
if 'Linux' in platform.system() and not is_root():
|
|
||||||
print "This option need to be run with elevated privileges."
|
|
||||||
return
|
|
||||||
sphinxh = SphinxHelper()
|
sphinxh = SphinxHelper()
|
||||||
sphinxh.configure_indexer(options.indexer_path, options.output_conf)
|
sphinxh.configure_indexer(options.indexer_path, options.output_conf)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user