logo

utils-std

Collection of commonly available Unix tools

install.t (1722B)


  1. #!/usr/bin/env cram
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. $ export PATH="$TESTDIR/../cmd:$PATH"
  5. # Using chmod -v + to get permission bits, + with no perm nor who doesn't changes mode bits
  6. $ test "$(command -v install)" = "$TESTDIR/../cmd/install"
  7. $ test "$(command -v chmod)" = "$TESTDIR/../cmd/chmod"
  8. $ umask 002
  9. $ test ! -e src
  10. $ touch src
  11. $ install -m 755 src dest
  12. $ chmod -v 755 dest
  13. chmod: Permissions already set to 00755/-rwxr-xr-x for 'dest'
  14. $ chmod -v 755 src
  15. chmod: Permissions changed from 00664/-rw-rw-r-- to 00755/-rwxr-xr-x for 'src'
  16. $ rm -f src dest
  17. Integrity check
  18. $ seq 1 2048 > content
  19. $ wc -c content
  20. 9133 content
  21. $ install content content.inst
  22. $ wc -c content content.inst
  23. 9133 content
  24. 9133 content.inst
  25. 18266 total
  26. $ cmp content content.inst
  27. $ rm content content.inst
  28. install -d
  29. $ test ! -e foo.d
  30. $ install -d foo.d
  31. $ test -d foo.d
  32. $ rm -fr foo.d
  33. $ test ! -e enoent.d
  34. $ install -d enoent.d/dir
  35. $ test -d enoent.d
  36. $ test -d enoent.d/dir
  37. $ rm -fr enoent.d
  38. $ install -d -m 755 dest.d
  39. $ chmod -v 755 dest.d
  40. chmod: Permissions already set to 00755/drwxr-xr-x for 'dest.d'
  41. $ rm -fr dest.d
  42. install -D, single src
  43. $ test ! -e gramps
  44. $ touch FooD
  45. $ install -D FooD gramps/parent/child
  46. $ test -d gramps/parent
  47. $ test -f gramps/parent/child
  48. $ test -e FooD
  49. $ rm -r FooD gramps
  50. install -D, multi src
  51. $ test ! -e gran
  52. $ touch sis bro
  53. $ install -D sis bro gran/dad
  54. $ test -f sis
  55. $ test -f bro
  56. $ test -d gran/dad
  57. $ test -f gran/dad/sis
  58. $ test -f gran/dad/bro
  59. $ rm -r sis bro gran
  60. No files should be left
  61. $ find .
  62. .