#!/bin/sh
cat /dev/null > /tmp/SeTnewtag
dialog --title "tex(TeX related packages)シリーズの選択" \
  --checklist "tex シリーズの中からインストールしたいパッケージを \
選んでください．カーソルの上下キーで \
対象を選択し，space キーでマーク(X)します． \
Enter キーでインストールを開始します．" 24 72 15 \
"texlive" "TeX Live 各種コマンド群" "on" \
"texlive_texmf" "Tex Live マクロとフォントライブラリ集" "on" \
"texlive_texmf_doc" "Tex Live マクロとフォントライブラリ集(doc)" "on" \
"texlive_texmf_doc_fonts" "Tex Live マクロとフォントライブラリ集(doc/fonts)" "on" \
"texlive_texmf_doc_generic" "Tex Live マクロとフォントライブラリ集(doc/generic)" "on" \
"texlive_texmf_doc_latex0" "Tex Live マクロとフォントライブラリ集(doc/latex[0/6])" "on" \
"texlive_texmf_doc_latex1" "Tex Live マクロとフォントライブラリ集(doc/latex[1/6])" "on" \
"texlive_texmf_doc_latex2" "Tex Live マクロとフォントライブラリ集(doc/latex[2/6])" "on" \
"texlive_texmf_doc_latex3" "Tex Live マクロとフォントライブラリ集(doc/latex[3/6])" "on" \
"texlive_texmf_doc_latex4" "Tex Live マクロとフォントライブラリ集(doc/latex[4/6])" "on" \
"texlive_texmf_doc_latex5" "Tex Live マクロとフォントライブラリ集(doc/latex[5/6])" "on" \
"texlive_texmf_doc_latex6" "Tex Live マクロとフォントライブラリ集(doc/latex[6/6])" "on" \
"texlive_texmf_fonts" "Tex Live マクロとフォントライブラリ集(fonts)" "on" \
"texlive_texmf_fonts_afm" "Tex Live マクロとフォントライブラリ集(fonts/afm)" "on" \
"texlive_texmf_fonts_opentype" "Tex Live マクロとフォントライブラリ集(fonts/opentype)" "on" \
"texlive_texmf_fonts_tfm" "Tex Live マクロとフォントライブラリ集(fonts/tfm)" "on" \
"texlive_texmf_fonts_truetype" "Tex Live マクロとフォントライブラリ集(fonts/truetype)" "on" \
"texlive_texmf_fonts_type1" "Tex Live マクロとフォントライブラリ集(fonts/type1)" "on" \
"texlive_texmf_fonts_type1_public" "Tex Live マクロとフォントライブラリ集(fonts/type1/public)" "on" \
"texlive_texmf_fonts_type1_public_cbfonts" "Tex Live マクロとフォントライブラリ集(fonts/type1/public/cbfonts)" "on" \
"texlive_texmf_fonts_type1_public_cm_super" "Tex Live マクロとフォントライブラリ集(fonts/type1/public/cm-super)" "on" \
"texlive_texmf_fonts_type1_public_nanumtype1" "Tex Live マクロとフォントライブラリ集(fonts/type1/public/nanumtype1)" "on" \
"texlive_texmf_source" "Tex Live マクロとフォントライブラリ集(source)" "on" \
"texlive_texmf_tex" "Tex Live マクロとフォントライブラリ集(tex)" "on" \
2> /tmp/SeTpkgs
if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/SeTpkgs
  > /tmp/SeTnewtag
  for pkg in texlive texlive_texmf texlive_texmf_doc texlive_texmf_doc_fonts texlive_texmf_doc_generic texlive_texmf_doc_latex0 texlive_texmf_doc_latex1 texlive_texmf_doc_latex2 texlive_texmf_doc_latex3 texlive_texmf_doc_latex4 texlive_texmf_doc_latex5 texlive_texmf_doc_latex6 texlive_texmf_fonts texlive_texmf_fonts_afm texlive_texmf_fonts_opentype texlive_texmf_fonts_tfm texlive_texmf_fonts_truetype texlive_texmf_fonts_type1 texlive_texmf_fonts_type1_public texlive_texmf_fonts_type1_public_cbfonts texlive_texmf_fonts_type1_public_cm_super texlive_texmf_fonts_type1_public_nanumtype1 texlive_texmf_source texlive_texmf_tex  ; do 
  echo "$pkg: SKP" >> /tmp/SeTnewtag
  done
  exit
fi
cat /dev/null > /tmp/SeTnewtag
for PACKAGE in texlive texlive_texmf texlive_texmf_doc texlive_texmf_doc_fonts texlive_texmf_doc_generic texlive_texmf_doc_latex0 texlive_texmf_doc_latex1 texlive_texmf_doc_latex2 texlive_texmf_doc_latex3 texlive_texmf_doc_latex4 texlive_texmf_doc_latex5 texlive_texmf_doc_latex6 texlive_texmf_fonts texlive_texmf_fonts_afm texlive_texmf_fonts_opentype texlive_texmf_fonts_tfm texlive_texmf_fonts_truetype texlive_texmf_fonts_type1 texlive_texmf_fonts_type1_public texlive_texmf_fonts_type1_public_cbfonts texlive_texmf_fonts_type1_public_cm_super texlive_texmf_fonts_type1_public_nanumtype1 texlive_texmf_source texlive_texmf_tex  ; 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
