From 1a4afd58dad898ef14ca7034f1c9bca6ebaf0754 Mon Sep 17 00:00:00 2001 From: "chess.griffin" Date: Tue, 20 Jan 2009 04:58:06 +0000 Subject: [PATCH] modify add_item_to_queue so the three arguments passed to it are APP, VERSIONBUILD, and ONOFF, which make it possible to send the results of the sbopkg-update-queue to this new function for processing --- src/usr/bin/sbopkg | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/usr/bin/sbopkg b/src/usr/bin/sbopkg index 6ccd882..2ff3acd 100755 --- a/src/usr/bin/sbopkg +++ b/src/usr/bin/sbopkg @@ -863,7 +863,7 @@ info_item () { add_options $APP fi if [ "$U" = "Queue" ]; then - add_item_to_queue $APP $RVERSION $RBUILD + add_item_to_queue $APP $RVERSION-$RBUILD ON #if $(cat $TMP/sbopkg-tmp-queue | grep -q "^$APP "); then # dialog --title "ERROR" --msgbox \ # "$APP is already in the queue." 8 30 @@ -1249,31 +1249,31 @@ clear_build_queue () { } add_item_to_queue () { - # This function takes three argument, APP, VERSION, and BUILD. If APP is - # already in the queue, ask user if they want to replace it (so updated - # pkgs will get updated in the queue). NOTE: this is a work-in-progress. - # The idea is that whenever an item is added to the queue, whether after - # the update run, or when an individual item is added from the info_item - # menu, or when a backup or user's queue is loaded, then each APP and - # VERSION-BUILD is sent to this function for processing. Once this is - # working remove this NOTE from this comment. + # This function takes three argument, APP, VERSIONBUILD, and ONOFF. If + # APP is already in the queue, ask user if they want to replace it (so + # updated pkgs will get updated in the queue). NOTE: this is a + # work-in-progress. The idea is that whenever an item is added to the + # queue, whether after the update run, or when an individual item is added + # from the info_item menu, or when a backup or user's queue is loaded, + # then each APP, VERSIONBUILDi, and ONOFF is sent to this function for + # processing. Once this is working remove this NOTE from this comment. APP=$1 - VERSION=$2 - BUILD=$3 + VERSIONBUILD=$2 + ONOFF=$3 TMPQUEUE=$TMP/sbopkg-tmp-queue if $(cat $TMPQUEUE | grep -q "^$APP "); then dialog --title "ERROR" --yesno "$(crunch "$APP is already in the \ queue. Do you want to replace it? Press to replace or \ press to skip.")" 10 50 if [ $? = 0 ]; then - sed -i "s/^$APP .*$/$APP $VERSION-$BUILD ON/" $TMPQUEUE + sed -i "s/^$APP .*$/$APP $VERSIONBUILD $ONOFF/" $TMPQUEUE else dialog --title "Skipped" --msgbox "$(crunch "$APP was \ skipped.")" 8 40 return fi else - echo "$APP $VERSION-$BUILD ON" >> $TMP/sbopkg-tmp-queue + echo "$APP $VERSIONBUILD $ONOFF" >> $TMP/sbopkg-tmp-queue fi # Do we need to add a test if this is being done via an update so the user # does not get the following message after each individual app has been @@ -1472,7 +1472,7 @@ gen_search_package () { cd $LOCALREPO/$SLACKVER info_item elif [ $CHOICE = 3 ]; then - add_item_to_queue $SRCHPKG $RVERSION $RBUILD + add_item_to_queue $SRCHPKG $RVERSION-$RBUILD ON #if [ ! -e $TMP/sbopkg-tmp-queue ]; then # touch $TMP/sbopkg-tmp-queue #fi @@ -2447,7 +2447,12 @@ main_menu () { "$(crunch "Would you like to add the flagged updates to \ the build queue?")" 8 35 if [ $? = 0 ]; then - cat $TMP/sbopkg-update-queue >> $TMP/sbopkg-tmp-queue + cat $TMP/sbopkg-update-queue | while read PICK; do + APP=$(echo $PICK | cut -f1 -d " ") + VERSIONBUILD=$(echo $PICK | cut -f2 -d " ") + ONOFF=$(echo $PICK | cut -f3 -d " ") + add_item_to_queue $APP $VERSIONBUILD $ONOFF + done rm -f $TMP/sbopkg-update-queue dialog --title "Done" --msgbox "$(crunch "The flagged \ updates have been added to the build queue.")" 8 30