12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. get_dst() {
  3. #
  4. # Find out target path for src file $2 of group $1
  5. #
  6. local grp=$1
  7. local src=$2
  8. echo "$(get_root $grp)/$(ini 1value "files:$grp:$src")"
  9. }
  10. get_root() {
  11. #
  12. # Find out target rooot for group $1
  13. #
  14. local grp="$1"
  15. local root=$(ini 1value "roots:$grp")
  16. test -n "$root" || die "missing in config.ini: roots:$grp"
  17. echo "$root"
  18. }
  19. install() {
  20. #
  21. # Install product
  22. #
  23. local dst group mode src
  24. ini values "lists:group" \
  25. | while read group;
  26. do
  27. mode=$(ini 1value "modes:$group")
  28. mode=${mode:-$MKIT_DEFAULT_MODE}
  29. ini lskeys "files:$group" \
  30. | while read src;
  31. do
  32. dst=$(get_dst "$group" "$src")
  33. command -p install -DTvm $mode $src "$dst"
  34. done
  35. done
  36. test -f .autoclean && clean || :
  37. }
  38. uninstall() {
  39. #
  40. # Uninstall product
  41. #
  42. local dst group src
  43. ini values "lists:group" \
  44. | while read group;
  45. do
  46. ini lskeys "files:$group" \
  47. | while read src;
  48. do
  49. dst=$(get_dst "$group" "$src")
  50. rm -vf "$dst"
  51. done
  52. done
  53. }