diff options
-rw-r--r-- | hwdb.d/meson.build | 3 | ||||
-rw-r--r-- | man/meson.build | 8 | ||||
-rw-r--r-- | meson.build | 8 | ||||
-rw-r--r-- | network/meson.build | 3 | ||||
-rw-r--r-- | src/binfmt/meson.build | 6 | ||||
-rw-r--r-- | src/core/meson.build | 21 | ||||
-rw-r--r-- | src/creds/meson.build | 8 | ||||
-rw-r--r-- | src/dissect/meson.build | 7 | ||||
-rw-r--r-- | src/environment-d-generator/meson.build | 7 | ||||
-rw-r--r-- | src/fstab-generator/meson.build | 6 | ||||
-rw-r--r-- | src/journal-remote/meson.build | 7 | ||||
-rw-r--r-- | src/journal/meson.build | 9 | ||||
-rw-r--r-- | src/kernel-install/meson.build | 3 | ||||
-rw-r--r-- | src/modules-load/meson.build | 6 | ||||
-rw-r--r-- | src/mount/meson.build | 4 | ||||
-rw-r--r-- | src/resolve/meson.build | 15 | ||||
-rw-r--r-- | src/sysext/meson.build | 5 | ||||
-rw-r--r-- | src/systemctl/meson.build | 7 | ||||
-rw-r--r-- | src/udev/meson.build | 8 | ||||
-rw-r--r-- | sysctl.d/meson.build | 3 | ||||
-rw-r--r-- | test/meson.build | 5 | ||||
-rw-r--r-- | tmpfiles.d/meson.build | 3 | ||||
-rwxr-xr-x | tools/meson-make-symlink.sh | 22 | ||||
-rwxr-xr-x | units/meson-add-wants.sh | 41 | ||||
-rw-r--r-- | units/meson.build | 32 |
25 files changed, 82 insertions, 165 deletions
diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build index 12953e2b94..64a7e7d506 100644 --- a/hwdb.d/meson.build +++ b/hwdb.d/meson.build @@ -51,8 +51,7 @@ if conf.get('ENABLE_HWDB') == 1 install_dir : udevhwdbdir) if install_sysconfdir - meson.add_install_script('sh', '-c', - mkdir_p.format(sysconfdir / 'udev/hwdb.d')) + install_emptydir(sysconfdir / 'udev/hwdb.d') meson.add_install_script('sh', '-c', 'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(bindir)) diff --git a/man/meson.build b/man/meson.build index 4dc5fabd6d..f980fd2230 100644 --- a/man/meson.build +++ b/man/meson.build @@ -84,9 +84,7 @@ foreach tuple : manpages output : htmlalias, command : [ln, '-fs', html, '@OUTPUT@']) if want_html - dst = docdir / 'html' / htmlalias - cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst) - meson.add_install_script('sh', '-c', cmd) + meson.add_install_script(sh, '-c', ln_s.format(html, docdir / 'html' / htmlalias)) p2 += link endif html_pages += link @@ -157,9 +155,7 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv output : htmlalias, command : [ln, '-fs', html, '@OUTPUT@']) if want_html - dst = docdir / 'html' / htmlalias - cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst) - meson.add_install_script('sh', '-c', cmd) + meson.add_install_script(sh, '-c', ln_s.format(html, docdir / 'html' / htmlalias)) p2 += link endif html_pages += link diff --git a/meson.build b/meson.build index 0e1eecfd20..f37aa0aca5 100644 --- a/meson.build +++ b/meson.build @@ -111,6 +111,7 @@ endif prefixdir_noslash = '/' + prefixdir.strip('/') bindir = prefixdir / get_option('bindir') sbindir = prefixdir / (split_bin ? 'sbin' : 'bin') +sbin_to_bin = split_bin ? '../bin/' : '' libdir = prefixdir / get_option('libdir') sysconfdir = prefixdir / get_option('sysconfdir') includedir = prefixdir / get_option('includedir') @@ -642,10 +643,8 @@ env = find_program('env') rsync = find_program('rsync', required : false) diff = find_program('diff') find = find_program('find') -meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh' -mkdir_p = 'mkdir -p $DESTDIR/@0@' -mkdir_p_mode = 'mkdir -p $DESTDIR/@0@ -m @1@' +ln_s = ln.full_path() + ' -frsT -- "${DESTDIR:-}@0@" "${DESTDIR:-}@1@"' # If -Dxxx-path option is found, use that. Otherwise, check in $PATH, # /usr/sbin, /sbin, and fall back to the default from middle column. @@ -2781,8 +2780,7 @@ install_data('LICENSE.GPL2', install_subdir('LICENSES', install_dir : docdir) -meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir)) -meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir)) +install_emptydir(systemdstatedir) ############################################################ diff --git a/network/meson.build b/network/meson.build index 5e10c86372..b6745298f6 100644 --- a/network/meson.build +++ b/network/meson.build @@ -14,8 +14,7 @@ if conf.get('ENABLE_NETWORKD') == 1 install_dir : networkdir) if install_sysconfdir - meson.add_install_script('sh', '-c', - mkdir_p.format(sysconfdir / 'systemd/network')) + install_emptydir(sysconfdir / 'systemd/network') endif endif diff --git a/src/binfmt/meson.build b/src/binfmt/meson.build index e33f81aaa0..44963409bc 100644 --- a/src/binfmt/meson.build +++ b/src/binfmt/meson.build @@ -10,10 +10,8 @@ executables += [ ] if conf.get('ENABLE_BINFMT') == 1 - meson.add_install_script('sh', '-c', - mkdir_p.format(binfmtdir)) + install_emptydir(binfmtdir) if install_sysconfdir - meson.add_install_script('sh', '-c', - mkdir_p.format(sysconfdir / 'binfmt.d')) + install_emptydir(sysconfdir / 'binfmt.d') endif endif diff --git a/src/core/meson.build b/src/core/meson.build index 395342d754..9f1d84e3f9 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -201,20 +201,21 @@ install_data('org.freedesktop.systemd1.conf', install_data('org.freedesktop.systemd1.service', install_dir : dbussystemservicedir) -meson.add_install_script('sh', '-c', mkdir_p.format(systemshutdowndir)) -meson.add_install_script('sh', '-c', mkdir_p.format(systemsleepdir)) -meson.add_install_script('sh', '-c', mkdir_p.format(systemgeneratordir)) -meson.add_install_script('sh', '-c', mkdir_p.format(usergeneratordir)) +install_emptydir(systemshutdowndir) +install_emptydir(systemsleepdir) +install_emptydir(systemgeneratordir) +install_emptydir(usergeneratordir) if install_sysconfdir - meson.add_install_script('sh', '-c', mkdir_p.format(pkgsysconfdir / 'system')) - meson.add_install_script('sh', '-c', mkdir_p.format(pkgsysconfdir / 'user')) - meson.add_install_script('sh', '-c', mkdir_p.format(sysconfdir / 'xdg/systemd')) + 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')) endif -meson.add_install_script(meson_make_symlink, - libexecdir / 'systemd', - sbindir / 'init') +install_emptydir(sbindir) +meson.add_install_script(sh, '-c', ln_s.format(libexecdir / 'systemd', sbindir / 'init')) ############################################################ diff --git a/src/creds/meson.build b/src/creds/meson.build index 905c349635..85572568f6 100644 --- a/src/creds/meson.build +++ b/src/creds/meson.build @@ -15,9 +15,11 @@ executables += [ # Protecting files from the distro in /usr doesn't make sense since they can be trivially accessed otherwise, # so don't restrict the access mode in /usr. That doesn't apply to /etc, so we do restrict the access mode # there. -meson.add_install_script('sh', '-c', mkdir_p.format(credstoredir)) +install_emptydir(credstoredir) if install_sysconfdir # Keep in sync with tmpfiles.d/credstore.conf - meson.add_install_script('sh', '-c', mkdir_p_mode.format(sysconfdir / 'credstore', '0700')) - meson.add_install_script('sh', '-c', mkdir_p_mode.format(sysconfdir / 'credstore.encrypted', '0700')) + install_emptydir(sysconfdir / 'credstore', + install_mode : 'rwx------') + install_emptydir(sysconfdir / 'credstore.encrypted', + install_mode : 'rwx------') endif diff --git a/src/dissect/meson.build b/src/dissect/meson.build index 742b1377bc..e422dbdd27 100644 --- a/src/dissect/meson.build +++ b/src/dissect/meson.build @@ -10,7 +10,8 @@ executables += [ ] if conf.get('HAVE_BLKID') == 1 - meson.add_install_script(meson_make_symlink, - bindir / 'systemd-dissect', - sbindir / 'mount.ddi') + install_emptydir(sbindir) + meson.add_install_script(sh, '-c', + ln_s.format(bindir / 'systemd-dissect', + sbindir / 'mount.ddi')) endif diff --git a/src/environment-d-generator/meson.build b/src/environment-d-generator/meson.build index 6ff82b2a32..346be05bd0 100644 --- a/src/environment-d-generator/meson.build +++ b/src/environment-d-generator/meson.build @@ -10,7 +10,8 @@ executables += [ ] if conf.get('ENABLE_ENVIRONMENT_D') == 1 - meson.add_install_script(meson_make_symlink, - sysconfdir / 'environment', - environmentdir / '99-environment.conf') + install_emptydir(environmentdir) + meson.add_install_script(sh, '-c', + ln_s.format(sysconfdir / 'environment', + environmentdir / '99-environment.conf')) endif diff --git a/src/fstab-generator/meson.build b/src/fstab-generator/meson.build index 11de6ffd80..7b90580e90 100644 --- a/src/fstab-generator/meson.build +++ b/src/fstab-generator/meson.build @@ -7,6 +7,6 @@ executables += [ }, ] -meson.add_install_script(meson_make_symlink, - systemgeneratordir / 'systemd-fstab-generator', - libexecdir / 'systemd-sysroot-fstab-check') +meson.add_install_script(sh, '-c', + ln_s.format(systemgeneratordir / 'systemd-fstab-generator', + libexecdir / 'systemd-sysroot-fstab-check')) diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index e5a37466db..28c47043dc 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -113,10 +113,7 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 install_dir : pkgdatadir / 'gatewayd') 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 || :''') + install_emptydir('/var/log/journal/remote', + install_mode : [ 'rwxr-xr-x', 'root', 'root' ]) endif endif diff --git a/src/journal/meson.build b/src/journal/meson.build index 3412e273e5..e89f9d1bc5 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -184,13 +184,8 @@ if install_sysconfdir_samples endif if get_option('create-log-dirs') - 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 || :''') + install_emptydir('/var/log/journal', + install_mode : [ 'rwxr-xr-x', 'root', 'root' ]) if get_option('adm-group') meson.add_install_script( 'sh', '-c', diff --git a/src/kernel-install/meson.build b/src/kernel-install/meson.build index 0fa0c37ae2..7f61fcc516 100644 --- a/src/kernel-install/meson.build +++ b/src/kernel-install/meson.build @@ -44,8 +44,7 @@ if want_kernel_install install_dir : kerneldir) if install_sysconfdir - meson.add_install_script('sh', '-c', - mkdir_p.format(sysconfdir / 'kernel/install.d')) + install_emptydir(sysconfdir / 'kernel/install.d') endif endif diff --git a/src/modules-load/meson.build b/src/modules-load/meson.build index af5b4da384..2f1decc8b7 100644 --- a/src/modules-load/meson.build +++ b/src/modules-load/meson.build @@ -10,10 +10,8 @@ executables += [ ] if conf.get('HAVE_KMOD') == 1 - meson.add_install_script('sh', '-c', - mkdir_p.format(modulesloaddir)) + install_emptydir(modulesloaddir) if install_sysconfdir - meson.add_install_script('sh', '-c', - mkdir_p.format(sysconfdir / 'modules-load.d')) + install_emptydir(sysconfdir / 'modules-load.d') endif endif diff --git a/src/mount/meson.build b/src/mount/meson.build index 7b1af9ea57..176fb53dca 100644 --- a/src/mount/meson.build +++ b/src/mount/meson.build @@ -9,5 +9,5 @@ executables += [ }, ] -meson.add_install_script(meson_make_symlink, - 'systemd-mount', bindir / 'systemd-umount') +meson.add_install_script(sh, '-c', ln_s.format(bindir / 'systemd-mount', + bindir / 'systemd-umount')) diff --git a/src/resolve/meson.build b/src/resolve/meson.build index 5b4e583501..0f62d09087 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -220,13 +220,14 @@ if conf.get('ENABLE_RESOLVE') == 1 install_data('resolv.conf', install_dir : libexecdir) - meson.add_install_script(meson_make_symlink, - bindir / 'resolvectl', - sbindir / 'resolvconf') - - meson.add_install_script(meson_make_symlink, - bindir / 'resolvectl', - bindir / 'systemd-resolve') + install_emptydir(sbindir) + meson.add_install_script(sh, '-c', + ln_s.format(bindir / 'resolvectl', + sbindir / 'resolvconf')) + + meson.add_install_script(sh, '-c', + ln_s.format(bindir / 'resolvectl', + bindir / 'systemd-resolve')) endif custom_target( diff --git a/src/sysext/meson.build b/src/sysext/meson.build index e58888ade3..2983970d80 100644 --- a/src/sysext/meson.build +++ b/src/sysext/meson.build @@ -10,7 +10,6 @@ executables += [ ] if conf.get('ENABLE_SYSEXT') == 1 - meson.add_install_script(meson_make_symlink, - bindir / 'systemd-sysext', - bindir / 'systemd-confext') + meson.add_install_script(sh, '-c', ln_s.format(bindir / 'systemd-sysext', + bindir / 'systemd-confext')) endif diff --git a/src/systemctl/meson.build b/src/systemctl/meson.build index bc08b8672f..255c639b5f 100644 --- a/src/systemctl/meson.build +++ b/src/systemctl/meson.build @@ -75,7 +75,8 @@ executables += [ foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] + (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : [])) - meson.add_install_script(meson_make_symlink, - bindir / 'systemctl', - sbindir / alias) + install_emptydir(sbindir) + meson.add_install_script(sh, '-c', + ln_s.format(bindir / 'systemctl', + sbindir / alias)) endforeach diff --git a/src/udev/meson.build b/src/udev/meson.build index 200cc05546..40716bb27d 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -247,9 +247,8 @@ executables += [ }, ] -meson.add_install_script(meson_make_symlink, - bindir / 'udevadm', - libexecdir / 'systemd-udevd') +meson.add_install_script(sh, '-c', ln_s.format(bindir / 'udevadm', + libexecdir / 'systemd-udevd')) if install_sysconfdir_samples install_data('udev.conf', @@ -268,6 +267,5 @@ udev_pc = custom_target( install_dir : pkgconfigdatadir) if install_sysconfdir - meson.add_install_script('sh', '-c', - mkdir_p.format(sysconfdir / 'udev/rules.d')) + install_emptydir(sysconfdir / 'udev/rules.d') endif diff --git a/sysctl.d/meson.build b/sysctl.d/meson.build index ecec903d1b..909baa2be3 100644 --- a/sysctl.d/meson.build +++ b/sysctl.d/meson.build @@ -21,6 +21,5 @@ custom_target( install_dir : sysctldir) if install_sysconfdir - meson.add_install_script('sh', '-c', - mkdir_p.format(sysconfdir / 'sysctl.d')) + install_emptydir(sysconfdir / 'sysctl.d') endif diff --git a/test/meson.build b/test/meson.build index 97ec7ee5c5..836a506ed8 100644 --- a/test/meson.build +++ b/test/meson.build @@ -44,9 +44,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(meson_make_symlink, - testdata_dir, - unittestsdir / 'testdata') + meson.add_install_script(sh, '-c', ln_s.format(testdata_dir, + unittestsdir / 'testdata')) endif ############################################################ diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build index 4d94e3743f..4c11ad6e20 100644 --- a/tmpfiles.d/meson.build +++ b/tmpfiles.d/meson.build @@ -54,6 +54,5 @@ foreach pair : in_files endforeach if enable_tmpfiles and install_sysconfdir - meson.add_install_script( - 'sh', '-c', mkdir_p.format(sysconfdir / 'tmpfiles.d')) + install_emptydir(sysconfdir / 'tmpfiles.d') endif diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh deleted file mode 100755 index 653a73b0bd..0000000000 --- a/tools/meson-make-symlink.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: LGPL-2.1-or-later -set -eu - -SOURCE="${1:?}" -TARGET="${2:?}" - -if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then - VERBOSE="" -else - VERBOSE="v" -fi - -# this is needed mostly because $DESTDIR is provided as a variable, -# and we need to create the target directory... - -mkdir -${VERBOSE}p "$(dirname "${DESTDIR:-}$TARGET")" -if [ "$(dirname "$SOURCE")" = . ] || [ "$(dirname "$SOURCE")" = .. ]; then - ln -${VERBOSE}fs -T -- "$SOURCE" "${DESTDIR:-}$TARGET" -else - ln -${VERBOSE}fs -T --relative -- "${DESTDIR:-}$SOURCE" "${DESTDIR:-}$TARGET" -fi diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh deleted file mode 100755 index 6d8da57402..0000000000 --- a/units/meson-add-wants.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: LGPL-2.1-or-later -# shellcheck disable=SC2154,SC2174 -set -eu - -i=1 -while [ $i -lt $# ] ; do - eval unitdir="\${$i}" - eval target="\${$((i + 1))}" - eval unit="\${$((i + 2))}" - - if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then - VERBOSE="" - else - VERBOSE="v" - fi - - case "$target" in - */?*) # a path, but not just a slash at the end - dir="${DESTDIR:-}${target}" - ;; - *) - dir="${DESTDIR:-}${unitdir}/${target}" - ;; - esac - - unitpath="${DESTDIR:-}${unitdir}/${unit}" - - case "$target" in - */) - mkdir -${VERBOSE}p -m 0755 "$dir" - ;; - *) - mkdir -${VERBOSE}p -m 0755 "$(dirname "$dir")" - ;; - esac - - ln -${VERBOSE}fs --relative "$unitpath" "$dir" - - i=$((i + 3)) -done diff --git a/units/meson.build b/units/meson.build index 5161ec5029..96ad1dc850 100644 --- a/units/meson.build +++ b/units/meson.build @@ -634,8 +634,6 @@ units = [ }, ] -add_wants = [] - foreach unit : units source = unit.get('file') @@ -672,13 +670,20 @@ foreach unit : units if install foreach target : unit.get('symlinks', []) - add_wants += [systemunitdir, target, name] + if target.endswith('/') + install_emptydir(systemunitdir / target) + meson.add_install_script(sh, '-c', + ln_s.format(systemunitdir / name, + systemunitdir / target / name)) + else + meson.add_install_script(sh, '-c', + ln_s.format(systemunitdir / name, + systemunitdir / target)) + endif endforeach endif endforeach -meson.add_install_script('meson-add-wants.sh', add_wants) - install_data('user-.slice.d/10-defaults.conf', install_dir : systemunitdir + '/user-.slice.d') @@ -689,19 +694,14 @@ install_data('user@0.service.d/10-login-barrier.conf', ############################################################ -if install_sysconfdir - meson.add_install_script(meson_make_symlink, - pkgsysconfdir / 'user', - sysconfdir / 'xdg/systemd/user') -endif -meson.add_install_script(meson_make_symlink, - dbussystemservicedir / 'org.freedesktop.systemd1.service', - dbussessionservicedir / 'org.freedesktop.systemd1.service') +install_emptydir(dbussessionservicedir) +meson.add_install_script(sh, '-c', + ln_s.format(dbussystemservicedir / 'org.freedesktop.systemd1.service', + dbussessionservicedir / 'org.freedesktop.systemd1.service')) + if conf.get('HAVE_SYSV_COMPAT') == 1 foreach i : [1, 2, 3, 4, 5] - meson.add_install_script( - 'sh', '-c', - mkdir_p.format(systemunitdir / 'runlevel@0@.target.wants'.format(i))) + install_emptydir(systemunitdir / 'runlevel@0@.target.wants'.format(i)) endforeach endif |