mirror of
https://github.com/sbopkg/sbopkg
synced 2025-01-29 20:34:34 +01:00
add initial implementation of new delete_build_queue instead of clear_build_queue; this function allows user to remove individual items from queue or delete the whole queue; there are probably other/better ways to do this but this is a first crack at it.
This commit is contained in:
parent
28950518c6
commit
db57b92f08
1 changed files with 52 additions and 20 deletions
|
@ -1172,9 +1172,9 @@ load_user_queue () {
|
|||
dialog --title "Load Saved Queue" --inputbox "$(crunch "Please enter the \
|
||||
path and filename to a saved build queue (if no path is specified, \
|
||||
then your queue will be saved to $TMP):")" \
|
||||
10 50 2>/$TMP/sbopkg_user_queue
|
||||
10 50 2>$TMP/sbopkg-user-queue
|
||||
if [ $? = 0 ]; then
|
||||
USERQUEUE="$(cat $TMP/sbopkg_user_queue)"
|
||||
USERQUEUE="$(cat $TMP/sbopkg-user-queue)"
|
||||
if [ ! "$USERQUEUE" = "" ]; then
|
||||
if $(echo $USERQUEUE | grep -q \/); then
|
||||
USERQUEUE=$USERQUEUE
|
||||
|
@ -1205,9 +1205,9 @@ save_user_queue () {
|
|||
dialog --title "Save Queue" --inputbox "$(crunch "Please enter the \
|
||||
path and filename where you would like to save the queue (if no \
|
||||
path is specified, your queue will be saved to $TMP):")" 10 50 \
|
||||
2>/$TMP/sbopkg_user_queue
|
||||
2>$TMP/sbopkg-user-queue
|
||||
if [ $? = 0 ]; then
|
||||
USERQUEUE="$(cat $TMP/sbopkg_user_queue)"
|
||||
USERQUEUE="$(cat $TMP/sbopkg-user-queue)"
|
||||
if [ ! "$USERQUEUE" = "" ]; then
|
||||
if $(echo $USERQUEUE | grep -q \/); then
|
||||
USERQUEUE=$USERQUEUE
|
||||
|
@ -1234,18 +1234,49 @@ save_user_queue () {
|
|||
fi
|
||||
}
|
||||
|
||||
clear_build_queue () {
|
||||
# This function clears the build queue.
|
||||
delete_build_queue () {
|
||||
# This function deletes items in the build queue.
|
||||
if empty_queue; then return; fi
|
||||
TMPQUEUE=$TMP/sbopkg-tmp-queue
|
||||
dialog --title "Clear Build Queue?" --yesno "$(crunch "Do you want \
|
||||
to clear the build queue? Press <Yes> to clear the build queue, \
|
||||
or press <No> to cancel.")" 9 65
|
||||
if [ $? = 0 ]; then
|
||||
rm -f $TMPQUEUE
|
||||
REMOVEQUEUE=$TMP/sbopkg-remove-queue
|
||||
WORKINGQUEUE=$TMP/sbopkg-working-queue
|
||||
cat $TMPQUEUE | sed -e 's/[ON$|OFF$]//g' > $REMOVEQUEUE
|
||||
while :; do
|
||||
dialog --title "Delete Build Queue" --ok-label "Delete" \
|
||||
--extra-button --extra-label "Delete All" --help-button \
|
||||
--help-label "Done" --cancel-label "Cancel" \
|
||||
--menu "$(crunch "The following packages are currently in \
|
||||
the build queue. You can remove individual items from the build \
|
||||
queue by highlighting them and pressing <Ok>. Press <Done> when \
|
||||
you are finished and the individual deletions will be \
|
||||
committed. Otherwise, press <Cancel> at any time to abort your \
|
||||
changes.")" 25 60 8 \
|
||||
--file $REMOVEQUEUE 2>$TMP/sbopkg-ans-queue
|
||||
CHOICE=$? # 0 = Delete, 1 = Cancel, 2=Done, 3 = Delete All
|
||||
REMOVED=$(cat $TMP/sbopkg-ans-queue)
|
||||
if [ $CHOICE = 0 ]; then
|
||||
echo $REMOVED >> $WORKINGQUEUE
|
||||
sed -i "s/^$REMOVED .*$//" $REMOVEQUEUE
|
||||
continue
|
||||
elif [ $CHOICE = 1 ]; then
|
||||
rm -f $REMOVEQUEUE
|
||||
return 0
|
||||
elif [ $CHOICE = 2 ]; then
|
||||
for REMOVE in $(cat $WORKINGQUEUE); do
|
||||
sed -i "s/^$REMOVE .*$//" $TMPQUEUE
|
||||
#cat $TMPQUEUE | grep -q "^$PICK " >> $WORKINGQUEUE
|
||||
done
|
||||
dialog --title "Done" --msgbox \
|
||||
"The items have been removed from the build queue." 8 30
|
||||
#rm -f $REMOVEQUEUE
|
||||
return 0
|
||||
elif [ $CHOICE = 3 ]; then
|
||||
rm -f $REMOVEQUEUE $TMPQUEUE
|
||||
dialog --title "Done" --msgbox \
|
||||
"The build queue has been cleared." 8 30
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
add_item_to_queue () {
|
||||
|
@ -1310,7 +1341,7 @@ view_queue () {
|
|||
echo $PICK | sed -e 's/ON/OFF/' >> $WORKINGQUEUE
|
||||
fi
|
||||
done
|
||||
cp $WORKINGQUEUE $TMPQUEUE
|
||||
mv $WORKINGQUEUE $TMPQUEUE
|
||||
if [ "$BUILDPKGS" = 1 ]; then
|
||||
mv $TMP/sbopkg-ans-queue $TMP/sbopkg-start-queue
|
||||
fi
|
||||
|
@ -1327,6 +1358,7 @@ view_queue () {
|
|||
break
|
||||
fi
|
||||
done
|
||||
rm -f $WORKINGQUEUE
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -2265,7 +2297,7 @@ queue_menu () {
|
|||
"\nChoose one of the following or press <Back> to go back.\n" \
|
||||
15 60 5 \
|
||||
"View" "View the build queue" \
|
||||
"Clear" "Clear the build queue" \
|
||||
"Delete" "Delete items from the build queue" \
|
||||
"Process" "Process the build queue" \
|
||||
"Load" "Load a saved build queue" \
|
||||
"Save" "Save a build queue" \
|
||||
|
@ -2283,8 +2315,8 @@ queue_menu () {
|
|||
view_queue
|
||||
fi
|
||||
|
||||
if [ "$Q" = "Clear" ]; then
|
||||
clear_build_queue
|
||||
if [ "$Q" = "Delete" ]; then
|
||||
delete_build_queue
|
||||
fi
|
||||
|
||||
if [ "$Q" = "Process" ]; then
|
||||
|
|
Loading…
Add table
Reference in a new issue