customization: Don't install files in /var/www

- Use the directory for service custom static files only if it exists.
- This fixes issue with lintian complaining of installing files in /var/www.

Closes #1399

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
Joseph Nuthalapati 2018-10-08 22:04:54 -07:00
parent 5e13ba0424
commit faf5f5bc6c
No known key found for this signature in database
GPG Key ID: 5398F00A2FA43C35
4 changed files with 56 additions and 63 deletions

View File

@ -1 +0,0 @@
themes/default/

View File

@ -1,5 +0,0 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -115,16 +115,21 @@ def setup_server():
custom_static_dir = cfg.custom_static_dir
custom_static_url = '/plinth/custom/static'
config = {
'/': {
'tools.staticdir.root': custom_static_dir,
'tools.staticdir.on': True,
'tools.staticdir.dir': '.'
if os.path.exists(custom_static_dir):
config = {
'/': {
'tools.staticdir.root': custom_static_dir,
'tools.staticdir.on': True,
'tools.staticdir.dir': '.'
}
}
}
cherrypy.tree.mount(None, custom_static_url, config)
logger.debug('Serving custom static directory %s on %s', custom_static_dir,
custom_static_url)
cherrypy.tree.mount(None, custom_static_url, config)
logger.debug('Serving custom static directory %s on %s',
custom_static_dir, custom_static_url)
else:
logger.debug(
'Not serving custom static directory %s on %s, '
'directory does not exist', custom_static_dir, custom_static_url)
js_dir = '/usr/share/javascript'
js_url = '/javascript'

View File

@ -228,54 +228,48 @@ setuptools.setup(
'locale/*/LC_MESSAGES/*.[pm]o'
]
},
data_files=[
('/usr/lib/firewalld/services/',
glob.glob('data/usr/lib/firewalld/services/*.xml')),
('/etc/apache2/conf-available',
glob.glob('data/etc/apache2/conf-available/*.conf')),
('/etc/apache2/sites-available',
glob.glob('data/etc/apache2/sites-available/*.conf')),
('/etc/apache2/includes',
glob.glob('data/etc/apache2/includes/*.conf')),
('/etc/apt/apt.conf.d',
glob.glob('data/etc/apt/apt.conf.d/60unattended-upgrades')),
('/etc/avahi/services/',
glob.glob('data/etc/avahi/services/*.service')),
('/etc/ikiwiki', glob.glob('data/etc/ikiwiki/*.setup')),
('/etc/NetworkManager/dispatcher.d/',
['data/etc/NetworkManager/dispatcher.d/10-freedombox-batman']),
('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']),
('/lib/systemd/system',
glob.glob('data/lib/systemd/system/*.service')),
('/etc/mediawiki', glob.glob('data/etc/mediawiki/*.php')),
('/usr/share/plinth/actions', glob.glob(os.path.join('actions', '*'))),
('/usr/share/polkit-1/rules.d',
['data/usr/share/polkit-1/rules.d/50-plinth.rules']),
('/usr/share/man/man1', ['doc/plinth.1']),
('/etc/plinth', [
'data/etc/plinth/plinth.config',
'data/etc/plinth/custom-shortcuts.json'
]),
('/usr/share/augeas/lenses',
glob.glob('data/usr/share/augeas/lenses/*.aug')),
('/usr/share/augeas/lenses/tests',
glob.glob('data/usr/share/augeas/lenses/tests/test_*.aug')),
('/usr/share/pam-configs/',
glob.glob('data/usr/share/pam-configs/*-freedombox')),
('/etc/plinth/modules-enabled',
glob.glob(os.path.join('data/etc/plinth/modules-enabled', '*'))),
('/var/lib/polkit-1/localauthority/10-vendor.d', [
'data/var/lib/polkit-1/localauthority/10-vendor.d/'
'org.freedombox.NetworkManager.pkla'
]),
(
'/var/www/plinth/custom/static/theme/icons/',
[
'data/var/www/plinth/custom/static/themes/default/icons/.gitignore',
# TODO Cannot be copied since a symlink is not a regular file
# 'data/var/www/plinth/custom/static/theme',
]),
],
data_files=[('/usr/lib/firewalld/services/',
glob.glob('data/usr/lib/firewalld/services/*.xml')),
('/etc/apache2/conf-available',
glob.glob('data/etc/apache2/conf-available/*.conf')),
('/etc/apache2/sites-available',
glob.glob('data/etc/apache2/sites-available/*.conf')),
('/etc/apache2/includes',
glob.glob('data/etc/apache2/includes/*.conf')),
('/etc/apt/apt.conf.d',
glob.glob('data/etc/apt/apt.conf.d/60unattended-upgrades')),
('/etc/avahi/services/',
glob.glob('data/etc/avahi/services/*.service')),
('/etc/ikiwiki', glob.glob('data/etc/ikiwiki/*.setup')),
('/etc/NetworkManager/dispatcher.d/', [
'data/etc/NetworkManager/dispatcher.d/10-freedombox-batman'
]), ('/etc/sudoers.d', [
'data/etc/sudoers.d/plinth'
]), ('/lib/systemd/system',
glob.glob('data/lib/systemd/system/*.service')),
('/etc/mediawiki', glob.glob('data/etc/mediawiki/*.php')),
('/usr/share/plinth/actions',
glob.glob(os.path.join(
'actions', '*'))), ('/usr/share/polkit-1/rules.d', [
'data/usr/share/polkit-1/rules.d/50-plinth.rules'
]), ('/usr/share/man/man1', [
'doc/plinth.1'
]), ('/etc/plinth', [
'data/etc/plinth/plinth.config',
'data/etc/plinth/custom-shortcuts.json'
]), ('/usr/share/augeas/lenses',
glob.glob('data/usr/share/augeas/lenses/*.aug')),
('/usr/share/augeas/lenses/tests',
glob.glob('data/usr/share/augeas/lenses/tests/test_*.aug')),
('/usr/share/pam-configs/',
glob.glob('data/usr/share/pam-configs/*-freedombox')),
('/etc/plinth/modules-enabled',
glob.glob(
os.path.join('data/etc/plinth/modules-enabled', '*'))),
('/var/lib/polkit-1/localauthority/10-vendor.d', [
'data/var/lib/polkit-1/localauthority/10-vendor.d/'
'org.freedombox.NetworkManager.pkla'
])],
cmdclass={
'install': CustomInstall,
'build': CustomBuild,