jpenguin

ttf-ms-tahoma-installer.sh

Sep 27th, 2020 (edited)
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. #!/bin/bash
  2. # Author: Maxwel Leite
  3. # Website: http://needforbits.tumblr.com/
  4. # Description: Script to install the original Microsoft Tahoma Regular and MS Tahoma Bold (both version 2.60) on Ubuntu distros.
  5. # Dependencies: wget and cabextract
  6. # Tested: Ubuntu Saucy/Trusty/Xenial
  7.  
  8. output_dir="/usr/share/fonts/truetype/msttcorefonts/"
  9. tmp_dir="/tmp/ttf-ms-tahoma-installer"
  10.  
  11. if [[ $EUID -ne 0 ]]; then
  12. echo -e "You must be a root user!\nTry: sudo ./ttf-ms-tahoma-installer.sh" 2>&1
  13. exit 1
  14. fi
  15.  
  16. if ! which wget >/dev/null; then
  17. echo "Error: wget is required to download the file"
  18. echo "Run the following command to install it:"
  19. echo "sudo apt-get install wget"
  20. exit 1
  21. fi
  22.  
  23. if ! which cabextract >/dev/null; then
  24. echo "Error: cabextract is required to unpack the files"
  25. echo "Run the following command to install it:"
  26. echo "sudo apt-get install cabextract"
  27. exit 1
  28. fi
  29.  
  30. file="$tmp_dir/IELPKTH.CAB"
  31. mkdir -p "$tmp_dir"
  32. cd "$tmp_dir"
  33. err=0
  34.  
  35. echo -e "\n:: Downloading IELPKTH.CAB...\n"
  36. wget -O "$file" https://sourceforge.net/projects/corefonts/files/OldFiles/IELPKTH.CAB
  37. #wget -O "$file" https://filedn.com/lHGef0SOQKnBTotcJeEfshJ/IELPKTH.CAB
  38. if [ $? -ne 0 ]; then
  39. rm -f "$file"
  40. echo -e "\nError: Download failed!?\n"
  41. err=1
  42. else
  43. echo -e "Done!\n"
  44. fi
  45.  
  46. if [ $err -ne 1 ]; then
  47. echo -n ":: Extracting... "
  48. cabextract -t "$file" &> /dev/null
  49. if [ $? -ne 0 ]; then
  50. echo "Error: Can't extract. Corrupted download!?"
  51. err=1
  52. else
  53. cabextract -F 'tahoma*ttf' "$file" &> /dev/null
  54. if [ $? -ne 0 ]; then
  55. echo "Error: Can't extract 'tahoma.ttf' and 'tahomabd.ttf' from 'IELPKTH.CAB'. Corrupted download!?"
  56. err=1
  57. else
  58. echo "Done!"
  59. fi
  60. fi
  61. fi
  62.  
  63. if [ $err -ne 1 ]; then
  64. echo -n ":: Installing... "
  65. mkdir -p "$output_dir"
  66. cp -f "$tmp_dir"/*.ttf "$output_dir" &> /dev/null
  67. if [ $? -ne 0 ]; then
  68. echo "Error: Can't copy files to output directory."
  69. err=1
  70. else
  71. echo "Done!"
  72. fi
  73. fi
  74.  
  75. if [ $err -ne 1 ]; then
  76. echo -n ":: Clean the font cache... "
  77. fc-cache -f "$output_dir" &> /dev/null
  78. echo "Done!"
  79. fi
  80.  
  81. echo -n ":: Cleanup... "
  82. cd - &> /dev/null
  83. rm -rf "$tmp_dir" &> /dev/null
  84. echo "Done!"
  85.  
  86. if [ $err -ne 1 ]; then
  87. echo -e "\nCongratulations! Installation of ttf-ms-tahoma-installer is successful!!\n"
  88. else
  89. echo -e "\nSome error occurred! Please try again!!\n"
  90. fi
Add Comment
Please, Sign In to add comment