#!/bin/sh ## Create four tempfiles: A tempfile to store the selection from the menu in, ## one to store the same selection after some transformation (for comm), one to ## store the contents of ${ALL_MODULES} (also for comm) and one to store ## the output of pkg_info. tempselection=`mktemp -t selection` tempprocessed=`mktemp -t processed` tempallmodules=`mktemp -t allmodules` tempinstalled=`mktemp -t installed` ## By default, preselect all modules. for i in `${ECHO} "${ALL_MODULES}" | ${TR} '[:upper:]' '[:lower:]'` do eval status_$i=ON done ## If a configfile exists and has actual content, parse it and un-select ## modules accordingly (the configfile is supposed to contain WITHOUT_FOO=yes) ## lines. We don't check what's really in there, it shouldn't do harm when we ## set bogus shell variables. if [ -s "${CONFIG_FILE}" ]; then for i in `${CAT} ${CONFIG_FILE} | ${TR} '[:upper:]' '[:lower:]' \ | ${SED} -E -e 's/without_//g' -e 's/=yes//g'` do eval status_$i=OFF done ## Try to be ubersmart: Check for all installed packages and preselect ## them. This catches the case where people have added ports without the ## the metaport, run the metaport again and wonder why they have parts ## of KDE installed afterwards that were not selected. ## ## Bugs: This metaport can check for existing packages, but it cannot ## remove packages the user explicitly unselects, but which are ## already installed. if [ -f $tempinstalled ];then ${ECHO_MSG} ${ECHO_MSG} -n " Looking for installed modules." for i in `${ECHO} "${ALL_MODULES}" | ${TR} '[:upper:]' '[:lower:]'` do ${PKG_INFO} | ${GREP} $i | ${SED} -e 's/-.*//g' >> $tempinstalled ${ECHO_MSG} -n "." done for i in `${CAT} $tempinstalled` do eval status_$i=ON done fi fi ## Run the menu dialog, except BATCH is defined. We define BATCH automatically ## if people have WITH_FOO* set in their make.conf or on the commandline. ## Actually, we don't even run this whole script at all if BATCH is defined... ## But I'll leave it in just in case, and also as a reference to andreas@ ## who came up with this kind of configuration magic first and from whose ports ## I've stolen it all. Save the results in the tempselection tempfile. if [ -z "${BATCH}" ]; then /usr/bin/dialog --title "K Desktop Environment Customized Installation" --clear \ --checklist "\n\ Please select what additional KDE modules you would like to install.\n\n" \ -1 -1 15 \ "KDEACCESS." "Accessibility applications for KDE" "$status_kdeaccessibility" \ "KDEADMIN" "KDE applications related to system administration" "$status_kdeadmin" \ "KDEARTWORK" "Additional themes, sounds, wallpapers and window styles" "$status_kdeartwork" \ "KDEVELOP" "Powerful IDE for developing KDE/Qt-based applications" "$status_kdevelop" \ "KDEEDU" "Collection of entertaining, educational programs" "$status_kdeedu" \ "KDEGAMES" "Games like kolf, patience, atlantik, etc" "$status_kdegames" \ "KDEGRAPHICS" "Graphics utilities like kview, kpaint, kghostview, etc" "$status_kdegraphics" \ "KDEMULTIMEDIA" "Multimedia utilities like noatun, kmix, etc" "$status_kdemultimedia" \ "KDENETWORK" "Network-related programs like kopete, kppp, etc" "$status_kdenetwork" \ "KOFFICE" "Office Suite including wordprocessor, spreadsheet, etc" "$status_koffice" \ "KDEPIM" "Personal Information Management: Mail, News, Calendar" "$status_kdepim" \ "KDESDK" "KDE software development kit" "$status_kdesdk" \ "KDETOYS" "Miscellaneous small applications" "$status_kdetoys" \ "KDEUTILS" "Utilities like kcalc, kcharselect, ark, kedit, etc" "$status_kdeutils" \ "KDEWEBDEV" "Comprehensive website development environment" "$status_kdewebdev" \ 2> $tempselection ## Save the return value from dialog. retval=$? ## Write out all the module names into a newline-delimited list... if [ -f $tempallmodules ]; then ${ECHO} "$ALL_MODULES" | ${SED} -E -e 's/[[:space:]]+/ /g' | ${TR} '[:space:]' '\n' | sort > $tempallmodules fi ## ...do the same for the selection made in the dialog, comm -23 the ## two files to get the delta and set that as shell variables. if [ -s $tempselection ]; then ${CAT} $tempselection | ${SED} -E -e 's/KDEACCESS./KDEACCESSIBILITY/g' -e 's/[[:space:]]+/ /g' \ -e 's/"//g' | ${TR} '[:space:]' '\n' | sort > $tempprocessed set `/usr/bin/comm -23 $tempallmodules $tempprocessed` fi ## Clean out the tempfiles. rm -f $tempselection $tempprocessed $tempallmodules $tempinstalled ## If the user selected "Cancel" in the dialog, exit. if [ $retval = 1 ]; then ${ECHO_MSG} "Aborting" exit 1 fi fi ## Create Makefile.inc ${MKDIR} -p ${WRKDIRPREFIX}${CURDIR} ${TOUCH} ${WRKDIRPREFIX}${CURDIR}/Makefile.inc ## Populate Makefile.inc by writing out the delta we saved above. while [ $1 ]; do ${ECHO} "WITHOUT_$1=yes" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc; shift done