X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/04fed8e4657d28df3ca947ea34c2a5d8f9ccc02f..61d7dd11d4a450a64f2817ee4db0ec7fa5880b42:/bin/chakra/check-texlive?ds=sidebyside diff --git a/bin/chakra/check-texlive b/bin/chakra/check-texlive new file mode 100644 index 0000000..a9da25a --- /dev/null +++ b/bin/chakra/check-texlive @@ -0,0 +1,106 @@ +#!/bin/bash + +remote_directory="ftp://ftp.archlinux.org/other/texlive/" +local_directory=${PWD} +page="/tmp/texlive-update" +pkgs="bibtexextra bin core fontsextra htmlxml latexextra" + +wget -O ${page} ${remote_directory} &>/dev/null + +page_data=$(cat ${page}) + + +for pkg in ${pkgs} ; do + echo " :: scanning ${pkg}.." + + unset found_pkg + + for x in {1..250} ; do + if [ "${found_pkg}" == "true" ] ; then + break + fi + + pkg_match_line=$(echo ${page_data} | cut -d\" -f${x}) + pkg_match_file=$(echo ${pkg_match_line} | grep texlive-${pkg}) + if [ -n "${pkg_match_file}" ] ; then + if [ "${pkg}" == "bin" ] ; then + #-source + local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep texlive-${pkg}-source | cut -d- -f4 | cut -d. -f1) + if [ -n "$(echo ${pkg_match_file} | grep href | grep source)" ] ; then + remote_revision=$(echo ${pkg_match_file} | cut -d- -f4 | cut -d. -f1) + ver=$(vercmp ${local_revision} ${remote_revision}) + if [ "${ver}" == "-1" ] ; then + echo " :: !! new texlive-bin-source tarball found" + echo " -- local: ${local_revision}" + echo " -- remote: ${remote_revision}" + sed -i -e "s/${local_revision}/${remote_revision}/g" ${local_directory}/texlive-${pkg}/PKGBUILD + fi + fi + #-texmf + local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep texlive-${pkg}-texmf | cut -d- -f4 | cut -d. -f1) + if [ -n "$(echo ${pkg_match_file} | grep href | grep texmf)" ] ; then + remote_revision=$(echo ${pkg_match_file} | cut -d- -f4 | cut -d. -f1) + ver=$(vercmp ${local_revision} ${remote_revision}) + if [ "${ver}" == "-1" ] ; then + echo " :: !! new texlive-bin-texmf tarball found" + echo " -- local: ${local_revision}" + echo " -- remote: ${remote_revision}" + sed -i -e "s/${local_revision}/${remote_revision}/g" ${local_directory}/texlive-${pkg}/PKGBUILD + fi + fi + #luatext + if [ "${found_luatext}" == "true" ] ; then + continue + fi + + local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep "luatex-svn" | cut -d- -f2 | cut -d. -f1 | cut -dn -f2) + remote_revision=$(echo ${page_data} | sed -e 's/\n//g' -e 's/xz/xz\n/g' -e 's/zip/zip\n/g' -e 's/a>/a>\n/g' -e 's/ref=/ref=\n/g' | grep luatex | cut -d. -f1 | cut -dn -f2 | sed -e 's/ /\n/g' | uniq | grep -v ftp) + for match in ${remote_revision} ; do + ver=$(vercmp ${local_revision} ${match}) + if [ "${ver}" == "-1" ] ; then + echo " :: !! new luatext tarball found" + echo " -- local: ${local_revision}" + echo " -- remote: ${match}" + sed -i -e "s/${local_revision}/${match}/g" ${local_directory}/texlive-${pkg}/PKGBUILD + found_luatext="true" + fi + done + fi + elif [ "${pkg}" == "bibtexextra" ] ; then + if [ "${found_match}" == "true" ] ; then + continue + fi + + local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep pkgver= | cut -d= -f2 | cut -d. -f2) + remote_revision=$(echo ${page_data} | sed -e 's/\n//g' -e 's/xz/xz\n/g' -e 's/zip/zip\n/g' -e 's/a>/a>\n/g' -e 's/ref=/ref=\n/g' | grep ${pkg} | cut -d. -f2 | cut -d- -f1 | uniq | grep -v ftp) + for match in ${remote_revision} ; do + ver=$(vercmp ${local_revision} ${match}) + if [ "${ver}" == "-1" ] ; then + echo " :: !! new tarball found" + echo " -- local: ${local_revision}" + echo " -- remote: ${match}" + sed -i -e "s/${local_revision}/${match}/g" ${local_directory}/texlive-${pkg}/PKGBUILD + found_match="true" + fi + done + else + if [ "${found_pkg}" == "true" ] ; then + break + fi + + local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep pkgver= | cut -d= -f2 | cut -d. -f2) + remote_revision=$(echo ${page_data} | sed -e 's/\n//g' -e 's/xz/xz\n/g' -e 's/zip/zip\n/g' -e 's/a>/a>\n/g' -e 's/ref=/ref=\n/g' | grep ${pkg} | cut -d. -f2 | cut -d- -f1 | uniq | grep -v ftp) + for match in ${remote_revision} ; do + ver=$(vercmp ${local_revision} ${match}) + if [ "${ver}" == "-1" ] ; then + echo " :: !! new tarball found" + echo " -- local: ${local_revision}" + echo " -- remote: ${match}" + sed -i -e "s/${local_revision}/${match}/g" ${local_directory}/texlive-${pkg}/PKGBUILD + found_pkg="true" + fi + done + fi + done +done +