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