listed02.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 <ZYHYLCRMZPRP@spammotel.com>
  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. tar -x -v --listed-incremental=tart.incr2 -f archive.2
  62. echo Final files:
  63. find tart|sort
  64. err="tar: tart/c0: Directory is new
  65. tar: tart/c1: Directory is new
  66. tar: tart/c2: Directory is new
  67. "
  68. out="Create directories
  69. Creating main archive
  70. tart/
  71. tart/c0/
  72. tart/c1/
  73. tart/a1
  74. tart/b1
  75. tart/c0/cq1
  76. tart/c0/cq2
  77. tart/c1/ca1
  78. tart/c1/ca2
  79. Modifying filesystem
  80. Directory contents
  81. tart
  82. tart/b2
  83. tart/c0
  84. tart/c0/cq1
  85. tart/c0/cq2
  86. tart/c2
  87. tart/c2/ca1
  88. tart/c2/ca2
  89. tart/c2/ca3
  90. Creating incremental archive
  91. tart/
  92. tart/c0/
  93. tart/c2/
  94. tart/b2
  95. tart/c2/ca1
  96. tart/c2/ca2
  97. tart/c2/ca3
  98. Extracting main archive
  99. tart/
  100. tart/c0/
  101. tart/c1/
  102. tart/a1
  103. tart/b1
  104. tart/c0/cq1
  105. tart/c0/cq2
  106. tart/c1/ca1
  107. tart/c1/ca2
  108. Extracting incremental archive
  109. tart/
  110. tar: Deleting \`tart/c1'
  111. tar: Deleting \`tart/a1'
  112. tar: Deleting \`tart/b1'
  113. tart/c0/
  114. tart/c2/
  115. tart/b2
  116. tart/c2/ca1
  117. tart/c2/ca2
  118. tart/c2/ca3
  119. Final files:
  120. tart
  121. tart/b2
  122. tart/c0
  123. tart/c0/cq1
  124. tart/c0/cq2
  125. tart/c2
  126. tart/c2/ca1
  127. tart/c2/ca2
  128. tart/c2/ca3
  129. "
  130. . $srcdir/after