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