mirror of
https://github.com/systemd/systemd
synced 2025-10-05 16:03:15 +02:00
meson: use install_symlink() where applicable
Now our baseline of meson is 0.62, hence install_symlink() can be used. Note, install_symlink() implies install_emptydir() for specified install_dir. Hence, this also drops several unnecessary install_emptydir() calls. Note, the function currently does not support 'relative' and 'force' flags, so several 'ln -frsT' inline calls cannot be replaced.
This commit is contained in:
@@ -92,7 +92,9 @@ foreach tuple : manpages
|
||||
output : htmlalias,
|
||||
command : [ln, '-fs', html, '@OUTPUT@'])
|
||||
if want_html
|
||||
meson.add_install_script(sh, '-c', ln_s.format(docdir / 'html' / html, docdir / 'html' / htmlalias))
|
||||
install_symlink(htmlalias,
|
||||
pointing_to : html,
|
||||
install_dir : docdir / 'html')
|
||||
p2 += link
|
||||
endif
|
||||
html_pages += link
|
||||
@@ -163,7 +165,9 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv
|
||||
output : htmlalias,
|
||||
command : [ln, '-fs', html, '@OUTPUT@'])
|
||||
if want_html
|
||||
meson.add_install_script(sh, '-c', ln_s.format(docdir / 'html' / html, docdir / 'html' / htmlalias))
|
||||
install_symlink(htmlalias,
|
||||
pointing_to : html,
|
||||
install_dir : docdir / 'html')
|
||||
p2 += link
|
||||
endif
|
||||
html_pages += link
|
||||
|
@@ -127,6 +127,7 @@ datadir = prefixdir / get_option('datadir')
|
||||
localstatedir = '/' / get_option('localstatedir')
|
||||
|
||||
libexecdir = prefixdir / 'lib/systemd'
|
||||
libexecdir_to_bin = '../../bin/'
|
||||
pkglibdir = libdir / 'systemd'
|
||||
|
||||
install_sysconfdir = get_option('install-sysconfdir') != 'false'
|
||||
@@ -2635,9 +2636,9 @@ if want_ukify
|
||||
public_programs += ukify
|
||||
|
||||
# symlink for backwards compatibility after rename
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(bindir / 'ukify',
|
||||
libexecdir / 'ukify'))
|
||||
install_symlink('ukify',
|
||||
pointing_to : libexecdir_to_bin / 'ukify',
|
||||
install_dir : libexecdir)
|
||||
endif
|
||||
|
||||
#####################################################################
|
||||
|
@@ -4,15 +4,33 @@ install_data('70-systemd-shell-extra.sh', install_dir : shellprofiledir.startswi
|
||||
install_data('80-systemd-osc-context.sh', install_dir : shellprofiledir.startswith('/usr/') ? shellprofiledir : libexecdir / 'profile.d')
|
||||
|
||||
if conf.get('LINK_SHELL_EXTRA_DROPIN') == 1
|
||||
install_emptydir(shellprofiledir)
|
||||
if meson.version().version_compare('>=1.3.0')
|
||||
install_symlink(
|
||||
'70-systemd-shell-extra.sh',
|
||||
pointing_to : fs.relative_to(libexecdir / 'profile.d' / '70-systemd-shell-extra.sh',
|
||||
shellprofiledir),
|
||||
install_dir : shellprofiledir)
|
||||
else
|
||||
install_emptydir(shellprofiledir)
|
||||
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(libexecdir / 'profile.d' / '70-systemd-shell-extra.sh', shellprofiledir / '70-systemd-shell-extra.sh'))
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(libexecdir / 'profile.d' / '70-systemd-shell-extra.sh',
|
||||
shellprofiledir / '70-systemd-shell-extra.sh'))
|
||||
endif
|
||||
endif
|
||||
|
||||
if conf.get('LINK_OSC_CONTEXT_DROPIN') == 1
|
||||
install_emptydir(shellprofiledir)
|
||||
if meson.version().version_compare('>=1.3.0')
|
||||
install_symlink(
|
||||
'80-systemd-osc-context.sh',
|
||||
pointing_to : fs.relative_to(libexecdir / 'profile.d' / '80-systemd-osc-context.sh',
|
||||
shellprofiledir),
|
||||
install_dir : shellprofiledir)
|
||||
else
|
||||
install_emptydir(shellprofiledir)
|
||||
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(libexecdir / 'profile.d' / '80-systemd-osc-context.sh', shellprofiledir / '80-systemd-osc-context.sh'))
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(libexecdir / 'profile.d' / '80-systemd-osc-context.sh',
|
||||
shellprofiledir / '80-systemd-osc-context.sh'))
|
||||
endif
|
||||
endif
|
||||
|
@@ -260,13 +260,17 @@ install_emptydir(usergeneratordir)
|
||||
if install_sysconfdir
|
||||
install_emptydir(pkgsysconfdir / 'system')
|
||||
install_emptydir(pkgsysconfdir / 'user')
|
||||
install_emptydir(sysconfdir / 'xdg/systemd')
|
||||
meson.add_install_script(sh, '-c', ln_s.format(pkgsysconfdir / 'user',
|
||||
sysconfdir / 'xdg/systemd/user'))
|
||||
|
||||
assert(sysconfdir / 'systemd' == pkgsysconfdir)
|
||||
install_symlink('user',
|
||||
pointing_to : '../../systemd/user',
|
||||
install_dir : sysconfdir / 'xdg/systemd')
|
||||
endif
|
||||
|
||||
install_emptydir(sbindir)
|
||||
meson.add_install_script(sh, '-c', ln_s.format(libexecdir / 'systemd', sbindir / 'init'))
|
||||
assert(fs.parent(sbindir) / 'lib/systemd' == libexecdir)
|
||||
install_symlink('init',
|
||||
pointing_to : '../lib/systemd/systemd',
|
||||
install_dir : sbindir)
|
||||
|
||||
############################################################
|
||||
|
||||
|
@@ -33,6 +33,6 @@ executables += [
|
||||
]
|
||||
|
||||
# symlink for backwards compatibility after rename
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(bindir / 'systemd-cryptsetup',
|
||||
libexecdir / 'systemd-cryptsetup'))
|
||||
install_symlink('systemd-cryptsetup',
|
||||
pointing_to : libexecdir_to_bin / 'systemd-cryptsetup',
|
||||
install_dir : libexecdir)
|
||||
|
@@ -12,7 +12,6 @@ executables += [
|
||||
},
|
||||
]
|
||||
|
||||
install_emptydir(sbindir)
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(bindir / 'systemd-dissect',
|
||||
sbindir / 'mount.ddi'))
|
||||
install_symlink('mount.ddi',
|
||||
pointing_to : sbin_to_bin + 'systemd-dissect',
|
||||
install_dir : sbindir)
|
||||
|
@@ -13,6 +13,9 @@ executables += [
|
||||
]
|
||||
|
||||
install_emptydir(environmentdir)
|
||||
# install_symlink() does not support broken symlink, and /etc/environment is not managed by us, thus
|
||||
# may not exist. Hence, we need to create it by using the custom install script here.
|
||||
# See https://github.com/mesonbuild/meson/pull/12266 .
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(sysconfdir / 'environment',
|
||||
environmentdir / '99-environment.conf'))
|
||||
|
@@ -7,6 +7,7 @@ executables += [
|
||||
},
|
||||
]
|
||||
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(systemgeneratordir / 'systemd-fstab-generator',
|
||||
libexecdir / 'systemd-sysroot-fstab-check'))
|
||||
assert(libexecdir / fs.name(systemgeneratordir) == systemgeneratordir)
|
||||
install_symlink('systemd-sysroot-fstab-check',
|
||||
pointing_to : fs.name(systemgeneratordir) / 'systemd-fstab-generator',
|
||||
install_dir : libexecdir)
|
||||
|
@@ -140,6 +140,6 @@ if install_sysconfdir_samples
|
||||
install_dir : pkgconfigfiledir)
|
||||
endif
|
||||
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(bindir / 'homectl',
|
||||
bindir / 'systemd-home-fallback-shell'))
|
||||
install_symlink('systemd-home-fallback-shell',
|
||||
pointing_to : 'homectl',
|
||||
install_dir : bindir)
|
||||
|
@@ -9,5 +9,6 @@ executables += [
|
||||
},
|
||||
]
|
||||
|
||||
meson.add_install_script(sh, '-c', ln_s.format(bindir / 'systemd-mount',
|
||||
bindir / 'systemd-umount'))
|
||||
install_symlink('systemd-umount',
|
||||
pointing_to : 'systemd-mount',
|
||||
install_dir : bindir)
|
||||
|
@@ -311,15 +311,14 @@ if conf.get('ENABLE_RESOLVE') == 1
|
||||
install_data('resolv.conf',
|
||||
install_dir : libexecdir)
|
||||
|
||||
install_emptydir(sbindir)
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(bindir / 'resolvectl',
|
||||
sbindir / 'resolvconf'))
|
||||
install_symlink('resolvconf',
|
||||
pointing_to : sbin_to_bin + 'resolvectl',
|
||||
install_dir : sbindir)
|
||||
|
||||
# symlink for backwards compatibility after rename
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(bindir / 'resolvectl',
|
||||
bindir / 'systemd-resolve'))
|
||||
install_symlink('systemd-resolve',
|
||||
pointing_to : 'resolvectl',
|
||||
install_dir : bindir)
|
||||
endif
|
||||
|
||||
custom_target(
|
||||
|
@@ -8,11 +8,9 @@ executables += [
|
||||
},
|
||||
]
|
||||
|
||||
install_emptydir(bindir)
|
||||
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(bindir / 'systemd-run',
|
||||
bindir / 'run0'))
|
||||
install_symlink('run0',
|
||||
pointing_to : 'systemd-run',
|
||||
install_dir : bindir)
|
||||
|
||||
custom_target(
|
||||
'systemd-run0',
|
||||
|
@@ -21,9 +21,18 @@ if conf.get('ENABLE_SSH_PROXY_CONFIG') == 1
|
||||
install_dir : sshconfdir.startswith('/usr/') ? sshconfdir : libexecdir / 'ssh_config.d')
|
||||
|
||||
if conf.get('LINK_SSH_PROXY_DROPIN') == 1
|
||||
install_emptydir(sshconfdir)
|
||||
if meson.version().version_compare('>=1.3.0')
|
||||
install_symlink(
|
||||
'20-systemd-ssh-proxy.conf',
|
||||
pointing_to : fs.relative_to(libexecdir / 'ssh_config.d' / '20-systemd-ssh-proxy.conf',
|
||||
sshconfdir),
|
||||
install_dir : sshconfdir)
|
||||
else
|
||||
install_emptydir(sshconfdir)
|
||||
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(libexecdir / 'ssh_config.d' / '20-systemd-ssh-proxy.conf', sshconfdir / '20-systemd-ssh-proxy.conf'))
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(libexecdir / 'ssh_config.d' / '20-systemd-ssh-proxy.conf',
|
||||
sshconfdir / '20-systemd-ssh-proxy.conf'))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@@ -10,6 +10,7 @@ executables += [
|
||||
]
|
||||
|
||||
if conf.get('ENABLE_SYSEXT') == 1
|
||||
meson.add_install_script(sh, '-c', ln_s.format(bindir / 'systemd-sysext',
|
||||
bindir / 'systemd-confext'))
|
||||
install_symlink('systemd-confext',
|
||||
pointing_to : 'systemd-sysext',
|
||||
install_dir : bindir)
|
||||
endif
|
||||
|
@@ -75,8 +75,7 @@ executables += [
|
||||
|
||||
foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
|
||||
(conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
|
||||
install_emptydir(sbindir)
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(bindir / 'systemctl',
|
||||
sbindir / alias))
|
||||
install_symlink(alias,
|
||||
pointing_to : sbin_to_bin + 'systemctl',
|
||||
install_dir : sbindir)
|
||||
endforeach
|
||||
|
@@ -269,9 +269,10 @@ executables += [
|
||||
},
|
||||
]
|
||||
|
||||
meson.add_install_script(sh, '-c', ln_s.format(bindir / 'udevadm',
|
||||
libexecdir / 'systemd-udevd'),
|
||||
install_tag : 'udev')
|
||||
install_symlink('systemd-udevd',
|
||||
pointing_to : libexecdir_to_bin + 'udevadm',
|
||||
install_dir : libexecdir,
|
||||
install_tag : 'udev')
|
||||
|
||||
if install_sysconfdir_samples
|
||||
install_data('udev.conf',
|
||||
|
@@ -34,9 +34,18 @@ if conf.get('ENABLE_SSH_USERDB_CONFIG') == 1
|
||||
install_dir : sshdconfdir.startswith('/usr/') ? sshdconfdir : libexecdir / 'sshd_config.d')
|
||||
|
||||
if conf.get('LINK_SSHD_USERDB_DROPIN') == 1
|
||||
install_emptydir(sshdconfdir)
|
||||
if meson.version().version_compare('>=1.3.0')
|
||||
install_symlink(
|
||||
'20-systemd-userdb.conf',
|
||||
pointing_to : fs.relative_to(libexecdir / 'sshd_config.d' / '20-systemd-userdb.conf',
|
||||
sshdconfdir),
|
||||
install_dir : sshdconfdir)
|
||||
else
|
||||
install_emptydir(sshdconfdir)
|
||||
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(libexecdir / 'sshd_config.d' / '20-systemd-userdb.conf', sshdconfdir / '20-systemd-userdb.conf'))
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(libexecdir / 'sshd_config.d' / '20-systemd-userdb.conf',
|
||||
sshdconfdir / '20-systemd-userdb.conf'))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@@ -506,6 +506,8 @@ if install_tests
|
||||
|
||||
# The unit tests implemented as shell scripts expect to find testdata/
|
||||
# in the directory where they are stored.
|
||||
meson.add_install_script(sh, '-c', ln_s.format(testdata_dir,
|
||||
unittestsdir / 'testdata'))
|
||||
assert(fs.parent(unittestsdir) / 'testdata' == testdata_dir)
|
||||
install_symlink('testdata',
|
||||
pointing_to : '../testdata',
|
||||
install_dir : unittestsdir)
|
||||
endif
|
||||
|
@@ -922,16 +922,17 @@ foreach unit : units
|
||||
if install
|
||||
foreach target : unit.get('symlinks', [])
|
||||
if target.endswith('/')
|
||||
install_emptydir(systemunitdir / target, install_tag : unit.get('install_tag', ''))
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(systemunitdir / name,
|
||||
systemunitdir / target / name),
|
||||
install_tag : unit.get('install_tag', ''))
|
||||
# '/' is only allowed at the end of the target
|
||||
assert(target.replace('/', '') + '/' == target)
|
||||
install_symlink(name,
|
||||
pointing_to : '..' / name,
|
||||
install_dir : systemunitdir / target,
|
||||
install_tag : unit.get('install_tag', ''))
|
||||
else
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(systemunitdir / name,
|
||||
systemunitdir / target),
|
||||
install_tag : unit.get('install_tag', ''))
|
||||
install_symlink(target,
|
||||
pointing_to : name,
|
||||
install_dir : systemunitdir,
|
||||
install_tag : unit.get('install_tag', ''))
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
@@ -947,10 +948,18 @@ install_data('user@0.service.d/10-login-barrier.conf',
|
||||
|
||||
############################################################
|
||||
|
||||
install_emptydir(dbussessionservicedir)
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(dbussystemservicedir / 'org.freedesktop.systemd1.service',
|
||||
dbussessionservicedir / 'org.freedesktop.systemd1.service'))
|
||||
if meson.version().version_compare('>=1.3.0')
|
||||
install_symlink(
|
||||
'org.freedesktop.systemd1.service',
|
||||
pointing_to : fs.relative_to(dbussystemservicedir / 'org.freedesktop.systemd1.service',
|
||||
dbussessionservicedir),
|
||||
install_dir : dbussessionservicedir)
|
||||
else
|
||||
install_emptydir(dbussessionservicedir)
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(dbussystemservicedir / 'org.freedesktop.systemd1.service',
|
||||
dbussessionservicedir / 'org.freedesktop.systemd1.service'))
|
||||
endif
|
||||
|
||||
if conf.get('HAVE_SYSV_COMPAT') == 1
|
||||
foreach i : [1, 2, 3, 4, 5]
|
||||
|
@@ -50,14 +50,15 @@ foreach unit : units
|
||||
|
||||
foreach target : unit.get('symlinks', [])
|
||||
if target.endswith('/')
|
||||
install_emptydir(userunitdir / target)
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(userunitdir / file,
|
||||
userunitdir / target / file))
|
||||
# '/' is only allowed at the end of the target
|
||||
assert(target.replace('/', '') + '/' == target)
|
||||
install_symlink(file,
|
||||
pointing_to : '..' / file,
|
||||
install_dir : userunitdir / target)
|
||||
else
|
||||
meson.add_install_script(sh, '-c',
|
||||
ln_s.format(userunitdir / file,
|
||||
userunitdir / target))
|
||||
install_symlink(target,
|
||||
pointing_to : file,
|
||||
install_dir : userunitdir)
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
|
Reference in New Issue
Block a user