# Only run this if we aren't in the installer.
# We'll do these things after the install.
# First we'll check for an old version of setup.01.mkinitrd. If we find one,
# let's skip all this. We could be upgrading from 15.0...
if [ -r var/lib/pkgtools/setup/setup.01.mkinitrd ]; then
  if ! grep -wq vmlinuz-generic-smp var/lib/pkgtools/setup/setup.01.mkinitrd 2> /dev/null ; then
    if [ -z "$INSIDE_INSTALLER" ]; then
      # If there's anything registered with DKMS, then rebuild the initrd since
      # DKMS might have tried to compile some kernel modules before the kernel
      # source tree was available and failed.
      if ls var/lib/dkms/* 1> /dev/null 2> /dev/null ; then
        # Generate the initrd and remove orphaned initrds.
        # Options (including disabling this) may be found in /etc/default/geninitrd.
        if [ -x usr/sbin/geninitrd ]; then
          usr/sbin/geninitrd
        fi
      fi
    fi
  fi
fi
