test_transfer_upgrade.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # this scripts uses borg 1.2 to generate test data for "borg transfer --upgrader=From12To20"
  2. BORG=./borg-1.2.2
  3. # on macOS, gnu tar is available as gtar
  4. TAR=gtar
  5. SRC=/tmp/borgtest
  6. ARCHIVE=`pwd`/src/borg/testsuite/archiver/repo12.tar.gz
  7. export BORG_REPO=/tmp/repo12
  8. META=$BORG_REPO/test_meta
  9. export BORG_PASSPHRASE="waytooeasyonlyfortests"
  10. export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=YES
  11. $BORG init -e repokey 2> /dev/null
  12. mkdir $META
  13. # archive1
  14. mkdir $SRC
  15. pushd $SRC >/dev/null
  16. mkdir directory
  17. echo "content" > directory/no_hardlink
  18. echo "hardlink content" > hardlink1
  19. ln hardlink1 hardlink2
  20. echo "symlinked content" > target
  21. ln -s target symlink
  22. ln -s doesnotexist broken_symlink
  23. mkfifo fifo
  24. touch without_xattrs
  25. touch with_xattrs
  26. xattr -w key1 value with_xattrs
  27. xattr -w key2 "" with_xattrs
  28. touch without_flags
  29. touch with_flags
  30. chflags nodump with_flags
  31. popd >/dev/null
  32. $BORG create ::archive1 $SRC
  33. $BORG list ::archive1 --json-lines > $META/archive1_list.json
  34. rm -rf $SRC
  35. # archive2
  36. mkdir $SRC
  37. pushd $SRC >/dev/null
  38. sudo mkdir root_stuff
  39. sudo mknod root_stuff/bdev_12_34 b 12 34
  40. sudo mknod root_stuff/cdev_34_56 c 34 56
  41. sudo touch root_stuff/strange_uid_gid # no user name, no group name for this uid/gid!
  42. sudo chown 54321:54321 root_stuff/strange_uid_gid
  43. popd >/dev/null
  44. $BORG create ::archive2 $SRC
  45. $BORG list ::archive2 --json-lines > $META/archive2_list.json
  46. sudo rm -rf $SRC/root_stuff
  47. rm -rf $SRC
  48. $BORG --version > $META/borg_version.txt
  49. $BORG list :: --json > $META/repo_list.json
  50. pushd $BORG_REPO >/dev/null
  51. $TAR czf $ARCHIVE .
  52. popd >/dev/null
  53. $BORG delete :: 2> /dev/null