|
diff --git a/mkipks b/mkipks index dedb060..d44f074 100755 --- a/ mkipks+++ b/ mkipks |
|
@@ -83,139 +83,139 @@ do |
83 | |
83 | |
84 | mkdir -p $DATADIR |
84 | mkdir -p $DATADIR |
85 | mkdir -p $CTRLDIR |
85 | mkdir -p $CTRLDIR |
86 | |
86 | |
87 | packagename=${i##*/}; packagename=${packagename%.control} |
87 | packagename=${i##*/}; packagename=${packagename%.control} |
88 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') |
88 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') |
89 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') |
89 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') |
90 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) |
90 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) |
91 | arch=$(eval echo $(sed -n -e "s/^Arch://p" $i)) |
91 | arch=$(eval echo $(sed -n -e "s/^Arch://p" $i)) |
92 | section=$(sed -n -e "s/^Section: *//p" $i) |
92 | section=$(sed -n -e "s/^Section: *//p" $i) |
93 | license=$(sed -n -e "s/^License: *//p" $i) |
93 | license=$(sed -n -e "s/^License: *//p" $i) |
94 | summary=$(sed -n -e "s/^Description: *//p" $i) |
94 | summary=$(sed -n -e "s/^Description: *//p" $i) |
95 | package=${packagename}_${version}_$ARCH |
95 | package=${packagename}_${version}_$ARCH |
96 | ERROR= |
96 | ERROR= |
97 | if [ -z "$files" ] |
97 | if [ -z "$files" ] |
98 | then |
98 | then |
99 | mkdir -p $DATADIR/usr/share/doc/$packagename |
99 | mkdir -p $DATADIR/usr/share/doc/$packagename |
100 | else |
100 | else |
101 | for f in $files |
101 | for f in $files |
102 | do |
102 | do |
103 | if [ -d $f ] |
103 | if [ -d $f ] |
104 | then |
104 | then |
105 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) |
105 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) |
106 | else |
106 | else |
107 | ffiles=$f |
107 | ffiles=$f |
108 | fi |
108 | fi |
109 | for ff in $ffiles |
109 | for ff in $ffiles |
110 | do |
110 | do |
111 | case $ff in |
111 | case $ff in |
112 | */CVS/*) |
112 | */CVS/*) |
113 | continue |
113 | continue |
114 | ;;*~) |
114 | ;;*~) |
115 | continue |
115 | continue |
116 | ;;*.control) |
116 | ;;*.control) |
117 | continue |
117 | continue |
118 | ;; $QTDIR/*) |
118 | ;; $QTDIR/*) |
119 | BASE=$(dirname /usr/${ff#$QTDIR/}) |
119 | BASE=$(dirname /usr/${ff#$QTDIR/}) |
120 | ;; etc/*.d/*) |
120 | ;; etc/*.d/*) |
121 | BASE=$(dirname /$ff) |
121 | BASE=$(dirname /$ff) |
122 | ;; ipaq/*) |
122 | ;; ipaq/*) |
123 | BASE=$(dirname ${ff#ipaq}) |
123 | BASE=$(dirname ${ff#ipaq}) |
124 | ;; *) |
124 | ;; *) |
125 | # For SHARP ROM compatibility. Should change to Qtopia. |
125 | # For SHARP ROM compatibility. Should change to Qtopia. |
126 | BASE=/opt/QtPalmtop/$(dirname $ff) |
126 | BASE=/opt/QtPalmtop/$(dirname $ff) |
127 | esac |
127 | esac |
128 | |
128 | |
129 | if [ -f $ff -o -b $ff -o -c $ff ] |
129 | if [ -f $ff -o -b $ff -o -c $ff ] |
130 | then |
130 | then |
131 | D=$DATADIR$BASE |
131 | D=$DATADIR$BASE |
132 | if [ -x $ff -a -n "$STRIP" ] |
132 | if [ -x $ff -a -n "$STRIP" ] |
133 | then |
133 | then |
134 | case $(file $ff) in |
134 | case $(file $ff) in |
135 | $STRIP_FILES) |
135 | $STRIP_FILES) |
136 | $STRIP $ff |
136 | $STRIP $ff |
137 | ;; *) |
137 | ;; *) |
138 | esac |
138 | esac |
139 | fi |
139 | fi |
140 | if [ -n "$RPM" ] |
140 | if [ -n "$RPM" ] |
141 | then |
141 | then |
142 | case "$ff" in |
142 | case "$ff" in |
143 | /*) RPMFILES="$RPMFILES $ff" |
143 | /*) RPMFILES="$RPMFILES $ff" |
144 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" |
144 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" |
145 | esac |
145 | esac |
146 | else |
146 | else |
147 | mkdir -p $D |
147 | mkdir -p $D |
148 | if cp -a $ff $D |
148 | if cp -a $ff $D |
149 | then |
149 | then |
150 | true |
150 | true |
151 | else |
151 | else |
152 | ERROR=1 |
152 | ERROR=1 |
153 | fi |
153 | fi |
154 | fi |
154 | fi |
155 | else |
155 | else |
156 | echo >&2 "$0: $i: No such file: $ff" |
156 | echo >&2 "$0: $i: No such file: $ff" |
157 | ERROR=1 |
157 | ERROR=1 |
158 | fi |
158 | fi |
159 | done |
159 | done |
160 | done |
160 | done |
161 | fi |
161 | fi |
162 | if [ -z "$ERROR" ] |
162 | if [ -z "$ERROR" ] |
163 | then |
163 | then |
164 | if [ -n "$RPM" ] |
164 | if [ -n "$RPM" ] |
165 | then |
165 | then |
166 | SPEC=/tmp/mkipks-rpm-$$.spec |
166 | SPEC=/tmp/mkipks-rpm-$$.spec |
167 | echo >$SPEC "Summary: $summary" |
167 | echo >$SPEC "Summary: $summary" |
168 | echo >>$SPEC "Name: $packagename" |
168 | echo >>$SPEC "Name: $packagename" |
169 | echo >>$SPEC "Group: $section" ########## |
169 | echo >>$SPEC "Group: $section" ########## |
170 | echo >>$SPEC "License: $license" |
170 | echo >>$SPEC "License: $license" |
171 | echo >>$SPEC "Version: ${version%-*}" |
171 | echo >>$SPEC "Version: ${version%-*}" |
172 | echo >>$SPEC "Release: ${version#*-}" |
172 | echo >>$SPEC "Release: ${version#*-}" |
173 | |
173 | |
174 | echo >>$SPEC "%description" |
174 | echo >>$SPEC "%description" |
175 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC |
175 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC |
176 | echo >>$SPEC "%files" |
176 | echo >>$SPEC "%files" |
177 | echo >>$SPEC "%defattr(-,root,root)" |
177 | echo >>$SPEC "%defattr(-,root,root)" |
178 | /bin/ls $RPMFILES >>$SPEC |
178 | /bin/ls $RPMFILES >>$SPEC |
179 | rpm -bb $SPEC --target $ARCH-unknown-linux |
179 | rpm -bb --target $ARCH-unknown-linux $SPEC |
180 | # rm $SPEC |
180 | # rm $SPEC |
181 | elif [ -z "$IMAGEDIR" ] |
181 | elif [ -z "$IMAGEDIR" ] |
182 | then |
182 | then |
183 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') |
183 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') |
184 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) |
184 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) |
185 | echo "Package: $packagename" >$CTRLDIR/control |
185 | echo "Package: $packagename" >$CTRLDIR/control |
186 | echo "Installed-Size: $size" >>$CTRLDIR/control |
186 | echo "Installed-Size: $size" >>$CTRLDIR/control |
187 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control |
187 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control |
188 | echo "Version: $version" >>$CTRLDIR/control |
188 | echo "Version: $version" >>$CTRLDIR/control |
189 | echo "Depends: $depends" >>$CTRLDIR/control |
189 | echo "Depends: $depends" >>$CTRLDIR/control |
190 | egrep -v "^(Files|Version|Depends):" >>$CTRLDIR/control $i |
190 | egrep -v "^(Files|Version|Depends):" >>$CTRLDIR/control $i |
191 | echo "$DEB_VERSION" >$TDIR/debian-binary |
191 | echo "$DEB_VERSION" >$TDIR/debian-binary |
192 | base=${i%.control} |
192 | base=${i%.control} |
193 | scripts="preinst postinst prerm postrm" |
193 | scripts="preinst postinst prerm postrm" |
194 | for pf in $scripts |
194 | for pf in $scripts |
195 | do |
195 | do |
196 | if [ -x ${base}.$pf ] |
196 | if [ -x ${base}.$pf ] |
197 | then |
197 | then |
198 | cp ${base}.$pf $CTRLDIR/$pf |
198 | cp ${base}.$pf $CTRLDIR/$pf |
199 | fi |
199 | fi |
200 | done |
200 | done |
201 | if [ "$UID" = 0 ] |
201 | if [ "$UID" = 0 ] |
202 | then |
202 | then |
203 | chown -R root.root $TDIR |
203 | chown -R root.root $TDIR |
204 | fi |
204 | fi |
205 | ( cd $CTRLDIR; tar cfz ../control.tar.gz ./*; ) |
205 | ( cd $CTRLDIR; tar cfz ../control.tar.gz ./*; ) |
206 | ( cd $DATADIR; tar cfz ../data.tar.gz ./*; ) |
206 | ( cd $DATADIR; tar cfz ../data.tar.gz ./*; ) |
207 | ( cd $TDIR; rm -rf control data; tar cf - ./debian-binary ./control.tar.gz ./data.tar.gz; ) | gzip >$RDIR/$package.ipk |
207 | ( cd $TDIR; rm -rf control data; tar cf - ./debian-binary ./control.tar.gz ./data.tar.gz; ) | gzip >$RDIR/$package.ipk |
208 | RESULT=$package.ipk |
208 | RESULT=$package.ipk |
209 | if [ -n "$VERB" ] |
209 | if [ -n "$VERB" ] |
210 | then |
210 | then |
211 | echo >&2 "Built $RESULT ($size)" |
211 | echo >&2 "Built $RESULT ($size)" |
212 | fi |
212 | fi |
213 | if [ -n "$LIST" ] |
213 | if [ -n "$LIST" ] |
214 | then |
214 | then |
215 | echo $RESULT |
215 | echo $RESULT |
216 | fi |
216 | fi |
217 | fi |
217 | fi |
218 | else |
218 | else |
219 | echo >&2 "Not building $package package" |
219 | echo >&2 "Not building $package package" |
220 | fi |
220 | fi |
221 | done |
221 | done |
|