]> git.rmz.io Git - dotfiles.git/blob - bin/chakra/check-texlive
mutt: fix F macro to not write message to home
[dotfiles.git] / bin / chakra / check-texlive
1 #!/bin/bash
2
3 remote_directory="ftp://ftp.archlinux.org/other/texlive/"
4 local_directory=${PWD}
5 page="/tmp/texlive-update"
6 pkgs="bibtexextra bin core fontsextra htmlxml latexextra"
7
8 wget -O ${page} ${remote_directory} &>/dev/null
9
10 page_data=$(cat ${page})
11
12
13 for pkg in ${pkgs} ; do
14 echo " :: scanning ${pkg}.."
15
16 unset found_pkg
17
18 for x in {1..250} ; do
19 if [ "${found_pkg}" == "true" ] ; then
20 break
21 fi
22
23 pkg_match_line=$(echo ${page_data} | cut -d\" -f${x})
24 pkg_match_file=$(echo ${pkg_match_line} | grep texlive-${pkg})
25 if [ -n "${pkg_match_file}" ] ; then
26 if [ "${pkg}" == "bin" ] ; then
27 #-source
28 local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep texlive-${pkg}-source | cut -d- -f4 | cut -d. -f1)
29 if [ -n "$(echo ${pkg_match_file} | grep href | grep source)" ] ; then
30 remote_revision=$(echo ${pkg_match_file} | cut -d- -f4 | cut -d. -f1)
31 ver=$(vercmp ${local_revision} ${remote_revision})
32 if [ "${ver}" == "-1" ] ; then
33 echo " :: !! new texlive-bin-source tarball found"
34 echo " -- local: ${local_revision}"
35 echo " -- remote: ${remote_revision}"
36 sed -i -e "s/${local_revision}/${remote_revision}/g" ${local_directory}/texlive-${pkg}/PKGBUILD
37 fi
38 fi
39 #-texmf
40 local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep texlive-${pkg}-texmf | cut -d- -f4 | cut -d. -f1)
41 if [ -n "$(echo ${pkg_match_file} | grep href | grep texmf)" ] ; then
42 remote_revision=$(echo ${pkg_match_file} | cut -d- -f4 | cut -d. -f1)
43 ver=$(vercmp ${local_revision} ${remote_revision})
44 if [ "${ver}" == "-1" ] ; then
45 echo " :: !! new texlive-bin-texmf tarball found"
46 echo " -- local: ${local_revision}"
47 echo " -- remote: ${remote_revision}"
48 sed -i -e "s/${local_revision}/${remote_revision}/g" ${local_directory}/texlive-${pkg}/PKGBUILD
49 fi
50 fi
51 #luatext
52 if [ "${found_luatext}" == "true" ] ; then
53 continue
54 fi
55
56 local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep "luatex-svn" | cut -d- -f2 | cut -d. -f1 | cut -dn -f2)
57 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)
58 for match in ${remote_revision} ; do
59 ver=$(vercmp ${local_revision} ${match})
60 if [ "${ver}" == "-1" ] ; then
61 echo " :: !! new luatext tarball found"
62 echo " -- local: ${local_revision}"
63 echo " -- remote: ${match}"
64 sed -i -e "s/${local_revision}/${match}/g" ${local_directory}/texlive-${pkg}/PKGBUILD
65 found_luatext="true"
66 fi
67 done
68 fi
69 elif [ "${pkg}" == "bibtexextra" ] ; then
70 if [ "${found_match}" == "true" ] ; then
71 continue
72 fi
73
74 local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep pkgver= | cut -d= -f2 | cut -d. -f2)
75 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)
76 for match in ${remote_revision} ; do
77 ver=$(vercmp ${local_revision} ${match})
78 if [ "${ver}" == "-1" ] ; then
79 echo " :: !! new tarball found"
80 echo " -- local: ${local_revision}"
81 echo " -- remote: ${match}"
82 sed -i -e "s/${local_revision}/${match}/g" ${local_directory}/texlive-${pkg}/PKGBUILD
83 found_match="true"
84 fi
85 done
86 else
87 if [ "${found_pkg}" == "true" ] ; then
88 break
89 fi
90
91 local_revision=$(cat ${local_directory}/texlive-${pkg}/PKGBUILD | grep pkgver= | cut -d= -f2 | cut -d. -f2)
92 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)
93 for match in ${remote_revision} ; do
94 ver=$(vercmp ${local_revision} ${match})
95 if [ "${ver}" == "-1" ] ; then
96 echo " :: !! new tarball found"
97 echo " -- local: ${local_revision}"
98 echo " -- remote: ${match}"
99 sed -i -e "s/${local_revision}/${match}/g" ${local_directory}/texlive-${pkg}/PKGBUILD
100 found_pkg="true"
101 fi
102 done
103 fi
104 done
105 done
106