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