|
@@ -1,5 +1,6 @@
|
|
#!/usr/bin/env bash
|
|
#!/usr/bin/env bash
|
|
# create/install compressed tar balls
|
|
# create/install compressed tar balls
|
|
|
|
+#set -x
|
|
|
|
|
|
if [ "$1" = "build" ];then
|
|
if [ "$1" = "build" ];then
|
|
if [ ! -d $2 ];then
|
|
if [ ! -d $2 ];then
|
|
@@ -9,10 +10,25 @@ if [ "$1" = "build" ];then
|
|
pkgname=$(grep "^Package:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
|
|
pkgname=$(grep "^Package:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
|
|
version=$(grep "^Version:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
|
|
version=$(grep "^Version:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
|
|
arch=$(grep "^Architecture:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
|
|
arch=$(grep "^Architecture:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
|
|
|
|
+ mkdir -p ${2}/usr/lib/pkg
|
|
|
|
+ for file in preinst postinst prerm postrm; do
|
|
|
|
+ [ ! -f $2/CONTROL/$file ] || ( cp $2/CONTROL/$file \
|
|
|
|
+ ${2}/usr/lib/pkg/${pkgname}.$file && \
|
|
|
|
+ chmod +x ${2}/usr/lib/pkg/${pkgname}.$file )
|
|
|
|
+ done
|
|
rm -rf $2/CONTROL
|
|
rm -rf $2/CONTROL
|
|
(cd $2 && tar -czf $3/${pkgname}_${version}_${arch}.tar.gz .)
|
|
(cd $2 && tar -czf $3/${pkgname}_${version}_${arch}.tar.gz .)
|
|
elif [ "$1" = "install" ];then
|
|
elif [ "$1" = "install" ];then
|
|
- tar -xzpf $2 -C ${INSTROOT}
|
|
+ pkg=$(echo $(basename $2)|sed -e "s#_.*##")
|
|
|
|
+ if [ -x ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst ]; then
|
|
|
|
+ IPKG_INSTROOT="$PKG_INSTROOT" ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst
|
|
|
|
+ rm ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst
|
|
|
|
+ fi
|
|
|
|
+ tar -xzpf $2 -C ${PKG_INSTROOT}
|
|
|
|
+ if [ -x ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst ]; then
|
|
|
|
+ IPKG_INSTROOT="$PKG_INSTROOT" ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst
|
|
|
|
+ rm ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst
|
|
|
|
+ fi
|
|
else
|
|
else
|
|
echo "unknown command"
|
|
echo "unknown command"
|
|
exit 1
|
|
exit 1
|