#!/bin/sh
cat /dev/null > /tmp/SeTnewtag
dialog --title "select pkgs from x11(X11 Window System)" \
  --checklist "select packages from x11 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 \
"TTfont" "" "on" \
"Xwindow" "" "on" \
"audiofile" "audiofile" "on" \
"check" "check" "on" \
"expat" "XML parsing library expat" "on" \
"fonts_append" "" "on" \
"giflib" "" "on" \
"glib" "GTK+ Basic Routines Library" "off" \
"imwheel" "imwheel" "on" \
"libXaw3d" "libXaw3d" "on" \
"libjpeg_turbo" "" "on" \
"libpng" "PNG library" "on" \
"libpng14" "libpng14" "on" \
"libunwind" "libunwind" "on" \
"libwacom" "libwacom" "on" \
"libxkbcommon" "libxkbcommon" "on" \
"libxklavier" "libxklavier - utility library to make XKB stuff easier" "on" \
"mtdev" "" "on" \
"pcf2bdf" "" "on" \
"pixman" "low-level pixel manipulation library" "on" \
"plotutils" "" "on" \
"pstoedit" "" "on" \
"qmkbold" "" "on" \
"tiff" "" "on" \
"wayland" "wayland" "on" \
"wayland_protocols" "wayland_protocols" "on" \
"xfconfig" "xfconfig - Configuration tool for Xorg/XFree86" "on" \
"xterm" "xterm terminal emulator" "on" \
2> /tmp/SeTpkgs
if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/SeTpkgs
  > /tmp/SeTnewtag
  for pkg in TTfont Xwindow audiofile check expat fonts_append giflib glib imwheel libXaw3d libjpeg_turbo libpng libpng14 libunwind libwacom libxkbcommon libxklavier mtdev pcf2bdf pixman plotutils pstoedit qmkbold tiff wayland wayland_protocols xfconfig xterm  ; do 
  echo "$pkg: SKP" >> /tmp/SeTnewtag
  done
  exit
fi
cat /dev/null > /tmp/SeTnewtag
for PACKAGE in TTfont Xwindow audiofile check expat fonts_append giflib glib imwheel libXaw3d libjpeg_turbo libpng libpng14 libunwind libwacom libxkbcommon libxklavier mtdev pcf2bdf pixman plotutils pstoedit qmkbold tiff wayland wayland_protocols xfconfig xterm  ; 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
