Haha that's brilliant! I have a similar script for Conda, where it tries to install R packages by first looking in bioconductor and then trying the rejects through conda-forge, and then the rejects from that are compiled from source or just outright rejected.
I would have thought you would have needed a (while :; do echo; done) | pdflatex
or a yes "\end" | pdflatex
, i.e. something that repeatedly generates output. It's actually quite elegant that pdflatex checks if stdin is already EOF
lmao, though it's noticeably missing pacman, guix, and "pkg install "should be "pkg add" :P