2 # create/install compressed tar balls
5 if [ "$1" = "build" ];then
10 pkgname
=$
(grep "^Package:" $2/CONTROL
/control |
sed -e "s/^[^:]*:[[:space:]]*//")
11 version
=$
(grep "^Version:" $2/CONTROL
/control |
sed -e "s/^[^:]*:[[:space:]]*//")
12 arch
=$
(grep "^Architecture:" $2/CONTROL
/control |
sed -e "s/^[^:]*:[[:space:]]*//")
13 for file in preinst postinst prerm postrm
; do
14 [ ! -f $2/CONTROL
/$file ] ||
( mkdir
-p ${2}/usr
/lib
/pkg
&& \
15 cp $2/CONTROL
/$file ${2}/usr
/lib
/pkg
/${pkgname}.
$file && \
16 chmod +x
${2}/usr
/lib
/pkg
/${pkgname}.
$file )
19 (cd $2 && tar -cf - .|xz
-c > $3/${pkgname}_${version}_${arch}.
tar.xz
)
20 elif [ "$1" = "install" ];then
21 pkg
=$
(echo $
(basename $2)|
sed -e "s#_.*##")
22 if [ -x ${PKG_INSTROOT}/usr
/lib
/pkg
/${pkg}.preinst
]; then
23 IPKG_INSTROOT
="$PKG_INSTROOT" ${PKG_INSTROOT}/usr
/lib
/pkg
/${pkg}.preinst
24 rm ${PKG_INSTROOT}/usr
/lib
/pkg
/${pkg}.preinst
26 xz
-d -c $2|
tar -xpf - -C ${PKG_INSTROOT}
27 if [ -x ${PKG_INSTROOT}/usr
/lib
/pkg
/${pkg}.postinst
]; then
28 IPKG_INSTROOT
="$PKG_INSTROOT" ${PKG_INSTROOT}/usr
/lib
/pkg
/${pkg}.postinst
29 rm ${PKG_INSTROOT}/usr
/lib
/pkg
/${pkg}.postinst
31 rm -rf ${PKG_INSTROOT}/usr
/lib
/pkg
33 echo "unknown command"