mirror of
https://github.com/sbopkg/sbopkg
synced 2025-02-10 20:47:56 +01:00
enforce '.sboq.' extension to queuefiles; also, if argument passed at cli is the name of a queuefile and a package, ask user which one he wants to use
This commit is contained in:
parent
c39e7e2b1b
commit
5da74910d6
1 changed files with 42 additions and 16 deletions
|
@ -1297,14 +1297,15 @@ queue_dir_lister() {
|
||||||
local QFS=$SBOPKGTMP/sbopkg_queue_files_selection
|
local QFS=$SBOPKGTMP/sbopkg_queue_files_selection
|
||||||
local QFM=$SBOPKGTMP/sbopkg_queue_files_menu
|
local QFM=$SBOPKGTMP/sbopkg_queue_files_menu
|
||||||
|
|
||||||
if [[ -z $(ls -A $QUEUEDIR 2> /dev/null) ]]; then
|
if [[ -z $(ls -A $QUEUEDIR/*.sboq 2> /dev/null) ]]; then
|
||||||
if [[ $DIAG ]]; then
|
if [[ $DIAG ]]; then
|
||||||
dialog --title "ERROR" --msgbox "$(crunch "The queue directory \
|
dialog --title "ERROR" --msgbox "$(crunch "The queue directory \
|
||||||
$QUEUEDIR is empty.")" 8 30
|
$QUEUEDIR is empty.")" 8 30
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
find $QUEUEDIR -type f -not -name '*~' -printf "\"%P\" \"\" off\n" | sort > $QFM
|
find $QUEUEDIR -type f -name '*.sboq' -printf "\"%P\" \"\" off\n" \
|
||||||
|
| sed -e 's/.sboq//' | sort > $QFM
|
||||||
# The --default item doesn't work on deletions and renames (because the
|
# The --default item doesn't work on deletions and renames (because the
|
||||||
# variable expands to a no-longer existing file) but you can't give it an
|
# variable expands to a no-longer existing file) but you can't give it an
|
||||||
# index argument, unfortunately
|
# index argument, unfortunately
|
||||||
|
@ -1344,6 +1345,7 @@ load_user_queue() {
|
||||||
|
|
||||||
for ((i=0; i<${#USERQUEUE[*]}; i++)); do
|
for ((i=0; i<${#USERQUEUE[*]}; i++)); do
|
||||||
FILE=$QUEUEDIR/${USERQUEUE[$i]//'"'/}
|
FILE=$QUEUEDIR/${USERQUEUE[$i]//'"'/}
|
||||||
|
FILE="$FILE.sboq"
|
||||||
if [[ -r $FILE ]]; then
|
if [[ -r $FILE ]]; then
|
||||||
CLIQUEUEFILE=$FILE
|
CLIQUEUEFILE=$FILE
|
||||||
# this inhibits add_item_to_queue's msgbox for each added app
|
# this inhibits add_item_to_queue's msgbox for each added app
|
||||||
|
@ -1375,6 +1377,7 @@ delete_user_queue() {
|
||||||
|
|
||||||
for ((i=0; i<${#USERQUEUE[*]}; i++)); do
|
for ((i=0; i<${#USERQUEUE[*]}; i++)); do
|
||||||
FILE=$QUEUEDIR/${USERQUEUE[$i]//'"'/}
|
FILE=$QUEUEDIR/${USERQUEUE[$i]//'"'/}
|
||||||
|
FILE="$FILE.sboq"
|
||||||
if ! rm -f $FILE 2> /dev/null; then
|
if ! rm -f $FILE 2> /dev/null; then
|
||||||
dialog --title "ERROR" --msgbox \
|
dialog --title "ERROR" --msgbox \
|
||||||
"You do not have permission to remove $FILE" 0 0
|
"You do not have permission to remove $FILE" 0 0
|
||||||
|
@ -1417,6 +1420,7 @@ rename_user_queue() {
|
||||||
COUNTER=${#USERQUEUE[*]}
|
COUNTER=${#USERQUEUE[*]}
|
||||||
for ((i=0; i<$COUNTER; i++)); do
|
for ((i=0; i<$COUNTER; i++)); do
|
||||||
FILE=$QUEUEDIR/${USERQUEUE[$i]//'"'/}
|
FILE=$QUEUEDIR/${USERQUEUE[$i]//'"'/}
|
||||||
|
FILE="$FILE.sboq"
|
||||||
if [[ -w ${FILE%/*} ]]; then
|
if [[ -w ${FILE%/*} ]]; then
|
||||||
# This loops so the user can be brought back to the inputbox on a
|
# This loops so the user can be brought back to the inputbox on a
|
||||||
# failure (continue) or back to the dir lister on success (break)
|
# failure (continue) or back to the dir lister on success (break)
|
||||||
|
@ -1433,7 +1437,7 @@ rename_user_queue() {
|
||||||
exists. Please choose another name.")" 0 0
|
exists. Please choose another name.")" 0 0
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
mv "$FILE" "$QUEUEDIR/$NEWNAME"
|
mv "$FILE" "$QUEUEDIR/$NEWNAME.sboq"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -1474,7 +1478,7 @@ save_user_queue() {
|
||||||
to discard it")
|
to discard it")
|
||||||
# Find an unused automatic file name
|
# Find an unused automatic file name
|
||||||
i=0
|
i=0
|
||||||
while [[ -f $QUEUEDIR/sbopkg-autosave-$i ]]; do
|
while [[ -f $QUEUEDIR/sbopkg-autosave-$i.sboq ]]; do
|
||||||
(( i++ ))
|
(( i++ ))
|
||||||
done
|
done
|
||||||
DEFAULT=sbopkg-autosave-$i
|
DEFAULT=sbopkg-autosave-$i
|
||||||
|
@ -1500,7 +1504,7 @@ save_user_queue() {
|
||||||
if ! validate_queue_name $USERQUEUE; then
|
if ! validate_queue_name $USERQUEUE; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [[ -e $USERQUEUE_NAME ]]; then
|
if [[ -e $USERQUEUE_NAME.sboq ]]; then
|
||||||
dialog --title "ERROR" --yesno "$(crunch "Another file \
|
dialog --title "ERROR" --yesno "$(crunch "Another file \
|
||||||
with that name already exists. Press <Yes> to \
|
with that name already exists. Press <Yes> to \
|
||||||
continue and overwrite the other file, or press <No> \
|
continue and overwrite the other file, or press <No> \
|
||||||
|
@ -1509,8 +1513,8 @@ save_user_queue() {
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if cp $TMPQUEUE $QUEUEDIR/$USERQUEUE_NAME; then
|
if cp $TMPQUEUE $QUEUEDIR/$USERQUEUE_NAME.sboq; then
|
||||||
LAST_USER_QUEUE_ON_DISK=$QUEUEDIR/$USERQUEUE_NAME
|
LAST_USER_QUEUE_ON_DISK=$QUEUEDIR/$USERQUEUE_NAME.sboq
|
||||||
else
|
else
|
||||||
dialog --title "ERROR" --msgbox "Problem saving build queue."\
|
dialog --title "ERROR" --msgbox "Problem saving build queue."\
|
||||||
8 30
|
8 30
|
||||||
|
@ -3581,17 +3585,39 @@ else
|
||||||
CLIQUEUE=$SBOPKGTMP/sbopkg_cli_queue
|
CLIQUEUE=$SBOPKGTMP/sbopkg_cli_queue
|
||||||
> $SBOPKGTMP/sbopkg-start-queue
|
> $SBOPKGTMP/sbopkg-start-queue
|
||||||
for PKGBUILD in $BUILD; do
|
for PKGBUILD in $BUILD; do
|
||||||
if [[ -r $QUEUEDIR/$PKGBUILD ]]; then
|
if [[ -r $QUEUEDIR/$PKGBUILD.sboq ]] && search_package $PKGBUILD; then
|
||||||
# Add an entire queue
|
crunch_fmt "Both a queuefile and a package were found with \
|
||||||
cp $QUEUEDIR/$PKGBUILD $CLIQUEUE
|
the name \"$PKGBUILD\". Which would you like to use?"
|
||||||
|
echo
|
||||||
|
echo "Please enter (Q)ueuefile, (P)ackage, or (A)bort:"
|
||||||
|
while :; do
|
||||||
|
read ANS
|
||||||
|
case $ANS in
|
||||||
|
q* | Q* ) cp $QUEUEDIR/$PKGBUILD.sboq $CLIQUEUE
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
p* | P* ) echo $PKGBUILD >> $CLIQUEUE
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
a* | A* ) cleanup
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
* ) echo "Unknown response." ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
else
|
else
|
||||||
if search_package $PKGBUILD; then
|
if [[ -r $QUEUEDIR/$PKGBUILD.sboq ]]; then
|
||||||
# Add a single package
|
# Add an entire queue
|
||||||
echo $PKGBUILD >> $CLIQUEUE
|
cp $QUEUEDIR/$PKGBUILD.sboq $CLIQUEUE
|
||||||
else
|
else
|
||||||
crunch_fmt "Queuefile or package $PKGBUILD not found - \
|
if search_package $PKGBUILD; then
|
||||||
skipping."
|
# Add a single package
|
||||||
echo
|
echo $PKGBUILD >> $CLIQUEUE
|
||||||
|
else
|
||||||
|
crunch_fmt "Queuefile or package $PKGBUILD not found - \
|
||||||
|
skipping."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue