Magellan Linux

Annotation of /trunk/pkgtools/distribution-move.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 613 - (hide annotations) (download) (as text)
Sun Nov 11 23:44:40 2007 UTC (16 years, 6 months ago) by niro
File MIME type: application/x-sh
File size: 1206 byte(s)
-fixed a typo

1 niro 610 #!/bin/bash
2     # cvs-move - moves distribution a distribution to another type
3    
4     DISTRIBUTION="$1"
5     CVSREPOSITORY="$2"
6    
7     if [[ -z ${DISTRIBUTION} ]]
8     then
9     echo "No distribution given!"
10     exit 1
11     fi
12    
13     if [[ -z ${CVSREPOSITORY} ]]
14     then
15     echo "No cvs repo given!"
16     exit 1
17     fi
18    
19     if [[ ! -d ${CVSREPOSITORY} ]]
20     then
21     echo "Given cvs repo is not a directory!"
22     exit 1
23     fi
24    
25     # distribution matrix
26     case ${DISTRIBUTION} in
27     stable)
28     DELETE_DISTRIBUTION="stable"
29 niro 613 DEST_DISTRIBUTION=""
30 niro 610 ;;
31    
32     testing)
33     DELETE_DISTRIBUTION="stable"
34     DEST_DISTRIBUTION="stable"
35     ;;
36    
37     unstable)
38     DELETE_DISTRIBUTION="testing"
39     DEST_DISTRIBUTION="testing"
40     ;;
41     esac
42    
43    
44     pushd ${CVSREPOSITORY}
45    
46     # first delete the previous distribution
47     for smage in $(grep -rl "STATE=[\"]${DELETE_DISTRIBUTION}[\"]" */*.smage2)
48     do
49     echo "Deleting ${smage}"
50     rm ${smage}
51     cvs delete ${smage}
52     done
53    
54     popd
55    
56     # if distribution was 'stable' we are finished here, the distri only gets deleted
57     [[ ${DISTRIBUTION} = stable ]] && exit 0
58    
59    
60     pushd ${CVSREPOSITORY}
61    
62     # then move the target distribution
63     for smage in $(grep -rl "STATE=[\"]${DISTRIBUTION}[\"]" */*.smage2)
64     do
65     echo "Moving ${smage}"
66     sed -i "s:^\(STATE=\).*:\1\"${DEST_DISTRIBUTION}\":" ${smage} || die
67     done
68    
69     popd