opi5-efi/opi5-efi.spec
2023-10-05 05:30:41 +05:30

46 lines
1.2 KiB
RPMSpec

# disable the '-debug{info,source}' pkgs
%define debug_package %{nil}
# also disable packaging files in '/usr/lib/.build-id/'
%define _build_id_links none
Name: opi5-efi
Version: 0.0.1
Release: %{rel_ver}%{?dist}
Summary: Necessary files for booting from vendor U-Boot on Orange Pi 5
License: GPL
Provides: %{name}-%{version}
Requires: uboot-tools
%global full_ver %{version}-%{release}
Source0: boot.cmd
Source1: uEnv.txt
%prep
echo "Nothing to prepare"
%build
echo "Nothing to build"
%install
cp ${SOURCE0} $RPM_BUILD_ROOT/boot/boot.cmd-%{full_ver}
cp ${SOURCE1} $RPM_BUILD_ROOT/boot/uEnv.txt-%{full_ver}
%clean
rm -rf $RPM_BUILD_ROOT
%post
set -xeuf -o pipefail
if [ -f /boot/.uname ]; then
UNAME_R=$(</boot/.uname)
BOOT_PART=$(grep '/ ' /etc/fstab | awk '{print $1}')
echo "${BOOT_PART}" >> /boot/uEnv.txt-%{full_ver}
sed -i "s/setenvrootdev/setenv rootdev \"${BOOT_PART}\"/" /boot/boot.cmd-%{full_ver}
sed -i "s/setenvunamer/setenv unamer \"${UNAME_R}\"/" /boot/boot.cmd-%{full_ver}
else
echo "ERROR: No /boot/.uname found to extract 'uname -r' from."
fi
mkimage -C none -A arm -T script -d /boot/boot.cmd-%{full_ver} /boot/boot.scr-%{full_ver}
cp /boot/boot.scr-%{full_ver} /boot/boot.scr