Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. #!/bin/bash
  2. bold=$(tput bold)
  3. green='\033[0;32m'
  4.  
  5. # If script was elevated, exit. We don't want to run as root (yet)
  6. if [ `id -u` = 0 ] ; then
  7. echo "Error: don't run the script as sudo!"
  8. exit 1
  9. fi
  10.  
  11. set -e
  12.  
  13. # Check for presence of dependencies git, node and npm.
  14. if [ "$(which git)" = "" ] ;then
  15. echo "This script requires git, please resolve and try again."
  16. exit 1
  17. fi
  18.  
  19. if [ "$(which node)" = "" ] ;then
  20. echo "This script requires NodeJS, please resolve and try again."
  21. exit 1
  22. fi
  23.  
  24. if [ "$(which npm)" = "" ] ;then
  25. echo "This script requires npm, please resolve and try again."
  26. exit 1
  27. fi
  28.  
  29. echo "Cloning the PreMiD source files..."
  30. git clone https://github.com/PreMiD/PreMiD
  31.  
  32. echo "Installing dependencies for building..."
  33. cd PreMiD
  34. npm install
  35. cd src
  36. npm install
  37. cd ..
  38.  
  39. echo "Packaging Linux files..."
  40. npm run pkg
  41. echo "Adding PreMiD to /usr/bin and shortcut to Application launcher..."
  42. sudo bash -c 'cp src/assets/images/logo.png "${pkgdir}/usr/share/pixmaps/premid.png"'
  43. sudo bash -c 'mkdir /usr/lib/premid'
  44. sudo bash -c 'echo "#!/bin/bash
  45. cd /usr/lib/premid/
  46. ./premid" > /usr/bin/premid'
  47. sudo bash -c 'chmod +x /usr/bin/premid'
  48. sudo bash -c 'echo "[Desktop Entry]
  49. Name=PreMiD
  50. GenericName=PreMiD
  51. Comment=PreMiD adds Discord Rich Presence support to a lot of services you use and love.
  52. Exec=/usr/bin/premid
  53. Terminal=false
  54. Type=Application
  55. Icon=premid.png" > /usr/share/applications/premid.desktop'
  56. sudo bash -c 'cp src/assets/images/logo.png "${pkgdir}/usr/share/pixmaps/premid.png"'
  57.  
  58. echo "Copying PreMiD to /usr/lib..."
  59. cd out/PreMiD-linux-x64
  60. sudo bash -c 'cp -r ./* /usr/lib/premid'
  61. sudo bash -c 'install -Dm644 LICENSE /usr/share/licenses/premid/LICENSE'
  62.  
  63. echo "Cleaning up..."
  64. cd ../../../
  65. rm -rf PreMiD
  66.  
  67. echo -e "${green}Done!"
  68. echo "${bold}Don't forget to install the web extension for your browser! Visit our GitHub for instructions: \n"
  69. echo "https://github.com/PreMiD/PreMiD#installation"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement