author | kergoth <kergoth> | 2002-09-24 20:58:00 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-09-24 20:58:00 (UTC) |
commit | 93be75ceab687091f76a459eb34bfd4859986116 (patch) (unidiff) | |
tree | fdb4028af020b4a5a388270c88d68c45544b8a57 | |
parent | 16b7ec203f0306b911cbb1ee90f75cef9dcc3938 (diff) | |
download | opie-93be75ceab687091f76a459eb34bfd4859986116.zip opie-93be75ceab687091f76a459eb34bfd4859986116.tar.gz opie-93be75ceab687091f76a459eb34bfd4859986116.tar.bz2 |
Make mkipks use ipkg-build [-c].
-rwxr-xr-x | mkipks | 29 |
1 files changed, 3 insertions, 26 deletions
@@ -1,264 +1,241 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | QTE_VERSION=2.3.4 | 3 | QTE_VERSION=2.3.4 |
4 | DEB_VERSION=2.0 | 4 | DEB_VERSION=2.0 |
5 | 5 | ||
6 | # Have to do this here, since CVS can't store symlinks | 6 | # Have to do this here, since CVS can't store symlinks |
7 | mkdir -p $OPIEDIR/etc/rc2.d | 7 | mkdir -p $OPIEDIR/etc/rc2.d |
8 | ln -sf ../init.d/opie $OPIEDIR/etc/rc2.d/S98opie | 8 | ln -sf ../init.d/opie $OPIEDIR/etc/rc2.d/S98opie |
9 | 9 | ||
10 | mkdir -p $OPIEDIR/etc/rcS.d | 10 | mkdir -p $OPIEDIR/etc/rcS.d |
11 | ln -sf ../init.d/bootsplash $OPIEDIR/etc/rcS.d/S01bootsplash | 11 | ln -sf ../init.d/bootsplash $OPIEDIR/etc/rcS.d/S01bootsplash |
12 | 12 | ||
13 | ln -sf ../init.d/opieatd $OPIEDIR/ipaq/etc/rc2.d/S96opieatd | 13 | ln -sf ../init.d/opieatd $OPIEDIR/ipaq/etc/rc2.d/S96opieatd |
14 | 14 | ||
15 | 15 | ||
16 | 16 | ||
17 | VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) | 17 | VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) |
18 | VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) | 18 | VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) |
19 | VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$OPIEDIR/include/qpe/version.h) | 19 | VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$OPIEDIR/include/qpe/version.h) |
20 | SUB_VERSION=$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$OPIEDIR/include/qpe/version.h) | 20 | SUB_VERSION=$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$OPIEDIR/include/qpe/version.h) |
21 | if grep -q 'QPE_VERSION .*snapshot' $OPIEDIR/include/qpe/version.h | 21 | if grep -q 'QPE_VERSION .*snapshot' $OPIEDIR/include/qpe/version.h |
22 | then | 22 | then |
23 | VERSION_CVS="$(date +%Y%m%d)" | 23 | VERSION_CVS="$(date +%Y%m%d)" |
24 | SUB_VERSION=$VERSION_CVS | 24 | SUB_VERSION=$VERSION_CVS |
25 | else | 25 | else |
26 | VERSION_CVS="" | 26 | VERSION_CVS="" |
27 | fi | 27 | fi |
28 | 28 | ||
29 | QPE_VERSION=$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT | 29 | QPE_VERSION=$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT |
30 | 30 | ||
31 | ARCH=arm | 31 | ARCH=arm |
32 | STRIP=arm-linux-strip | 32 | STRIP=arm-linux-strip |
33 | STRIP_FILES="*ARM*not stripped" | 33 | STRIP_FILES="*ARM*not stripped" |
34 | 34 | ||
35 | TDIR=/tmp/ipk$$ | 35 | TDIR=/tmp/ipk$$ |
36 | DATADIR=$TDIR | 36 | DATADIR=$TDIR |
37 | CTRLDIR=$TDIR/CONTROL | 37 | CTRLDIR=$TDIR/CONTROL |
38 | 38 | ||
39 | IMAGEDIR= | 39 | IMAGEDIR= |
40 | VERB= | 40 | VERB= |
41 | LIST= | 41 | LIST= |
42 | RPM= | 42 | RPM= |
43 | 43 | ||
44 | while [ $# -ne 0 ] | 44 | while [ $# -ne 0 ] |
45 | do | 45 | do |
46 | case "$1" in | 46 | case "$1" in |
47 | -v) | 47 | -v) |
48 | VERB=1 | 48 | VERB=1 |
49 | echo >&2 "Packaging for version $VERSION_MAJ.$VERSION_MIN.$VERSION_PAT$VERSION_CVS" | 49 | echo >&2 "Packaging for version $VERSION_MAJ.$VERSION_MIN.$VERSION_PAT$VERSION_CVS" |
50 | ;; -l) | 50 | ;; -l) |
51 | LIST=1 | 51 | LIST=1 |
52 | ;; -i) | 52 | ;; -i) |
53 | shift | 53 | shift |
54 | IMAGEDIR=$1 | 54 | IMAGEDIR=$1 |
55 | DATADIR=$IMAGEDIR | 55 | DATADIR=$IMAGEDIR |
56 | mkdir -p $IMAGEDIR | 56 | mkdir -p $IMAGEDIR |
57 | ;; -classic) | 57 | ;; -classic) |
58 | CLASSIC=1 | 58 | classicopts=-c |
59 | ;; -rpm) | 59 | ;; -rpm) |
60 | if [ "$OPIEDIR" != "/opt/Qtopia" ] | 60 | if [ "$OPIEDIR" != "/opt/Qtopia" ] |
61 | then | 61 | then |
62 | echo >&2 '$OPIEDIR is not the standard /usr/Qtopia directory.' | 62 | echo >&2 '$OPIEDIR is not the standard /usr/Qtopia directory.' |
63 | sleep 1 | 63 | sleep 1 |
64 | #exit 1 | 64 | #exit 1 |
65 | fi | 65 | fi |
66 | RPM=1 | 66 | RPM=1 |
67 | ;; -arch) | 67 | ;; -arch) |
68 | shift | 68 | shift |
69 | ARCH=$1 | 69 | ARCH=$1 |
70 | STRIP= | 70 | STRIP= |
71 | STRIP_FILES= | 71 | STRIP_FILES= |
72 | ;; /*) | 72 | ;; /*) |
73 | FILES="$FILES $1" | 73 | FILES="$FILES $1" |
74 | ;; *) | 74 | ;; *) |
75 | FILES="$FILES $PWD/$1" | 75 | FILES="$FILES $PWD/$1" |
76 | esac | 76 | esac |
77 | shift | 77 | shift |
78 | done | 78 | done |
79 | 79 | ||
80 | if [ -n "$CLASSIC" ] | ||
81 | then | ||
82 | DATADIR=$TDIR/data | ||
83 | CTRLDIR=$TDIR/control | ||
84 | fi | ||
85 | |||
86 | if [ -z "$FILES" ] | 80 | if [ -z "$FILES" ] |
87 | then | 81 | then |
88 | FILES=`find $OPIEDIR -name "*.control" -print` | 82 | FILES=`find $OPIEDIR -name "*.control" -print` |
89 | fi | 83 | fi |
90 | 84 | ||
91 | RDIR=$PWD | 85 | RDIR=$PWD |
92 | ORIGDIR=`pwd` | 86 | ORIGDIR=`pwd` |
93 | cd $OPIEDIR | 87 | cd $OPIEDIR |
94 | 88 | ||
95 | for i in $FILES | 89 | for i in $FILES |
96 | do | 90 | do |
97 | rm -rf $TDIR | 91 | rm -rf $TDIR |
98 | 92 | ||
99 | mkdir -p $DATADIR | 93 | mkdir -p $DATADIR |
100 | mkdir -p $CTRLDIR | 94 | mkdir -p $CTRLDIR |
101 | 95 | ||
102 | packagename=${i##*/}; packagename=${packagename%.control} | 96 | packagename=${i##*/}; packagename=${packagename%.control} |
103 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') | 97 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') |
104 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') | 98 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') |
105 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) | 99 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) |
106 | arch=$(eval echo $(sed -n -e "s/^Arch://p" $i)) | 100 | arch=$(eval echo $(sed -n -e "s/^Arch://p" $i)) |
107 | section=$(sed -n -e "s/^Section: *//p" $i) | 101 | section=$(sed -n -e "s/^Section: *//p" $i) |
108 | provides=$(sed -n -e "s/^Provides: *//p" $i) | 102 | provides=$(sed -n -e "s/^Provides: *//p" $i) |
109 | conflicts=$(sed -n -e "s/^Conflicts: *//p" $i) | 103 | conflicts=$(sed -n -e "s/^Conflicts: *//p" $i) |
110 | license=$(sed -n -e "s/^License: *//p" $i) | 104 | license=$(sed -n -e "s/^License: *//p" $i) |
111 | summary=$(sed -n -e "s/^Description: *//p" $i) | 105 | summary=$(sed -n -e "s/^Description: *//p" $i) |
112 | package=${packagename}_${version}_$ARCH | 106 | package=${packagename}_${version}_$ARCH |
113 | ERROR= | 107 | ERROR= |
114 | if [ -z "$files" ] | 108 | if [ -z "$files" ] |
115 | then | 109 | then |
116 | mkdir -p $DATADIR/usr/share/doc/$packagename | 110 | mkdir -p $DATADIR/usr/share/doc/$packagename |
117 | else | 111 | else |
118 | for f in $files | 112 | for f in $files |
119 | do | 113 | do |
120 | if [ -d $f ] | 114 | if [ -d $f ] |
121 | then | 115 | then |
122 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) | 116 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) |
123 | else | 117 | else |
124 | ffiles=$f | 118 | ffiles=$f |
125 | fi | 119 | fi |
126 | for ff in $ffiles | 120 | for ff in $ffiles |
127 | do | 121 | do |
128 | case $ff in | 122 | case $ff in |
129 | */CVS/*) | 123 | */CVS/*) |
130 | continue | 124 | continue |
131 | ;;*~) | 125 | ;;*~) |
132 | continue | 126 | continue |
133 | ;;*.control) | 127 | ;;*.control) |
134 | continue | 128 | continue |
135 | ;; $QTDIR/*) | 129 | ;; $QTDIR/*) |
136 | BASE=$(dirname /opt/QtPalmtop/${ff#$QTDIR/}) | 130 | BASE=$(dirname /opt/QtPalmtop/${ff#$QTDIR/}) |
137 | ;; etc/*.d/*) | 131 | ;; etc/*.d/*) |
138 | BASE=$(dirname /$ff) | 132 | BASE=$(dirname /$ff) |
139 | ;; ipaq/*) | 133 | ;; ipaq/*) |
140 | BASE=$(dirname ${ff#ipaq}) | 134 | BASE=$(dirname ${ff#ipaq}) |
141 | ;; *) | 135 | ;; *) |
142 | # For SHARP ROM compatibility. Should change to Qtopia. | 136 | # For SHARP ROM compatibility. Should change to Qtopia. |
143 | BASE=/opt/QtPalmtop/$(dirname $ff) | 137 | BASE=/opt/QtPalmtop/$(dirname $ff) |
144 | esac | 138 | esac |
145 | 139 | ||
146 | if [ -f $ff -o -b $ff -o -c $ff ] | 140 | if [ -f $ff -o -b $ff -o -c $ff ] |
147 | then | 141 | then |
148 | D=$DATADIR$BASE | 142 | D=$DATADIR$BASE |
149 | if [ -x $ff -a -n "$STRIP" ] | 143 | if [ -x $ff -a -n "$STRIP" ] |
150 | then | 144 | then |
151 | case $(file $ff) in | 145 | case $(file $ff) in |
152 | $STRIP_FILES) | 146 | $STRIP_FILES) |
153 | $STRIP $ff | 147 | $STRIP $ff |
154 | ;; *) | 148 | ;; *) |
155 | esac | 149 | esac |
156 | fi | 150 | fi |
157 | if [ -n "$RPM" ] | 151 | if [ -n "$RPM" ] |
158 | then | 152 | then |
159 | case "$ff" in | 153 | case "$ff" in |
160 | /*) RPMFILES="$RPMFILES $ff" | 154 | /*) RPMFILES="$RPMFILES $ff" |
161 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" | 155 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" |
162 | esac | 156 | esac |
163 | else | 157 | else |
164 | mkdir -p $D | 158 | mkdir -p $D |
165 | if cp -a $ff $D | 159 | if cp -a $ff $D |
166 | then | 160 | then |
167 | true | 161 | true |
168 | else | 162 | else |
169 | ERROR=1 | 163 | ERROR=1 |
170 | fi | 164 | fi |
171 | fi | 165 | fi |
172 | else | 166 | else |
173 | echo >&2 "$0: $i: No such file: $ff" | 167 | echo >&2 "$0: $i: No such file: $ff" |
174 | ERROR=1 | 168 | ERROR=1 |
175 | fi | 169 | fi |
176 | done | 170 | done |
177 | done | 171 | done |
178 | fi | 172 | fi |
179 | if [ -z "$ERROR" ] | 173 | if [ -z "$ERROR" ] |
180 | then | 174 | then |
181 | if [ -n "$RPM" ] | 175 | if [ -n "$RPM" ] |
182 | then | 176 | then |
183 | SPEC=/tmp/mkipks-rpm-$$.spec | 177 | SPEC=/tmp/mkipks-rpm-$$.spec |
184 | echo >$SPEC "Summary: $summary" | 178 | echo >$SPEC "Summary: $summary" |
185 | echo >>$SPEC "Name: $packagename" | 179 | echo >>$SPEC "Name: $packagename" |
186 | echo >>$SPEC "Group: $section" ########## | 180 | echo >>$SPEC "Group: $section" ########## |
187 | echo >>$SPEC "License: $license" | 181 | echo >>$SPEC "License: $license" |
188 | echo >>$SPEC "Version: ${version%-*}" | 182 | echo >>$SPEC "Version: ${version%-*}" |
189 | echo >>$SPEC "Release: ${version#*-}" | 183 | echo >>$SPEC "Release: ${version#*-}" |
190 | 184 | ||
191 | echo >>$SPEC "%description" | 185 | echo >>$SPEC "%description" |
192 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC | 186 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC |
193 | echo >>$SPEC "%files" | 187 | echo >>$SPEC "%files" |
194 | echo >>$SPEC "%defattr(-,root,root)" | 188 | echo >>$SPEC "%defattr(-,root,root)" |
195 | /bin/ls $RPMFILES >>$SPEC | 189 | /bin/ls $RPMFILES >>$SPEC |
196 | rpm -bb --target $ARCH-unknown-linux $SPEC | 190 | rpm -bb --target $ARCH-unknown-linux $SPEC |
197 | # rm $SPEC | 191 | # rm $SPEC |
198 | elif [ -z "$IMAGEDIR" ] | 192 | elif [ -z "$IMAGEDIR" ] |
199 | then | 193 | then |
200 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') | 194 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') |
201 | if (which mkfs.jffs2 >/dev/null 2>&1); then | 195 | if (which mkfs.jffs2 >/dev/null 2>&1); then |
202 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) | 196 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) |
203 | fi | 197 | fi |
204 | echo "Package: $packagename" >$CTRLDIR/control | 198 | echo "Package: $packagename" >$CTRLDIR/control |
205 | if [ ! -z "$size" ]; then | 199 | if [ ! -z "$size" ]; then |
206 | echo "Installed-Size: $size" >>$CTRLDIR/control | 200 | echo "Installed-Size: $size" >>$CTRLDIR/control |
207 | else | 201 | else |
208 | if [ -z "$SIZEWARNED" ] | 202 | if [ -z "$SIZEWARNED" ] |
209 | then | 203 | then |
210 | echo "Warning, no mkfs.jffs2 found, unable to set Installed-Size." | 204 | echo "Warning, no mkfs.jffs2 found, unable to set Installed-Size." |
211 | SIZEWARNED=1 | 205 | SIZEWARNED=1 |
212 | fi | 206 | fi |
213 | fi | 207 | fi |
214 | echo "Architecture: $ARCH" >>$CTRLDIR/control | 208 | echo "Architecture: $ARCH" >>$CTRLDIR/control |
215 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control | 209 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control |
216 | echo "Version: $version" >>$CTRLDIR/control | 210 | echo "Version: $version" >>$CTRLDIR/control |
217 | [ ! -z "$depends" ] && echo "Depends: $depends" >>$CTRLDIR/control | 211 | [ ! -z "$depends" ] && echo "Depends: $depends" >>$CTRLDIR/control |
218 | [ ! -z "$provides" ] && echo "Provides: $provides" >>$CTRLDIR/control | 212 | [ ! -z "$provides" ] && echo "Provides: $provides" >>$CTRLDIR/control |
219 | [ ! -z "$conflicts" ] && echo "Conflicts: $conflicts" >>$CTRLDIR/control | 213 | [ ! -z "$conflicts" ] && echo "Conflicts: $conflicts" >>$CTRLDIR/control |
220 | egrep -v "^(Files|Version|Depends|Provides|Conflicts|Architecture):" >>$CTRLDIR/control $i | 214 | egrep -v "^(Files|Version|Depends|Provides|Conflicts|Architecture):" >>$CTRLDIR/control $i |
221 | [ -n "$CLASSIC" ] && echo "$DEB_VERSION" >$TDIR/debian-binary | 215 | [ -n "$classicopts" ] && echo "$DEB_VERSION" >$TDIR/debian-binary |
222 | base=${i%.control} | 216 | base=${i%.control} |
223 | scripts="preinst postinst prerm postrm" | 217 | scripts="preinst postinst prerm postrm" |
224 | for pf in $scripts | 218 | for pf in $scripts |
225 | do | 219 | do |
226 | if [ -x ${base}.$pf ] | 220 | if [ -x ${base}.$pf ] |
227 | then | 221 | then |
228 | cp ${base}.$pf $CTRLDIR/$pf | 222 | cp ${base}.$pf $CTRLDIR/$pf |
229 | fi | 223 | fi |
230 | done | 224 | done |
231 | if [ -z "$CLASSIC" ] | 225 | cd $ORIGDIR; $OPIEDIR/scripts/ipkg-build $classicopts -o root -g root $TDIR; cd $OPIEDIR; |
232 | then | ||
233 | cd $ORIGDIR; $OPIEDIR/scripts/ipkg-build -o root -g root $TDIR; cd $OPIEDIR; | ||
234 | else | ||
235 | if [ "`id -u`" != "0" ] | ||
236 | then | ||
237 | if [ -z "$ROOTWARNED" ] | ||
238 | then | ||
239 | echo Warning. You are not root. Please become root or use fakeroot. | ||
240 | ROOTWARNED=1 | ||
241 | fi | ||
242 | else | ||
243 | chown -R root.root $TDIR/* | ||
244 | fi | ||
245 | ( cd $DATADIR && tar -czf $TDIR/data.tar.gz * ) | ||
246 | ( cd $CTRLDIR && tar -czf $TDIR/control.tar.gz * ) | ||
247 | ( cd $TDIR && tar -czf $OPIEDIR/$package.ipk ./control.tar.gz ./data.tar.gz ./debian-binary ) | ||
248 | fi | ||
249 | RESULT=$package.ipk | 226 | RESULT=$package.ipk |
250 | if [ -n "$VERB" ] | 227 | if [ -n "$VERB" ] |
251 | then | 228 | then |
252 | echo >&2 "Built $RESULT ($size)" | 229 | echo >&2 "Built $RESULT ($size)" |
253 | fi | 230 | fi |
254 | if [ -n "$LIST" ] | 231 | if [ -n "$LIST" ] |
255 | then | 232 | then |
256 | echo $RESULT | 233 | echo $RESULT |
257 | fi | 234 | fi |
258 | fi | 235 | fi |
259 | else | 236 | else |
260 | echo >&2 "Not building $package package" | 237 | echo >&2 "Not building $package package" |
261 | fi | 238 | fi |
262 | done | 239 | done |
263 | # clean up | 240 | # clean up |
264 | rm -rf $TDIR | 241 | rm -rf $TDIR |