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