Linux Compressor Humanizer https://lch.hatthieves.es
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.3 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. #!/usr/bin/env bash
  2. function help()
  3. {
  4. echo "Help:"
  5. echo "-----"
  6. echo ""
  7. echo "lch [-h] [-v] [-c] [-i] [FILE [FILE...]]"
  8. echo ""
  9. echo "Examples:"
  10. echo "$ lch -h - This help"
  11. echo "$ lch -v - Print version"
  12. echo "$ lch -c - Check compresion systems"
  13. echo "$ lch -i - Install the compressors dependencies"
  14. echo "$ lch file.zip - Decompress"
  15. echo "$ lch file.zip /home/file - Compress"
  16. echo "$ lch files.zip file1 file2 - Compress multiple"
  17. echo ""
  18. echo "Packing/unpacking supported extensions:"
  19. echo " 7z, bz2, gz, rar, tar, tar.bz2, tbz, tbz2, tb2, tar.gz, tgz, tar.xz, txz, zip"
  20. echo ""
  21. echo "Unpacking only supported extensions:"
  22. echo " arj, cab, dmg, iso, lzh, lzma, rpm, squashfs, vdi, vhd, vmdk, win, xar, z"
  23. echo ""
  24. echo "Run 'man lch' for more info."
  25. echo ""
  26. }
  27. function check()
  28. {
  29. local a=false
  30. echo -e "Verification of compression systems:\n"
  31. echo -e "Systems\t\t\tStatus"
  32. echo "----------------------------------"
  33. for i in "7z" "bzip2" "gzip" "rar" "tar" "unrar" "unzip" "zip"
  34. do
  35. wheel true &
  36. WPID=$!
  37. if ! [ -x "$(command -v $i)" ]
  38. then
  39. echo -e "$i\t\t\t\e[91mNot Installed\e[0m"
  40. a=true
  41. else
  42. echo -e "$i\t\t\t\e[32mInstalled\e[0m"
  43. fi
  44. disown $WPID
  45. kill $WPID &> /dev/null
  46. done
  47. if $a
  48. then
  49. echo -e "\nIn order to use all the extensions install the packages."
  50. echo -e "Or use 'lch -i' to install all dependences"
  51. fi
  52. echo ""
  53. }
  54. function lowercase()
  55. {
  56. echo "$DEST" | tr 'A-Z' 'a-z'
  57. }
  58. function error_not_install()
  59. {
  60. echo -e "$@ \e[91mis not installed\e[0m, use 'lch -i' to install and 'lch -c' to check."
  61. exit 0
  62. }
  63. function executer()
  64. {
  65. wheel true &
  66. WPID=$!
  67. if [ -x "$(command -v $1)" ]
  68. then
  69. "$@" 1> /dev/null
  70. else
  71. error_not_install $1
  72. fi
  73. disown $WPID
  74. kill $WPID &> /dev/null
  75. }
  76. function complete_install(){
  77. echo -e "$@:\t\t\t\e[32mComplete\e[0m"
  78. }
  79. function failed_install(){
  80. echo -e "$@:\t\t\t\e[91mFailed\e[0m"
  81. }
  82. function wheel() {
  83. sp='/-\|'
  84. while $1; do
  85. printf '%.1s\b' "$sp"
  86. sp=${sp#?}${sp%???}
  87. sleep 0.1s
  88. done
  89. }