dir-generator.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. # END test_symlinks
  52. # BEGIN test_perms
  53. mkdir -p perms
  54. touch perms/file --date=@0
  55. touch perms/file2 --date=@0
  56. chmod 777 perms/file
  57. chmod 001 perms/file2
  58. # END test_perms
  59. # BEGIN test_group
  60. mkdir -p group
  61. touch group/file --date=@0
  62. sudo chgrp eza_test group/file
  63. # END test_group
  64. # BEGIN test_size
  65. mkdir -p size
  66. touch size/1M --date=@0
  67. dd if=/dev/zero of=size/1M bs=1 count=0 seek=1M
  68. touch size/1K --date=@0
  69. dd if=/dev/zero of=size/1K bs=1 count=0 seek=1K
  70. touch size/1B --date=@0
  71. dd if=/dev/zero of=size/1B bs=1 count=0 seek=1
  72. touch size/1337 --date=@0
  73. dd if=/dev/zero of=size/1337 bs=1 count=0 seek=1337
  74. # END test_size
  75. # BEGIN test_time
  76. mkdir -p time
  77. touch time/epoch --date=@0
  78. touch time/1s --date=@1
  79. touch time/1m --date=@60
  80. touch time/1h --date=@3600
  81. touch time/1d --date=@86400
  82. touch time/1y --date=@31536000
  83. # END test_time
  84. # BEGIN test_icons
  85. mkdir -p icons
  86. touch icons/file --date=@0
  87. touch icons/go.go --date=@0
  88. touch icons/rust.rs --date=@0
  89. touch icons/c.c --date=@0
  90. touch icons/c++.cpp --date=@0
  91. touch icons/python.py --date=@0
  92. touch icons/java.java --date=@0
  93. touch icons/javascript.js --date=@0
  94. touch icons/html.html --date=@0
  95. touch icons/css.css --date=@0
  96. touch icons/php.php --date=@0
  97. touch icons/ruby.rb --date=@0
  98. touch icons/shell.sh --date=@0
  99. touch icons/unknown.unknown --date=@0
  100. touch icons/man.1 --date=@0
  101. touch icons/marked.md --date=@0
  102. # END test_icons
  103. # BEGIN set date
  104. touch --date=@0 ./*;
  105. # END set date