#!/bin/bash # cvs-move - moves distribution a distribution to another type DISTRIBUTION="$1" CVSREPOSITORY="$2" if [[ -z ${DISTRIBUTION} ]] then echo "No distribution given!" exit 1 fi if [[ -z ${CVSREPOSITORY} ]] then echo "No cvs repo given!" exit 1 fi if [[ ! -d ${CVSREPOSITORY} ]] then echo "Given cvs repo is not a directory!" exit 1 fi # distribution matrix case ${DISTRIBUTION} in stable) DELETE_DISTRIBUTION="stable" DEST_DISTRIBUTION="" ;; testing) DELETE_DISTRIBUTION="stable" DEST_DISTRIBUTION="stable" ;; unstable) DELETE_DISTRIBUTION="testing" DEST_DISTRIBUTION="testing" ;; esac pushd ${CVSREPOSITORY} # first delete the previous distribution for smage in $(grep -rl "STATE=[\"]${DELETE_DISTRIBUTION}[\"]" */*.smage2) do echo "Deleting ${smage}" rm ${smage} cvs delete ${smage} done popd # if distribution was 'stable' we are finished here, the distri only gets deleted [[ ${DISTRIBUTION} = stable ]] && exit 0 pushd ${CVSREPOSITORY} # then move the target distribution for smage in $(grep -rl "STATE=[\"]${DISTRIBUTION}[\"]" */*.smage2) do echo "Moving ${smage}" sed -i "s:^\(STATE=\).*:\1\"${DEST_DISTRIBUTION}\":" ${smage} || die done popd