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