File ventoy.spec of Package ventoy
Name: ventoy
Version: 1.0.99
Release: 1%{?dist}
Summary: A new bootable USB solution
License: GPL-3.0
URL: https://www.ventoy.net
Source0: %{name}_icons-%version.tar
Source1: https://github.com/ventoy/Ventoy/releases/download/v%{version}/ventoy-%{version}-linux.tar.gz
Source2: %{name}.desktop
Source3: VentoyGUI.sh
Requires: xz
Requires: util-linux
BuildRequires: tar
BuildRequires: ImageMagick
BuildRequires: fdupes
ExclusiveArch: x86_64 i386 aarch64 mips64el
%description
Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files.
With ventoy, you don't need to format the disk over and over, you just need to copy the image files to the USB drive and boot it. You can copy many image files at a time and ventoy will give you a boot menu to select them. You can also browse ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them.
x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported in the same way.
Both MBR and GPT partition style are supported in the same way.
Most type of OS supported(Windows/WinPE/Linux/Unix/ChromeOS/Vmware/Xen...). 1200+ ISO files are tested. 90%%+ distros on distrowatch.com are supported.
%prep
rm -rf %{_builddir}
mkdir -p %{_builddir}
cd %{_builddir}
/usr/lib/rpm/rpmuncompress -x %{SOURCE0}
/usr/lib/rpm/rpmuncompress -x %{SOURCE1}
cp %name-%version/README .
%build
%install
mkdir -p %{buildroot}%{_libdir}
cp -r %{_builddir}/%{name}-%{version} %{buildroot}%{_libdir}/%{name}
for i in ventoy_lib.sh VentoyWorker.sh;do
sed -i '1s+.*+#!/bin/bash+' %{buildroot}%{_libdir}/%{name}/"tool/$i"
done
# Removing binaries of foreign architectures
find %{buildroot}%{_libdir}/%{name} -maxdepth 1 -type f -name "VentoyGUI.*" -not -name "VentoyGUI.%{_arch}" -delete
find %{buildroot}%{_libdir}/%{name}/tool -maxdepth 1 -type d -not -name "%{_arch}" -not -name tool -exec rm -rf {} \;
# Uncompressing binary blobs
xz --decompress %{buildroot}%{_libdir}/%{name}/tool/%{_arch}/*.xz
echo -n xzcat hexdump | xargs --replace=BIN --max-args=1 --delimiter=' ' \
ln -sf /usr/bin/BIN %{buildroot}%{_libdir}/%{name}/tool/%{_arch}/BIN
# Populating bin directory
install -D -m755 %{SOURCE3} %{buildroot}%{_bindir}/VentoyGUI
find %{buildroot}%{_libdir}/%{name} -maxdepth 1 -type f -name "*.sh" -executable | while read script; do
script_basename="$(basename "$script")"
bin_name="$script_basename"
case "$script_basename" in
Ventoy*) bin_name="${bin_name%.*}";;
*) bin_name="Ventoy${bin_name%.*}" ;;
esac
printf "#!/bin/bash\ncd '%{_libdir}/%{name}'\nexec \"\${PWD}/$script_basename\" \"\$@\"\n" > "%{buildroot}%{_bindir}/$bin_name"
done
chmod 755 %{buildroot}%{_bindir}/*
# Installing desktop files
install -D -m644 %{SOURCE2} %{buildroot}%{_datadir}/applications/%{name}.desktop
find %{_builddir}/%{name}_icons-%version/ICON -name "logo_*.png" | while read icon; do
icon_ext="${icon##*.}"
icon_size="$(identify -format "%wx%h\n" "$icon")"
install -D -m644 "$icon" %{buildroot}%{_datadir}/icons/hicolor/${icon_size}/apps/%{name}.${icon_ext}
done
# Final touch
%fdupes -s %{buildroot}/%{_prefix}
strip --strip-all %{buildroot}%{_libdir}/%{name}/VentoyGUI.%{_arch}
strip --strip-all %{buildroot}%{_libdir}/%{name}/tool/%{_arch}/Ventoy2Disk.*
strip --strip-all %{buildroot}%{_libdir}/%{name}/tool/%{_arch}/vtoygpt
chmod 644 %{buildroot}%{_libdir}/%{name}/tool/languages.json
%check
%files
%dir %{_libdir}/%{name}
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/*
%dir %{_datadir}/icons/hicolor/*/apps
%{_bindir}/Ventoy*
%{_libdir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%doc README
%changelog