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

This commit is contained in:
chess.griffin 2009-01-20 04:58:06 +00:00
parent 0d89a29fa0
commit 1a4afd58da

View file

@ -863,7 +863,7 @@ info_item () {
add_options $APP add_options $APP
fi fi
if [ "$U" = "Queue" ]; then 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 #if $(cat $TMP/sbopkg-tmp-queue | grep -q "^$APP "); then
# dialog --title "ERROR" --msgbox \ # dialog --title "ERROR" --msgbox \
# "$APP is already in the queue." 8 30 # "$APP is already in the queue." 8 30
@ -1249,31 +1249,31 @@ clear_build_queue () {
} }
add_item_to_queue () { add_item_to_queue () {
# This function takes three argument, APP, VERSION, and BUILD. If APP is # This function takes three argument, APP, VERSIONBUILD, and ONOFF. If
# already in the queue, ask user if they want to replace it (so updated # APP is already in the queue, ask user if they want to replace it (so
# pkgs will get updated in the queue). NOTE: this is a work-in-progress. # updated pkgs will get updated in the queue). NOTE: this is a
# The idea is that whenever an item is added to the queue, whether after # work-in-progress. The idea is that whenever an item is added to the
# the update run, or when an individual item is added from the info_item # queue, whether after the update run, or when an individual item is added
# menu, or when a backup or user's queue is loaded, then each APP and # from the info_item menu, or when a backup or user's queue is loaded,
# VERSION-BUILD is sent to this function for processing. Once this is # then each APP, VERSIONBUILDi, and ONOFF is sent to this function for
# working remove this NOTE from this comment. # processing. Once this is working remove this NOTE from this comment.
APP=$1 APP=$1
VERSION=$2 VERSIONBUILD=$2
BUILD=$3 ONOFF=$3
TMPQUEUE=$TMP/sbopkg-tmp-queue TMPQUEUE=$TMP/sbopkg-tmp-queue
if $(cat $TMPQUEUE | grep -q "^$APP "); then if $(cat $TMPQUEUE | grep -q "^$APP "); then
dialog --title "ERROR" --yesno "$(crunch "$APP is already in the \ dialog --title "ERROR" --yesno "$(crunch "$APP is already in the \
queue. Do you want to replace it? Press <Yes> to replace or \ queue. Do you want to replace it? Press <Yes> to replace or \
press <No> to skip.")" 10 50 press <No> to skip.")" 10 50
if [ $? = 0 ]; then if [ $? = 0 ]; then
sed -i "s/^$APP .*$/$APP $VERSION-$BUILD ON/" $TMPQUEUE sed -i "s/^$APP .*$/$APP $VERSIONBUILD $ONOFF/" $TMPQUEUE
else else
dialog --title "Skipped" --msgbox "$(crunch "$APP was \ dialog --title "Skipped" --msgbox "$(crunch "$APP was \
skipped.")" 8 40 skipped.")" 8 40
return return
fi fi
else else
echo "$APP $VERSION-$BUILD ON" >> $TMP/sbopkg-tmp-queue echo "$APP $VERSIONBUILD $ONOFF" >> $TMP/sbopkg-tmp-queue
fi fi
# Do we need to add a test if this is being done via an update so the user # 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 # does not get the following message after each individual app has been
@ -1472,7 +1472,7 @@ gen_search_package () {
cd $LOCALREPO/$SLACKVER cd $LOCALREPO/$SLACKVER
info_item info_item
elif [ $CHOICE = 3 ]; then 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 #if [ ! -e $TMP/sbopkg-tmp-queue ]; then
# touch $TMP/sbopkg-tmp-queue # touch $TMP/sbopkg-tmp-queue
#fi #fi
@ -2447,7 +2447,12 @@ main_menu () {
"$(crunch "Would you like to add the flagged updates to \ "$(crunch "Would you like to add the flagged updates to \
the build queue?")" 8 35 the build queue?")" 8 35
if [ $? = 0 ]; then 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 rm -f $TMP/sbopkg-update-queue
dialog --title "Done" --msgbox "$(crunch "The flagged \ dialog --title "Done" --msgbox "$(crunch "The flagged \
updates have been added to the build queue.")" 8 30 updates have been added to the build queue.")" 8 30