meson: create /var/log/journal/{,remote/} conditionally

Not everybody has those dirs in the filesystem (and they don't need to).
When creating an installation package using $DESTDIR, it is easy enough to
remove or ignore those directories, but if installing into a real root, it
is ugly to create and remove them. Let's add an option so people can skip
it if they want.

Inspired by #12930.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-07-04 09:59:09 +02:00
parent 7810d22171
commit 6ed5ef9819
4 changed files with 24 additions and 18 deletions

View File

@ -5,7 +5,7 @@ file = configure_file(
output : 'README',
configuration : substs)
if conf.get('HAVE_SYSV_COMPAT') == 1
if conf.get('HAVE_SYSV_COMPAT') == 1 and get_option('create-log-dirs')
install_data(file,
install_dir : varlogdir)
endif

View File

@ -95,6 +95,8 @@ option('timesyncd', type : 'boolean',
description : 'install the systemd-timesyncd daemon')
option('remote', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'support for "journal over the network"')
option('create-log-dirs', type : 'boolean',
description : 'create /var/log/journal{,/remote}')
option('nss-myhostname', type : 'boolean',
description : 'install nss-myhostname module')
option('nss-mymachines', type : 'combo', choices : ['auto', 'true', 'false'],

View File

@ -63,9 +63,11 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
install_data('browse.html',
install_dir : join_paths(pkgdatadir, 'gatewayd'))
meson.add_install_script('sh', '-c',
mkdir_p.format('/var/log/journal/remote'))
meson.add_install_script('sh', '-c',
'''chown 0:0 $DESTDIR/var/log/journal/remote &&
chmod 755 $DESTDIR/var/log/journal/remote || :''')
if get_option('create-log-dirs')
meson.add_install_script('sh', '-c',
mkdir_p.format('/var/log/journal/remote'))
meson.add_install_script('sh', '-c',
'''chown 0:0 $DESTDIR/var/log/journal/remote &&
chmod 755 $DESTDIR/var/log/journal/remote || :''')
endif
endif

View File

@ -111,20 +111,22 @@ endif
install_data('journald.conf',
install_dir : pkgsysconfdir)
meson.add_install_script(
'sh', '-c',
mkdir_p.format('/var/log/journal'))
meson.add_install_script(
'sh', '-c',
'''chown 0:0 $DESTDIR/var/log/journal &&
chmod 755 $DESTDIR/var/log/journal || :''')
if get_option('adm-group')
if get_option('create-log-dirs')
meson.add_install_script(
'sh', '-c',
'setfacl -nm g:adm:rx,d:g:adm:rx $DESTDIR/var/log/journal || :')
endif
if get_option('wheel-group')
mkdir_p.format('/var/log/journal'))
meson.add_install_script(
'sh', '-c',
'setfacl -nm g:wheel:rx,d:g:wheel:rx $DESTDIR/var/log/journal || :')
'''chown 0:0 $DESTDIR/var/log/journal &&
chmod 755 $DESTDIR/var/log/journal || :''')
if get_option('adm-group')
meson.add_install_script(
'sh', '-c',
'setfacl -nm g:adm:rx,d:g:adm:rx $DESTDIR/var/log/journal || :')
endif
if get_option('wheel-group')
meson.add_install_script(
'sh', '-c',
'setfacl -nm g:wheel:rx,d:g:wheel:rx $DESTDIR/var/log/journal || :')
endif
endif