aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-10-28 00:18:59 +0000
committerNicolas Vigier <boklm@mageia.org>2011-10-28 00:18:59 +0000
commit1fc70de7f0b00d574aab84699bf6f0bc74a0bfee (patch)
tree697afb4590361de94164400b091b276b0e7edd30
parent664d67ca34828dd44377e916502dcc31fd176131 (diff)
downloadrepoctl-1fc70de7f0b00d574aab84699bf6f0bc74a0bfee.tar
repoctl-1fc70de7f0b00d574aab84699bf6f0bc74a0bfee.tar.gz
repoctl-1fc70de7f0b00d574aab84699bf6f0bc74a0bfee.tar.bz2
repoctl-1fc70de7f0b00d574aab84699bf6f0bc74a0bfee.tar.xz
repoctl-1fc70de7f0b00d574aab84699bf6f0bc74a0bfee.zip
add rmpkg command
-rwxr-xr-xrepoctl42
1 files changed, 37 insertions, 5 deletions
diff --git a/repoctl b/repoctl
index 6344b0b..479c0ba 100755
--- a/repoctl
+++ b/repoctl
@@ -24,12 +24,26 @@ Example :
--srcpkg emacs
EOF
;;
+ rmpkg)
+ cat <<EOF
+Usage: repoctl rmpkg [options] --srcrepo distribution:section:sectionrepo \\
+ --srcpkg|--binpkg name
+
+Options:
+ rmpkg can take the same options as mvpkg. See repoctl mvpkg --help
+ for details.
+
+Example :
+ Remove emacs package from 1/core/updates_testing repository :
+ repoctl rmpkg --srcrepo 1:core:updates_testing --srcpkg emacs
+
+EOF
esac
}
function mvpkg()
{
- args=$(getopt -o hn -l srcrepo:,dstrepo:,dry-run,help,no-genhdlists,no-mirror,srcpkg:,binpkg: -- "$@")
+ args=$(getopt -o hn -l srcrepo:,dstrepo:,dry-run,remove,help,no-genhdlists,no-mirror,srcpkg:,binpkg: -- "$@")
[ $? -ne 0 ] && usage_cmd mvpkg && exit 1
eval set -- "$args"
[ $# -lt 1 ] && exit 1
@@ -37,12 +51,20 @@ function mvpkg()
do
case $1 in
-h|--help)
- usage_cmd mvpkg
+ if [ -z "$remove" ]
+ then
+ usage_cmd mvpkg
+ else
+ usage_cmd rmpkg
+ fi
exit 0
;;
-n|--dry-run)
dryrun=echo
shift;;
+ --remove)
+ remove=1
+ shift;;
--no-genhdlists)
nogenhdlists=1
shift;;
@@ -72,7 +94,7 @@ function mvpkg()
;;
esac
done
- if [ -z "$srcrepo" -o -z "$dstrepo" -o \( -z "$srcpkg" -a -z "$binpkg" \) ]
+ if [ -z "$srcrepo" -o -z "$remove$dstrepo" -o \( -z "$srcpkg" -a -z "$binpkg" \) ]
then
usage
exit 1
@@ -85,11 +107,12 @@ function mvpkg()
if [ -z "$nogenhdlists" ]
then
update_hdlists "${srcrepo[0]}" "${srcrepo[1]}" "${srcrepo[2]}"
- update_hdlists "${dstrepo[0]}" "${dstrepo[1]}" "${dstrepo[2]}"
+ [ -n "$dstrepo" ] &&
+ update_hdlists "${dstrepo[0]}" "${dstrepo[1]}" "${dstrepo[2]}"
if [ -z "$nomirror" ]
then
mirror_repository "${srcrepo[0]}"
- [ "${srcrepo[0]}" != "${dstrepo[0]}" ] &&
+ [ -n "${dstrepo[0]}" ] && [ "${srcrepo[0]}" != "${dstrepo[0]}" ] &&
mirror_repository "${dstrepo[0]}"
fi
fi
@@ -98,6 +121,11 @@ function mvpkg()
fi
}
+function rmpkg()
+{
+ mvpkg --remove $@
+}
+
function usage()
{
cat <<EOF
@@ -125,6 +153,10 @@ case "$1" in
shift
mvpkg $@
;;
+ rmpkg)
+ shift
+ rmpkg $@
+ ;;
*)
usage
exit 1