提交 21532aa5 编写于 作者: A Alessio Sergi

setup.py: add chroot detection

Fixes #471.
上级 a6db0977
......@@ -6,6 +6,8 @@ import sys
from setuptools import setup
is_chroot = os.stat('/').st_ino != 2
def get_data_files():
data_files = [
......@@ -15,15 +17,16 @@ def get_data_files():
('share/man/man1', ['man/glances.1'])
]
if os.name == 'posix' and os.getuid() == 0: # Unix-like + root privileges
if hasattr(sys, 'real_prefix'): # virtualenv
conf_path = os.path.join(sys.prefix, 'etc', 'glances')
elif os.name == 'posix' and (os.getuid() == 0 or is_chroot):
# Unix-like + root privileges/chroot environment
if 'bsd' in sys.platform:
conf_path = os.path.join(sys.prefix, 'etc', 'glances')
elif 'linux' in sys.platform:
conf_path = os.path.join('/etc', 'glances')
elif 'darwin' in sys.platform:
conf_path = os.path.join('/usr/local', 'etc', 'glances')
elif hasattr(sys, 'real_prefix'): # virtualenv
conf_path = os.path.join(sys.prefix, 'etc', 'glances')
elif 'win32' in sys.platform: # windows
conf_path = os.path.join(os.environ.get('APPDATA'), 'glances')
else: # Unix-like + per-user install
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册