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_dir = cfg.custom_static_dir
custom_static_url = '/plinth/custom/static' custom_static_url = '/plinth/custom/static'
config = { if os.path.exists(custom_static_dir):
'/': { config = {
'tools.staticdir.root': custom_static_dir, '/': {
'tools.staticdir.on': True, 'tools.staticdir.root': custom_static_dir,
'tools.staticdir.dir': '.' 'tools.staticdir.on': True,
'tools.staticdir.dir': '.'
}
} }
} cherrypy.tree.mount(None, custom_static_url, config)
cherrypy.tree.mount(None, custom_static_url, config) logger.debug('Serving custom static directory %s on %s',
logger.debug('Serving custom static directory %s on %s', custom_static_dir, custom_static_dir, custom_static_url)
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_dir = '/usr/share/javascript'
js_url = '/javascript' js_url = '/javascript'

View File

@ -228,54 +228,48 @@ setuptools.setup(
'locale/*/LC_MESSAGES/*.[pm]o' 'locale/*/LC_MESSAGES/*.[pm]o'
] ]
}, },
data_files=[ data_files=[('/usr/lib/firewalld/services/',
('/usr/lib/firewalld/services/', glob.glob('data/usr/lib/firewalld/services/*.xml')),
glob.glob('data/usr/lib/firewalld/services/*.xml')), ('/etc/apache2/conf-available',
('/etc/apache2/conf-available', glob.glob('data/etc/apache2/conf-available/*.conf')),
glob.glob('data/etc/apache2/conf-available/*.conf')), ('/etc/apache2/sites-available',
('/etc/apache2/sites-available', glob.glob('data/etc/apache2/sites-available/*.conf')),
glob.glob('data/etc/apache2/sites-available/*.conf')), ('/etc/apache2/includes',
('/etc/apache2/includes', glob.glob('data/etc/apache2/includes/*.conf')),
glob.glob('data/etc/apache2/includes/*.conf')), ('/etc/apt/apt.conf.d',
('/etc/apt/apt.conf.d', glob.glob('data/etc/apt/apt.conf.d/60unattended-upgrades')),
glob.glob('data/etc/apt/apt.conf.d/60unattended-upgrades')), ('/etc/avahi/services/',
('/etc/avahi/services/', glob.glob('data/etc/avahi/services/*.service')),
glob.glob('data/etc/avahi/services/*.service')), ('/etc/ikiwiki', glob.glob('data/etc/ikiwiki/*.setup')),
('/etc/ikiwiki', glob.glob('data/etc/ikiwiki/*.setup')), ('/etc/NetworkManager/dispatcher.d/', [
('/etc/NetworkManager/dispatcher.d/', 'data/etc/NetworkManager/dispatcher.d/10-freedombox-batman'
['data/etc/NetworkManager/dispatcher.d/10-freedombox-batman']), ]), ('/etc/sudoers.d', [
('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']), 'data/etc/sudoers.d/plinth'
('/lib/systemd/system', ]), ('/lib/systemd/system',
glob.glob('data/lib/systemd/system/*.service')), glob.glob('data/lib/systemd/system/*.service')),
('/etc/mediawiki', glob.glob('data/etc/mediawiki/*.php')), ('/etc/mediawiki', glob.glob('data/etc/mediawiki/*.php')),
('/usr/share/plinth/actions', glob.glob(os.path.join('actions', '*'))), ('/usr/share/plinth/actions',
('/usr/share/polkit-1/rules.d', glob.glob(os.path.join(
['data/usr/share/polkit-1/rules.d/50-plinth.rules']), 'actions', '*'))), ('/usr/share/polkit-1/rules.d', [
('/usr/share/man/man1', ['doc/plinth.1']), 'data/usr/share/polkit-1/rules.d/50-plinth.rules'
('/etc/plinth', [ ]), ('/usr/share/man/man1', [
'data/etc/plinth/plinth.config', 'doc/plinth.1'
'data/etc/plinth/custom-shortcuts.json' ]), ('/etc/plinth', [
]), 'data/etc/plinth/plinth.config',
('/usr/share/augeas/lenses', 'data/etc/plinth/custom-shortcuts.json'
glob.glob('data/usr/share/augeas/lenses/*.aug')), ]), ('/usr/share/augeas/lenses',
('/usr/share/augeas/lenses/tests', glob.glob('data/usr/share/augeas/lenses/*.aug')),
glob.glob('data/usr/share/augeas/lenses/tests/test_*.aug')), ('/usr/share/augeas/lenses/tests',
('/usr/share/pam-configs/', glob.glob('data/usr/share/augeas/lenses/tests/test_*.aug')),
glob.glob('data/usr/share/pam-configs/*-freedombox')), ('/usr/share/pam-configs/',
('/etc/plinth/modules-enabled', glob.glob('data/usr/share/pam-configs/*-freedombox')),
glob.glob(os.path.join('data/etc/plinth/modules-enabled', '*'))), ('/etc/plinth/modules-enabled',
('/var/lib/polkit-1/localauthority/10-vendor.d', [ glob.glob(
'data/var/lib/polkit-1/localauthority/10-vendor.d/' os.path.join('data/etc/plinth/modules-enabled', '*'))),
'org.freedombox.NetworkManager.pkla' ('/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',
]),
],
cmdclass={ cmdclass={
'install': CustomInstall, 'install': CustomInstall,
'build': CustomBuild, 'build': CustomBuild,