dir-generator.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #!/usr/bin/env bash
  2. if [ -z "$1" ]; then
  3. echo "Usage: $0 <output_dir>";
  4. exit 1;
  5. fi
  6. rm "$1" -rf;
  7. mkdir -p "$1";
  8. cd "$1" || exit;
  9. sudo groupadd -f eza_test
  10. # BEGIN grid
  11. mkdir -p grid
  12. cd grid || exit
  13. mkdir $(seq -w 001 1000);
  14. seq 0001 1000 | split -l 1 -a 3 -d - file_
  15. # Set time to unix epoch
  16. touch --date=@0 ./*;
  17. cd .. || exit
  18. # END grid
  19. # BEGIN git
  20. mkdir -p git
  21. cd git || exit
  22. mkdir $(seq -w 001 10);
  23. for f in ./*
  24. do
  25. cd "$f" || exit
  26. git init
  27. seq 01 10 | split -l 1 -a 3 -d - file_
  28. cd .. || exit
  29. done
  30. cd ..
  31. # END git
  32. # BEGIN test_root
  33. sudo mkdir root
  34. sudo chmod 777 root
  35. sudo mkdir root/empty
  36. # END test_root
  37. # BEGIN mknod
  38. mkdir -p specials
  39. sudo mknod specials/block-device b 3 60
  40. sudo mknod specials/char-device c 14 40
  41. sudo mknod specials/named-pipe p
  42. # END test_root
  43. # BEGIN test_symlinks
  44. mkdir -p symlinks
  45. touch symlinks/file --date=@0
  46. ln -s file symlinks/symlink
  47. ln -s symlink symlinks/symlink2
  48. mkdir -p symlinks/dir
  49. ln -s dir symlinks/symlink3
  50. ln -s pipitek symlinks/symlink4
  51. touch "symlinks/ lorem ipsum" --date=@0
  52. ln -s "lorem ipsum" "symlinks/ lorem ipsum"
  53. # END test_symlinks
  54. # BEGIN test_perms
  55. mkdir -p perms
  56. touch perms/file --date=@0
  57. touch perms/file2 --date=@0
  58. chmod 777 perms/file
  59. chmod 001 perms/file2
  60. # END test_perms
  61. # BEGIN test_group
  62. mkdir -p group
  63. touch group/file --date=@0
  64. sudo chgrp eza_test group/file
  65. # END test_group
  66. # BEGIN test_size
  67. mkdir -p size
  68. touch size/1M --date=@0
  69. dd if=/dev/zero of=size/1M bs=1 count=0 seek=1M
  70. touch size/1K --date=@0
  71. dd if=/dev/zero of=size/1K bs=1 count=0 seek=1K
  72. touch size/1B --date=@0
  73. dd if=/dev/zero of=size/1B bs=1 count=0 seek=1
  74. touch size/1337 --date=@0
  75. dd if=/dev/zero of=size/1337 bs=1 count=0 seek=1337
  76. # END test_size
  77. # BEGIN test_time
  78. mkdir -p time
  79. touch time/epoch --date=@0
  80. touch time/1s --date=@1
  81. touch time/1m --date=@60
  82. touch time/1h --date=@3600
  83. touch time/1d --date=@86400
  84. touch time/1y --date=@31536000
  85. # END test_time
  86. # BEGIN test_icons
  87. mkdir -p icons
  88. touch icons/file --date=@0
  89. touch icons/go.go --date=@0
  90. touch icons/rust.rs --date=@0
  91. touch icons/c.c --date=@0
  92. touch icons/c++.cpp --date=@0
  93. touch icons/python.py --date=@0
  94. touch icons/java.java --date=@0
  95. touch icons/javascript.js --date=@0
  96. touch icons/html.html --date=@0
  97. touch icons/css.css --date=@0
  98. touch icons/php.php --date=@0
  99. touch icons/ruby.rb --date=@0
  100. touch icons/shell.sh --date=@0
  101. touch icons/unknown.unknown --date=@0
  102. touch icons/man.1 --date=@0
  103. touch icons/marked.md --date=@0
  104. # END test_icons
  105. # BEGIN set date
  106. touch --date=@0 ./*;
  107. # END set date