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