pkg_add.sh 523 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. if [ -z "$1$2$3$4$5$6" ]
  3. then
  4. echo "Missing arguments" 1>&2
  5. exit 1
  6. fi
  7. T=`echo "$1" | grep "\." | wc -l `
  8. if [ "$T" -eq "1" ]
  9. then
  10. echo "Invalid dot character in name. Considere replace by an underscore." 1>&2
  11. exit 1
  12. fi
  13. PKG_FILE="index/$1.mk"
  14. CONTENTS="PACKAGES += $1
  15. pkg_$1_name = $1
  16. pkg_$1_description = $6
  17. pkg_$1_homepage = $5
  18. pkg_$1_fetch = $2
  19. pkg_$1_repo = $3
  20. pkg_$1_commit = $4
  21. "
  22. COMMIT="Add package $1 to the index"
  23. printf "$CONTENTS" > $PKG_FILE
  24. git add $PKG_FILE
  25. git commit -m "$COMMIT" $PKG_FILE