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