install.sh 751 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/env sh
  2. # check sudo permissions
  3. if (( "$EUID" != 0 )); then
  4. echo "Please run this script with sudo"
  5. exit 1
  6. fi
  7. INSTALL_PATH=/usr/share/java/cmus-rpc
  8. VERSION=2.0.1
  9. mkdir -p "$INSTALL_PATH"
  10. echo "Install version: $VERSION"
  11. echo "Downloading jar file..."
  12. sudo wget "https://github.com/anas-elagarhy/cmus-rpc/releases/download/$VERSION/cmus-rpc.jar"
  13. sudo mv ./cmus-rpc.jar "$INSTALL_PATH"/cmus-rpc.jar
  14. printf "\nDownloaded in %s/cmus-rpc.jar\n" $INSTALL_PATH
  15. echo "Create the executable file in /bin"
  16. # shellcheck disable=SC2024
  17. sudo echo "exec /usr/bin/java -jar $INSTALL_PATH/cmus-rpc.jar \$@" >> /bin/cmus-rpc
  18. sudo chmod +x /bin/cmus-rpc
  19. printf "\nDone, enjoy :D\n"
  20. echo "Please type cmus-rpc --help to show the available options"