%pre
# ugly workaround for changing qcom/LENOVO/21BX to a symlink (bsc#1204103)
if [ ! -L %{_firmwaredir}/qcom/LENOVO/21BX ]; then
  if [ -d %{_firmwaredir}/qcom/LENOVO/21BX ]; then
    mv %{_firmwaredir}/qcom/LENOVO/21BX %{_firmwaredir}/qcom/LENOVO/21BX.xxxold
  fi
fi

%post
# ugly workaround (bsc#1204103)
if [ -d %{_firmwaredir}/qcom/LENOVO/21BX.xxxold ]; then
  mv %{_firmwaredir}/qcom/LENOVO/21BX %{_firmwaredir}/qcom/LENOVO/21BX.xxxnew
  mv %{_firmwaredir}/qcom/LENOVO/21BX.xxxold %{_firmwaredir}/qcom/LENOVO/21BX
else
%{?regenerate_initrd_post}
fi

%postun
%{?regenerate_initrd_post}

%posttrans
# ugly workaround (bsc#1204103)
if [ -L %{_firmwaredir}/qcom/LENOVO/21BX.xxxnew ]; then
  rm -rf %{_firmwaredir}/qcom/LENOVO/21BX
  mv %{_firmwaredir}/qcom/LENOVO/21BX.xxxnew %{_firmwaredir}/qcom/LENOVO/21BX
fi
%{?regenerate_initrd_posttrans}
