#!/usr/bin/env bash
#
# Rebuild the initrds for all kernels found in /usr/lib/modules
#
# Run dracut for all the installed kernels

# This script requires passing a valid file to regenerate all initrds so we pass a file we know will exist

if [[ $EUID -ne 0 ]]; then
	echo -e "\033[1;31mThis script needs to be run as root.\033[0m"
	exit 1
fi

# Devario owns generation and boot entries as one workflow when installed.
if [[ -x /usr/lib/devario/boot-update ]]; then
	exec /usr/lib/devario/boot-update
fi

/usr/share/rlpm/scripts/dracut-install < "/usr/bin/dracut-rebuild"
