#!/bin/bash . "$(dirname $0)/config" . "$(dirname $0)/db-functions" if [ $# -lt 3 ]; then msg "usage: ${0##*/} ..." exit 1 fi args=(${@}) repo_from="${args[0]}" repo_to="${args[1]}" arch="${args[2]}" pkgnames=("${args[@]:3}") ftppath_from="${FTP_BASE}/${repo_from}/os/" ftppath_to="${FTP_BASE}/${repo_to}/os/" if ! check_repo_permission $repo_to || ! check_repo_permission $repo_from; then die "You don't have permission to move packages from ${repo_from} to ${repo_to}" fi if ! in_array "$arch" "${ARCHES[@]}" "all"; then die "Invalid arch '$arch'" fi if [[ $arch == "all" ]]; then arches=(${ARCHES[@]}) else arches=($arch) fi for pkgarch in ${arches[@]}; do repo_lock ${repo_to} ${pkgarch} || exit 1 repo_lock ${repo_from} ${pkgarch} || exit 1 done msg "Moving packages from [${repo_from}] to [${repo_to}]..." for arch in ${arches[@]}; do for pkgname in "${pkgnames[@]}"; do msg2 "$arch $pkgname" arch_db_move "${repo_from}" "${repo_to}" "${arch}" "${pkgname}" done done arch_history_commit "db-move: $repo_from -> $repo_to: ${pkgnames[@]}" for pkgarch in ${arches[@]}; do repo_unlock ${repo_from} ${pkgarch} repo_unlock ${repo_to} ${pkgarch} done