listed02.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #! /bin/sh
  2. # This file is part of GNU tar testsuite.
  3. # Copyright (C) 2004 Free Software Foundation, Inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  18. # 02111-1307, USA.
  19. # Check if listed-incremental backups work for files moved from one directory
  20. # to another.
  21. # Based on a script by Martin Simmons <[email protected]>
  22. # References:
  23. # <20040626230315.163AA1D148@cpc5-cmbg1-6-0-cust208.cmbg.cable.ntl.com>
  24. # http://lists.gnu.org/archive/html/bug-tar/2004-06/msg00028.html
  25. . ./preset
  26. TAR_ARCHIVE_FORMATS="gnu oldgnu"
  27. . $srcdir/before
  28. mkdir directory
  29. echo Create directories
  30. mkdir tart
  31. sleep 1
  32. mkdir tart/c0
  33. sleep 1
  34. mkdir tart/c1
  35. sleep 1
  36. for file in tart/a1 tart/b1 tart/c0/cq1 tart/c0/cq2 tart/c1/ca1 tart/c1/ca2
  37. do
  38. echo File $file > $file
  39. sleep 1
  40. done
  41. sleep 1
  42. echo Creating main archive
  43. tar -c -v --listed-incremental=tart.incr1 -f archive.1 tart
  44. sleep 1
  45. echo Modifying filesystem
  46. rm tart/a1
  47. mv tart/b1 tart/b2
  48. mv tart/c1 tart/c2
  49. touch tart/c2/ca3
  50. echo Directory contents
  51. find tart|sort
  52. sleep 1
  53. echo Creating incremental archive
  54. cp -p tart.incr1 tart.incr2
  55. tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart
  56. sleep 1
  57. rm -rf tart/*
  58. echo Extracting main archive
  59. tar -x -v --listed-incremental=tart.incr1 -f archive.1
  60. echo Extracting incremental archive
  61. # This command should produce three messages about deletion
  62. # of the existing files, that may appear in any order. Piping
  63. # to sort makes sure we don't depend on any particular ordering.
  64. tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort
  65. echo Final files:
  66. find tart|sort
  67. err="tar: tart/c0: Directory is new
  68. tar: tart/c1: Directory is new
  69. tar: tart/c2: Directory is new
  70. "
  71. out="Create directories
  72. Creating main archive
  73. tart/
  74. tart/c0/
  75. tart/c1/
  76. tart/a1
  77. tart/b1
  78. tart/c0/cq1
  79. tart/c0/cq2
  80. tart/c1/ca1
  81. tart/c1/ca2
  82. Modifying filesystem
  83. Directory contents
  84. tart
  85. tart/b2
  86. tart/c0
  87. tart/c0/cq1
  88. tart/c0/cq2
  89. tart/c2
  90. tart/c2/ca1
  91. tart/c2/ca2
  92. tart/c2/ca3
  93. Creating incremental archive
  94. tart/
  95. tart/c0/
  96. tart/c2/
  97. tart/b2
  98. tart/c2/ca1
  99. tart/c2/ca2
  100. tart/c2/ca3
  101. Extracting main archive
  102. tart/
  103. tart/c0/
  104. tart/c1/
  105. tart/a1
  106. tart/b1
  107. tart/c0/cq1
  108. tart/c0/cq2
  109. tart/c1/ca1
  110. tart/c1/ca2
  111. Extracting incremental archive
  112. tar: Deleting \`tart/a1'
  113. tar: Deleting \`tart/b1'
  114. tar: Deleting \`tart/c1'
  115. tart/
  116. tart/b2
  117. tart/c0/
  118. tart/c2/
  119. tart/c2/ca1
  120. tart/c2/ca2
  121. tart/c2/ca3
  122. Final files:
  123. tart
  124. tart/b2
  125. tart/c0
  126. tart/c0/cq1
  127. tart/c0/cq2
  128. tart/c2
  129. tart/c2/ca1
  130. tart/c2/ca2
  131. tart/c2/ca3
  132. "
  133. . $srcdir/after