add --force-settings

This commit is contained in:
chrys 2017-10-21 16:03:03 +02:00
parent 387eb5f24c
commit 8d223ad67d

View File

@ -1,13 +1,19 @@
#!/bin/python #!/bin/python
#https://python-packaging.readthedocs.io/en/latest/minimal.html #https://python-packaging.readthedocs.io/en/latest/minimal.html
import os, glob import os, glob, sys
import os.path import os.path
from shutil import copyfile from shutil import copyfile
from setuptools import find_packages from setuptools import find_packages
from setuptools import setup from setuptools import setup
fenrirVersion = '1.5' fenrirVersion = '1.5'
packageVersion = 'post6' packageVersion = 'post8'
# handle flags for package manager like yaourt and pacaur.
forceSettings = False
if "--force-settings" in sys.argv:
forceSettings = True
sys.argv.remove("--force-settings")
data_files = [] data_files = []
directories = glob.glob('config/*') directories = glob.glob('config/*')
@ -20,10 +26,11 @@ for directory in directories:
destDir = '/etc/fenrir/keyboard' destDir = '/etc/fenrir/keyboard'
elif 'config/settings' in directory: elif 'config/settings' in directory:
destDir = '/etc/fenrir/settings' destDir = '/etc/fenrir/settings'
try: if not forceSettings:
del(files[files.index('config/settings/settings.conf')]) try:
except: del(files[files.index('config/settings/settings.conf')])
pass except:
pass
elif 'config/scripts' in directory: elif 'config/scripts' in directory:
destDir = '/usr/share/fenrir/scripts' destDir = '/usr/share/fenrir/scripts'
if destDir != '': if destDir != '':
@ -94,16 +101,18 @@ setup(
) )
print('') if not forceSettings:
# create settings file from example if not exist print('')
if not os.path.isfile('/etc/fenrir/settings/settings.conf'): # create settings file from example if not exist
try: if not os.path.isfile('/etc/fenrir/settings/settings.conf'):
copyfile('/etc/fenrir/settings/settings.conf.example', '/etc/fenrir/settings/settings.conf') try:
print('create settings file in /etc/fenrir/settings/settings.conf') copyfile('/etc/fenrir/settings/settings.conf.example', '/etc/fenrir/settings/settings.conf')
except: print('create settings file in /etc/fenrir/settings/settings.conf')
pass except:
else: pass
print('settings.conf file found. It is not overwritten automatical') else:
print('settings.conf file found. It is not overwritten automatical')
print('') print('')
print('To have Fenrir start at boot:') print('To have Fenrir start at boot:')
print('sudo systemctl enable fenrir') print('sudo systemctl enable fenrir')