/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to debian/mandos-client.postinst

  • Committer: Teddy Hogeborn
  • Date: 2024-09-08 02:14:29 UTC
  • mto: This revision was merged to the branch mainline in revision 410.
  • Revision ID: teddy@recompile.se-20240908021429-z4m1vfuaqbs0q3ry
Fix file permissions when installing a new kernel, with dracut

* debian/mandos-client.postinst (update_initramfs): When using dracut,
  but the initramfs image file does not yet exist (due to the kernel
  package not having been configured), create a new empty file with
  the correct permissions, so that dracut will use the correct
  permissions when creating the initramfs image file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
            # Dracut preserves old permissions of initramfs image
38
38
            # files, so we adjust permissions before creating new
39
39
            # initramfs image containing secret keys.
40
 
            chmod go-r /boot/initrd.img-"$kversion"
 
40
            if [ -e /boot/initrd.img-"$kversion" ]; then
 
41
                chmod go-r /boot/initrd.img-"$kversion"
 
42
            else
 
43
                # An initrd image has not yet been created for this
 
44
                # kernel, possibly because this new kernel is about to
 
45
                # be, but has not yet been, installed.  In this case,
 
46
                # we create an empty file with the right permissions
 
47
                # so that Dracut will preserve those permissions when
 
48
                # it creates the real, new initrd image for this
 
49
                # kernel.
 
50
                install --mode=u=rw /dev/null \
 
51
                        /boot/initrd.img-"$kversion"
 
52
            fi
41
53
            if [ "$kversion" != "*" ]; then
42
54
                /etc/kernel/postinst.d/dracut "$kversion"
43
55
            fi