Skip to content

Commit

Permalink
Skip postinstall if detect running in Anaconda / kickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
kmittman committed Jul 28, 2020
1 parent 4368939 commit 2728e48
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions nvidia-kmod-common.spec
Expand Up @@ -83,23 +83,29 @@ install -p -m 0644 %{SOURCE24} %{buildroot}%{_dracut_conf_d}/
install -p -m 644 %{SOURCE21} %{buildroot}%{_udevrulesdir}

%post
%{_grubby} --args='%{_dracutopts}' --remove-args='%{_dracutopts_rm}' &>/dev/null
%if 0%{?fedora} || 0%{?rhel} >= 7
if [ ! -f /run/ostree-booted ]; then
. %{_sysconfdir}/default/grub
if [ -z "${GRUB_CMDLINE_LINUX}" ]; then
echo GRUB_CMDLINE_LINUX="%{_dracutopts}" >> %{_sysconfdir}/default/grub
else
for param in %{_dracutopts}; do
echo ${GRUB_CMDLINE_LINUX} | grep -q $param
[ $? -eq 1 ] && GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} ${param}"
done
for param in %{_dracutopts_rm}; do
echo ${GRUB_CMDLINE_LINUX} | grep -q $param
[ $? -eq 0 ] && GRUB_CMDLINE_LINUX="$(echo ${GRUB_CMDLINE_LINUX} | sed -e "s/$param//g")"
done
sed -i -e "s|^GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX=\"${GRUB_CMDLINE_LINUX}\"|g" %{_sysconfdir}/default/grub
type -p grubby && grubby --help >/dev/null
checkGrubby=$?
if [ $checkGrubby -eq 0 ]; then
%{_grubby} --args='%{_dracutopts}' --remove-args='%{_dracutopts_rm}' &>/dev/null
%if 0%{?fedora} || 0%{?rhel} >= 7
if [ ! -f /run/ostree-booted ]; then
. %{_sysconfdir}/default/grub
if [ -z "${GRUB_CMDLINE_LINUX}" ]; then
echo GRUB_CMDLINE_LINUX="%{_dracutopts}" >> %{_sysconfdir}/default/grub
else
for param in %{_dracutopts}; do
echo ${GRUB_CMDLINE_LINUX} | grep -q $param
[ $? -eq 1 ] && GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} ${param}"
done
for param in %{_dracutopts_rm}; do
echo ${GRUB_CMDLINE_LINUX} | grep -q $param
[ $? -eq 0 ] && GRUB_CMDLINE_LINUX="$(echo ${GRUB_CMDLINE_LINUX} | sed -e "s/$param//g")"
done
sed -i -e "s|^GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX=\"${GRUB_CMDLINE_LINUX}\"|g" %{_sysconfdir}/default/grub
fi
fi
else
echo "Skipping grubby, running in Anaconda"
fi
%endif

Expand Down

0 comments on commit 2728e48

Please sign in to comment.