Magellan Linux

Contents of /trunk/pkgtools/move-packages.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 610 - (show annotations) (download) (as text)
Sun Nov 11 23:40:52 2007 UTC (16 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 2708 byte(s)
-added some pkgtools

1 #!/bin/bash
2
3
4 # mage cvs location
5 CVS_DEST=$(mktemp -d)
6 CVS_MODULE=mage
7 CVS_OPTS=""
8
9 # repo location
10 MPK_REPO=/var/www/magellan/magellan-dev
11
12 # mage-db location
13 MAGE_REPO=/var/www/magellan/magellan-dev/rsync/mage
14
15 # supported arches
16 ARCHES="i686 x86_64"
17
18 DISTRIBUTION="$1" # stable/testing/unstable
19
20 MISSING_PKGS=""
21
22
23 ## fetch mage
24 #if [ ! -d ${CVS_DEST}/${CVS_MODULE}/CVS ]
25 #then
26 # (cd ${CVS_DEST}; cvs -z3 checkout -P ${CVS_OPTS} ${CVS_MODULE})
27 #else
28 # (cd ${CVS_DEST}; cvs -z3 update -d -P ${CVS_OPTS} ${CVS_MODULE})
29 #fi
30 #
31 ## include mage functions
32 #source
33
34 # fake minclude
35 minclude() { true; }
36
37 # get_value_from_magefile VARIABLE
38 # returns the content of this VAR
39 get_value_from_magefile()
40 {
41 local var="$1"
42 local magefile="$2"
43 local value
44
45 [[ -z ${var} ]] && return 1
46 [[ -z ${magefile} ]] && return 1
47
48 # local all possible vars of a mage file
49 # to prevent bad issues
50 local PKGNAME
51 local STATE
52 local DESCRIPTION
53 local HOMEPAGE
54 local DEPEND
55 local SDEPEND
56 local PROVIDE
57 local PKGTYPE
58 local preinstall
59 local postinstall
60 local preremove
61 local postremove
62
63 # sanity checks
64 [ -f ${magefile} ] && source ${magefile} || \
65 die "get_value_from_magefile: ${magefile} not found."
66 [ -z "${var}" ] && die "get_value_from_magefile: \$var not given."
67
68 source ${magefile}
69 eval value=\$$(echo ${var})
70 echo "${value}"
71
72 # unset these functions
73 unset -f preinstall
74 unset -f postinstall
75 unset -f preremove
76 unset -f postremove
77 }
78
79 if [[ -z ${DISTRIBUTION} ]]
80 then
81 echo
82 echo "You must specify at least on distribution:"
83 echo " stable/testing/unstable"
84 echo "exp: $0 testing"
85 echo
86 exit 1
87 fi
88
89 for arch in ${ARCHES}
90 do
91 for mage in ${MAGE_REPO}/*/*/*.mage
92 do
93 # ignore all fake and virtual packages
94 [[ $(get_value_from_magefile PKGTYPE ${mage}) = virtual ]] && continue
95
96 # small fix
97 ARCH="${arch}"
98 pkgname="$(get_value_from_magefile PKGNAME ${mage})"
99
100 #echo ${mage}
101 if [[ $(get_value_from_magefile STATE ${mage}) = ${DISTRIBUTION} ]]
102 then
103 echo "$(basename ${mage} .mage) -> ${DISTRIBUTION}"
104 if [[ ! -f ${MPK_REPO}/${DISTRIBUTION} ]]
105 then
106 # search a valid file
107 # 1. unstable
108 # 2. testing
109 # 3. stable
110 found=0
111 for i in unstable testing stable
112 do
113 # it make no sense to search the current distri
114 [[ ${DISTRIBUTION} = ${i} ]] && continue
115 if [[ -f ${MPK_REPO}/${i}/packages/${arch}/${pkgname}.mpk ]]
116 then
117 echo "${i} - ${pkgname} ==>> ${DISTRIBUTION}"
118 found=1
119 fi
120 done
121
122 # pkgs was not found
123 [[ ${found} = 0 ]] && MISSING_PKGS="${MISSING_PKGS} ${pkgname}.mpk"
124 fi
125 fi
126 done
127 done
128
129 # print all missing packages
130 echo;echo "missing packages:";echo
131 for i in ${MISSING_PKGS}
132 do
133 echo ${i}
134 done | sort

Properties

Name Value
svn:executable *