]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Create credstore directories
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 24 May 2023 13:32:17 +0000 (15:32 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 25 May 2023 17:07:50 +0000 (19:07 +0200)
Let's make the creds directories a bit more discoverable and make it
easier for users to use them. This also allows us to fix the
mode to 0700 for /etc instead of the usual 0755 which is what probably
would happen if users had to create this directory themselves.

meson.build

index 496ca70ecc5d8ebf914f144e335d02ee60db94b9..97622b6d9731f2ccda89201357815847664709b1 100644 (file)
@@ -208,6 +208,7 @@ catalogstatedir = systemdstatedir / 'catalog'
 randomseeddir = localstatedir / 'lib/systemd'
 profiledir = rootlibexecdir / 'portable' / 'profile'
 ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
+credstoredir = prefixdir / 'lib/credstore'
 
 docdir = get_option('docdir')
 if docdir == ''
@@ -709,6 +710,7 @@ 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@'
 
 # If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
 # /usr/sbin, /sbin, and fall back to the default from middle column.
@@ -3844,6 +3846,14 @@ public_programs += executable(
         install : true,
         install_dir : rootbindir)
 
+# 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))
+if install_sysconfdir
+        meson.add_install_script('sh', '-c', mkdir_p_mode.format(sysconfdir / 'credstore', '0700'))
+endif
+
 executable(
         'systemd-volatile-root',
         'src/volatile-root/volatile-root.c',