#!/bin/sh
# This script is used within the Slackware installer to present
# a package series selection menu.  If not present, a default list
# built into the installer is used.

# Protected tmp directory:
TMP=/var/log/setup/tmp
if [ ! -d $TMP ]; then
  mkdir -p $TMP
fi


# In /usr/lib/setup/slackinstall, $TMP/series is a directory.
# Depending on how you use the 'setup' script, you can end up going
# round in circles due to this script using 'series' as a text file but
# not being able delete it due to an rm -f.  Now we use rm -rf.
# It's a toss up between accidentally wiping the series selection
# (it only takes a few seconds to re-select the stuff) and getting
# confused.
rm -rf $TMP/SeTSERIES $TMP/tmpscript $TMP/series 

dialog --title "PACKAGE SERIES SELECTION" --item-help --output-separator "#" --checklist \
"Now it's time to select which general categories of software to install \
on your system.  Use the spacebar to select or unselect the software you \
wish to install.  You can use the up and down arrows to see all the \
possible choices.  Recommended choices have been preselected.  Press the \
ENTER key when you are finished." \
20 75 9 \
"A" "Base Linux system" on "The A (base) series contains the kernel and main system utilities." \
"AP" "Various Applications that do not need X" on "The AP series is a collection of useful applications." \
"D" "Program Development (C, C++, Lisp, Perl, etc.)" on "The D series contains compilers, debuggers, and other programming tools." \
"L" "System Libraries (needed by KDE, GNOME, X, and more)" on "The L series contains important libraries needed by the rest of the system." \
"N" "Networking (TCP/IP, UUCP, Mail, News)" on "The N series contains network related clients and servers." \
"DEVEL" "Development packages" off "Those are the development packages, compilers, debuggers and other programming tools." \
"X" "X Window System" on "This series contains X, the window system (or GUI) used by Linux." \
2> $TMP/series
if [ ! $? = 0 ]; then
  rm -rf $TMP/series $TMP/tmpscript
  exit
fi
# Save this "just in case":
#"GNOME" "The GNOME desktop for X" on "The GNOME series contains the GNOME desktop environment and related libraries." 
#
# Rewrite the list into a single # delimited line:
INSTSETS="`cat $TMP/series | tr -d " "`"
INSTSETS="`echo $INSTSETS | tr "\042" "#" `"
INSTSETS="`echo $INSTSETS | tr "," "#" `"
INSTSETS="`echo $INSTSETS | tr -s "#" `"
# Store the selection list:
echo "$INSTSETS" > $TMP/SeTSERIES
