added xf86-input-evtouch package Support for touchscreens with xf86
[openadk.git] / scripts / tarpkg
blobf2e5def9e2a93262d8568e99ec64c9bd795e2a1d
1 #!/usr/bin/env bash
2 # create/install compressed tar balls
3 #set -x
5 if [ "$1" = "build" ];then
6 if [ ! -d $2 ];then
7 echo "not a directory"
8 exit 1
9 fi
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 mkdir -p ${2}/usr/lib/pkg
14 for file in preinst postinst prerm postrm; do
15 [ ! -f $2/CONTROL/$file ] || ( cp $2/CONTROL/$file \
16 ${2}/usr/lib/pkg/${pkgname}.$file && \
17 chmod +x ${2}/usr/lib/pkg/${pkgname}.$file )
18 done
19 rm -rf $2/CONTROL
20 (cd $2 && tar -czf $3/${pkgname}_${version}_${arch}.tar.gz .)
21 elif [ "$1" = "install" ];then
22 pkg=$(echo $(basename $2)|sed -e "s#_.*##")
23 if [ -x ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst ]; then
24 IPKG_INSTROOT="$PKG_INSTROOT" ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst
25 rm ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.preinst
27 tar -xzpf $2 -C ${PKG_INSTROOT}
28 if [ -x ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst ]; then
29 IPKG_INSTROOT="$PKG_INSTROOT" ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst
30 rm ${PKG_INSTROOT}/usr/lib/pkg/${pkg}.postinst
32 else
33 echo "unknown command"
34 exit 1