#!/bin/sh
cat /dev/null > /tmp/SeTnewtag
dialog --title "Select pkgs from tex(TeX Text Typesetting system)"   --checklist "Select packages to install from tex series. Use cursor up/down to select the package, mark(*) by space key. Push Enter to start install." 24 72 15 "texlive" "e_title" "on" \
"texlive_texmf1" "e_title" "on" \
"texlive_texmf2" "e_title" "on" \
"texlive_texmf3" "e_title" "on" \
"texlive_texmf4" "e_title" "on" \
2> /tmp/SeTpkgs
if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/SeTpkgs
  > /tmp/SeTnewtag
  for pkg in texlive texlive_texmf1 texlive_texmf2 texlive_texmf3 texlive_texmf4  ; do 
  echo "$pkg: SKP" >> /tmp/SeTnewtag
  done
  exit
fi
cat /dev/null > /tmp/SeTnewtag
for PACKAGE in texlive texlive_texmf1 texlive_texmf2 texlive_texmf3 texlive_texmf4 ; do
    if grep "$PACKAGE" /tmp/SeTpkgs 1> /dev/null 2> /dev/null ; then
        echo "$PACKAGE: ADD" >> /tmp/SeTnewtag
    else echo "$PACKAGE: SKP" >> /tmp/SeTnewtag
    fi
done
rm -f /tmp/SeTpkgs

