#!/bin/sh
cat /dev/null > /tmp/SeTnewtag
dialog --title "select pkgs from print(printing  related packages)" \
  --checklist "select packages from print 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 \
"a2ps" "" "on" \
"cups" "" "on" \
"cups_filters" "" "on" \
"foomatic_db" "" "on" \
"foomatic_db_engine" "" "on" \
"foomatic_filters" "" "on" \
"gutenprint" "" "on" \
"hplip" "HP Linux Imaging and Printing" "off" \
"ijs" "" "on" \
"libpaper" "library for handling paper characteristics" "on" \
"psutils" "" "on" \
"qpdf" "" "on" \
"system_config_printer" "" "on" \
2> /tmp/SeTpkgs
if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/SeTpkgs
  > /tmp/SeTnewtag
  for pkg in a2ps cups cups_filters foomatic_db foomatic_db_engine foomatic_filters gutenprint hplip ijs libpaper psutils qpdf system_config_printer  ; do 
  echo "$pkg: SKP" >> /tmp/SeTnewtag
  done
  exit
fi
cat /dev/null > /tmp/SeTnewtag
for PACKAGE in a2ps cups cups_filters foomatic_db foomatic_db_engine foomatic_filters gutenprint hplip ijs libpaper psutils qpdf system_config_printer  ; 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
