Skip to content

Instantly share code, notes, and snippets.

@skull-squadron
Forked from tesch1/texlive17.spec.sh
Last active September 6, 2024 18:56
Show Gist options
  • Save skull-squadron/177fae7acc51f75d6d720fc982961bcd to your computer and use it in GitHub Desktop.
Save skull-squadron/177fae7acc51f75d6d720fc982961bcd to your computer and use it in GitHub Desktop.
Creates a phantom RPM for EL (CentOS/Fedora/RHEL/Oracle) that "provides" all known TeX Live packages, so other packages will cooperate with a local TeX Live installation
#/usr/bin/env bash
set -Eeuo pipefail
REV=2024
SPECFILE=
trap 'e=$?; trap - EXIT; [ -z "$SPECFILE" ] || rm -rf "$SPECFILE"; exit $e' EXIT
SPECFILE="$(mktemp)"
cat >"$SPECFILE" <<HEADER
Name: texlive-FAKE
Version: $REV
Release: 666%{?dist}
Summary: Dummy wrapper for manual texlive install
License: Artistic 2.0 and GPLv2 and GPLv2+ and LGPLv2+ and LPPL and MIT and Public Domain and UCD and Utopia
URL: http://www.tug.org/texlive/quickinstall.html
BuildArch: noarch
BuildRequires: perl
Requires: perl
HEADER
# add all the texlive package as conflicts and as provided by this
# package >:)
BINARY_PACKAGES=()
readarray -t LINES < <(yum search texlive)
for line in "${LINES[@]}"; do
pkg=${line%%.*}
case "$pkg" in
"") echo "Do nothing $line -> $pkg"
;;
texlive-FAKE*)
echo "Skip $line -> $pkg"
;;
texlive*-bin|texlive*-lib)
echo "Match $line -> $pkg"
echo "Provides: $pkg" >> "$SPECFILE"
echo "Conflicts: $pkg" >> "$SPECFILE"
;;
texlive*)
echo "Adding bin pkg $line -> $pkg"
BINARY_PACKAGES+=($pkg)
;;
*) # some junk output from 'yum search'
;;
esac
done
for PKG in "${BINARY_PACKAGES[@]}" ; do
echo "Provides: $PKG" >> "$SPECFILE"
echo "Conflicts: $PKG" >> "$SPECFILE"
done
cat >>"$SPECFILE" <<'FOOTER'
%description
This package just tells rpm/yum/dnf that all texlive packages are
available. You actually have to install them yourself using the
texlive installer from: http://www.tug.org/texlive/quickinstall.html
%prep
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
%files
%doc
%changelog
FOOTER
rpmbuild -bb -v "$SPECFILE"
rpm -Uvh ~/rpmbuild/RPMS/noarch/texlive-FAKE-*.noarch.rpm
rm -f ~/rpmbuild/RPMS/noarch/texlive-FAKE-*.noarch.rpm
find ~/rpmbuild -empty -type d -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment