tarpkg 579 B

12345678910111213141516171819
  1. #!/usr/bin/env bash
  2. # create/install compressed tar balls
  3. if [ "$1" = "build" ];then
  4. if [ ! -d $2 ];then
  5. echo "not a directory"
  6. exit 1
  7. fi
  8. pkgname=$(grep "^Package:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
  9. version=$(grep "^Version:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
  10. arch=$(grep "^Architecture:" $2/CONTROL/control | sed -e "s/^[^:]*:[[:space:]]*//")
  11. rm -rf $2/CONTROL
  12. (cd $2 && tar -czf $3/${pkgname}_${version}_${arch}.tar.gz .)
  13. elif [ "$1" = "install" ];then
  14. tar -xzpf $2 -C ${INSTROOT}
  15. else
  16. echo "unknown command"
  17. exit 1
  18. fi