tweak how the temporary backup queue is managed; now it is removed automatically whether the user loads it or not.

This commit is contained in:
chess.griffin 2009-01-17 00:33:18 +00:00
parent f777578f0f
commit 9ed8e475c9

View File

@ -839,6 +839,7 @@ continue
} }
delete_backup_queue () { delete_backup_queue () {
# This function is not used but is being saved for the time being.
# This function deletes any backup queues. # This function deletes any backup queues.
PERMQUEUE=$TMP/sbopkg-savedqueue PERMQUEUE=$TMP/sbopkg-savedqueue
if [ -e $PERMQUEUE ]; then if [ -e $PERMQUEUE ]; then
@ -861,22 +862,22 @@ load_backup_queue () {
# This function loads any backup queue and merges it with any # This function loads any backup queue and merges it with any
# current $TMPQUEUE. # current $TMPQUEUE.
TMPQUEUE=$TMP/sbopkg-tmp-queue TMPQUEUE=$TMP/sbopkg-tmp-queue
WORKINGQUEUE=$TMP/sbopkg-working-queue
PERMQUEUE=$TMP/sbopkg-savedqueue PERMQUEUE=$TMP/sbopkg-savedqueue
if [ -e $PERMQUEUE ]; then if [ -e $PERMQUEUE ]; then
dialog --title "Load Backup Queue?" --yesno "A backup queue \ dialog --title "Load Temporary Backup Queue?" --yesno "A \
was found. Would you like to load it? Press <Yes> to load the \ temporary backup queue was found. Would you like to load it? \
backup queue into your current queue, or press <No> to cancel." \ Either way, the temporary backup queue will be deleted. A new \
9 65 temporary backup queue will be automatically created if you quit \
sbopkg with items in the build queue.\n\nPress <Yes> to load the \
temporary backup queue into the build queue, or press <No> to \
cancel." 11 65
if [ $? = 0 ]; then if [ $? = 0 ]; then
rm -f $WORKINGQUEUE mv $PERMQUEUE $TMPQUEUE
cat $TMPQUEUE >> $WORKINGQUEUE
cat $PERMQUEUE >> $WORKINGQUEUE
sort $WORKINGQUEUE | uniq > $TMPQUEUE
rm -f $WORKINGQUEUE
touch $TMP/sbopkg_backup_queue.lck touch $TMP/sbopkg_backup_queue.lck
dialog --title "Done" --msgbox "The backup queue has been \ dialog --title "Done" --msgbox "The backup queue has been \
loaded." 8 30 loaded." 8 30
else
rm -f $PERMQUEUE
fi fi
fi fi
} }
@ -885,19 +886,14 @@ save_backup_queue () {
# This function saves the build queue and merges it with any current # This function saves the build queue and merges it with any current
# $TMPQUEUE. # $TMPQUEUE.
TMPQUEUE=$TMP/sbopkg-tmp-queue TMPQUEUE=$TMP/sbopkg-tmp-queue
WORKINGQUEUE=$TMP/sbopkg-working-queue
PERMQUEUE=$TMP/sbopkg-savedqueue PERMQUEUE=$TMP/sbopkg-savedqueue
if [ -e $TMPQUEUE ]; then if [ -e $TMPQUEUE ]; then
rm -f $WORKINGQUEUE cp $TMPQUEUE $PERMQUEUE
cat $TMPQUEUE >> $WORKINGQUEUE dialog --title "Saving Temporary Backup Queue" --msgbox "Since \
cat $PERMQUEUE >> $WORKINGQUEUE the queue was not empty upon quitting sbopkg, it has been \
sort $WORKINGQUEUE | uniq > $PERMQUEUE automatically saved to a temporary backup file. If you do not want \
rm -f $WORKINGQUEUE this to happen next time, please be sure the build queue is empty \
dialog --title "Saving Queue" --msgbox "Since the queue was not \ when quitting sbopkg." 9 65
empty upon quitting sbopkg, it has been automatically saved to a \
backup file. If you do not want this to happen next time, please \
be sure the queue is empty when quitting sbopkg and delete any \
prior backup queue file in the queue submenu." 9 65
fi fi
} }
@ -1938,11 +1934,10 @@ dialog --default-item "$Q" --title "Build Queue Menu" --backtitle \
"Currently using the SlackBuilds.org $SLACKVER repository." \ "Currently using the SlackBuilds.org $SLACKVER repository." \
--cancel-label "Back" --menu \ --cancel-label "Back" --menu \
"\nChoose one of the following or press <Back> to go back.\n" \ "\nChoose one of the following or press <Back> to go back.\n" \
15 60 5 \ 15 60 4 \
"View" "View the build queue" \ "View" "View the build queue" \
"Load" "Load a saved build queue" \ "Load" "Load a saved build queue" \
"Save" "Save a build queue" \ "Save" "Save a build queue" \
"Delete" "Delete the automatic backup queue" \
"Process" "Process the build queue" \ "Process" "Process the build queue" \
2>$TMP/sbopkg_queue_menu_answer 2>$TMP/sbopkg_queue_menu_answer