#!/bin/sh
cat /dev/null > /tmp/SeTnewtag
dialog --title "select pkgs from emacs(Emacs environment)" \
  --checklist "select packages from emacs series. \
You can move cursor with UP/DOWN key and push space \
key to select pkgs. After finish selecting, \
push Enter to start installation. " 24 72 15 \
"apel" "APEL(A Portable Emacs Library)" "on" \
"ddskk" "Daredevil SKK" "on" \
"egg" "Tamago 4.0.6" "on" \
"eggcanna" "egg-canna.el" "on" \
"eggremix" "egg-remix for Tamago 4" "on" \
"emacs" "Emacs 22.1" "on" \
"emacs_w3m" "WWW viewer for Emacs" "on" \
"mew" "Mew is a Internet Message interface for Emacs" "on" \
"navi2ch" "2ch viewer" "on" \
"skk_dics" "Extra Dictionaries for SKK" "on" \
"skkfep" "SKK-like Kana-to-Kanji FrontEnd Processor" "on" \
"yatex" "YaTeX is Yet Another TeX macro" "on" \
2> /tmp/SeTpkgs
if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/SeTpkgs
  > /tmp/SeTnewtag
  for pkg in apel ddskk egg eggcanna eggremix emacs emacs_w3m mew navi2ch skk_dics skkfep yatex  ; do 
  echo "$pkg: SKP" >> /tmp/SeTnewtag
  done
  exit
fi
cat /dev/null > /tmp/SeTnewtag
for PACKAGE in apel ddskk egg eggcanna eggremix emacs emacs_w3m mew navi2ch skk_dics skkfep yatex  ; 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
