summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmga-move-pkg40
1 files changed, 24 insertions, 16 deletions
diff --git a/mga-move-pkg b/mga-move-pkg
index 6662476..0f5af54 100755
--- a/mga-move-pkg
+++ b/mga-move-pkg
@@ -145,25 +145,33 @@ function sanity_check()
{
local cauldronmsg
- if [ "$_fullsrpmname" != "y" -o -z "$noconfirm" ]; then
- echo "The following SRPMs (and matching binaries) will be moved:"
- for ((i=0;i<${#_releases[*]};++i)); do
- echo "- ${_pkgfiles[$i]}"
- if [ 'release' = "${_destsubsections[$i]}" -a -n "${_oldpkgfiles[$i]}" ]; then
- cauldronmsg="${cauldronmsg}- ${_oldpkgfiles[$i]}\n"
- fi
- done
- echo
- if [ -n "$cauldronmsg" ]; then
- echo "The following SRPMs (and matching binaries) will be moved from 'release' to '\~schedbot/old':"
- echo "$cauldronmsg"
+ if [ -n "$noconfirm" ]; then
+ # We've requested no confirmation. This is only valid when the user
+ # supplies a full SRPM name for every package.
+ [ "$_fullsrpmname" = "y" ] && return 0
+ echo "Sorry, but you requested --no-confirm, but did not give me full SRPM names." >&1
+ exit 1
+ fi
+
+ echo "The following SRPMs (and their corresponding binaries) will be moved:"
+ for ((i=0;i<${#_releases[*]};++i)); do
+ echo "- ${_pkgfiles[$i]}"
+ if [ 'release' = "${_destsubsections[$i]}" -a -n "${_oldpkgfiles[$i]}" ]; then
+ cauldronmsg="${cauldronmsg}- ${_oldpkgfiles[$i]}\n"
fi
+ done
+ echo
- read -n 1 -p "Are you sure? [Y/n] " yn
- [ -n "$yn" ] && echo
- [ -z "$yn" -o "Y" = "$yn" ] && yn=y
- [ "y" != "$yn" ] && exit
+ if [ -n "$cauldronmsg" ]; then
+ echo "The following SRPMs (and their corresponding binaries) will be moved from 'release' to '\~schedbot/old':"
+ echo "$cauldronmsg"
+ # The above always ends with a blank line... so no need to echo another
fi
+
+ read -n 1 -p "Are you sure? [Y/n] " yn
+ [ -n "$yn" ] && echo
+ [ -z "$yn" -o "Y" = "$yn" ] && yn=y
+ [ "y" != "$yn" ] && exit
return 0
}
sanity_check