#!/bin/sh
cat /dev/null > /tmp/SeTnewtag
dialog --title "select pkgs from Virtualization(Virtualization related packages)" \
  --checklist "select packages from Virtualization 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 \
"augeas" "Augeas command line tools" "on" \
"extlib" "extended standard library for OCaml (plugins)" "on" \
"findlib" "library for managing OCaml libraries (runtime)" "on" \
"libcap_ng" "POSIX 1003.1e capabilities" "on" \
"libcgroup" "Development libraries to develop applications that utilize control group" "on" \
"libguestfs" "guest disk image management system" "on" \
"libosinfo" "The Operating System information database" "on" \
"libseccomp" "" "on" \
"libvirt" "The virtualization API" "on" \
"libvirt_glib" "GLib and GObject mapping" "on" \
"lxc" "Linux containers userspace tools" "on" \
"lxcf" "" "on" \
"ocaml_curses" "" "on" \
"ocaml_libvirt" "" "on" \
"qemu" "" "on" \
"spice" "" "on" \
"spice_gtk" "" "on" \
"spice_protocol" "" "on" \
"spice_vdagent" "" "on" \
"supermin" "tool for building supermin appliances" "on" \
"uml_utilities" "User-mode Linux (utility programs)" "on" \
"virt_manager" "Manage virtual machines with virt-manager" "on" \
"virt_top" "show stats of virtualized domains" "on" \
"virt_v2v" "" "on" \
"virt_viewer" "" "on" \
"virt_what" "" "on" \
"virt_who" "" "on" \
"xf86_video_qxl" "" "on" \
2> /tmp/SeTpkgs
if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/SeTpkgs
  > /tmp/SeTnewtag
  for pkg in augeas extlib findlib libcap_ng libcgroup libguestfs libosinfo libseccomp libvirt libvirt_glib lxc lxcf ocaml_curses ocaml_libvirt qemu spice spice_gtk spice_protocol spice_vdagent supermin uml_utilities virt_manager virt_top virt_v2v virt_viewer virt_what virt_who xf86_video_qxl  ; do 
  echo "$pkg: SKP" >> /tmp/SeTnewtag
  done
  exit
fi
cat /dev/null > /tmp/SeTnewtag
for PACKAGE in augeas extlib findlib libcap_ng libcgroup libguestfs libosinfo libseccomp libvirt libvirt_glib lxc lxcf ocaml_curses ocaml_libvirt qemu spice spice_gtk spice_protocol spice_vdagent supermin uml_utilities virt_manager virt_top virt_v2v virt_viewer virt_what virt_who xf86_video_qxl  ; 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
