#!/bin/sh
cat /dev/null > /tmp/SeTnewtag
dialog --title "select pkgs from emacs(emacs related packages)" \
  --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" \
"dbskkd_cdb" "dbskkd_cdb" "on" \
"ddskk" "Daredevil SKK" "on" \
"emacs" "Emacs" "on" \
"emacs_w3m" "WWW viewer for Emacs" "on" \
"libotf" "libotf" "on" \
"mew" "Mew (Messaging in the Emacs World)" "on" \
"navi2ch" "2ch viewer" "on" \
"skktools" "skktools" "on" \
"tamago" "Tamago" "on" \
"tinycdb" "tinycdb database" "on" \
"yatex" "YaTeX (Yet Another TeX macro)" "on" \
2> /tmp/SeTpkgs
if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/SeTpkgs
  > /tmp/SeTnewtag
  for pkg in apel dbskkd_cdb ddskk emacs emacs_w3m libotf mew navi2ch skktools tamago tinycdb yatex  ; do 
  echo "$pkg: SKP" >> /tmp/SeTnewtag
  done
  exit
fi
cat /dev/null > /tmp/SeTnewtag
for PACKAGE in apel dbskkd_cdb ddskk emacs emacs_w3m libotf mew navi2ch skktools tamago tinycdb 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
