Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Create scripts 🤍
Browse files Browse the repository at this point in the history
  • Loading branch information
0x61nas committed Jun 26, 2022
1 parent 776299a commit 46a25e5
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 0 deletions.
31 changes: 31 additions & 0 deletions scripts/bundle-gz-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/env sh
if [ -f ".temp" ]; then
rm -r ./.temp/
fi

mkdir ./.temp/
cp ../out/artifacts/cmus_rpc_jar/cmus-rpc.jar ./.temp/
cp ./cmus-rpc.sh ./.temp/


cd ./.temp

ls

VER="$1"
echo "Create tar file to cmus-rpc $VER ..."
TARNAME=cmus-rpc-"$VER".tar.gz
tar -cvf "./$TARNAME" ./cmus-rpc.sh ./cmus-rpc.jar

cd ../..
if ! [ -f "./release" ]; then
echo "Create release file"
mkdir release
fi

echo "Move the $TARNAME to release directory."

mv "./scripts/.temp/$TARNAME" ./release

echo "Remove temp folder"
rm -r ./scripts/.temp
2 changes: 2 additions & 0 deletions scripts/cmus-rpc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
exec /usr/bin/java -jar /usr/share/java/cmus-rpc/cmus-rpc.jar "$@"
30 changes: 30 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/env sh

# check sudo permissions
if (( "$EUID" != 0 )); then
echo "Please run this script with sudo"
exit 1
fi


INSTALL_PATH=/usr/share/java/cmus-rpc
VERSION=2.0.0

mkdir -p "$INSTALL_PATH"

echo "Install version: $VERSION"
echo "Downloading jar file..."
sudo wget "https://github.com/Anas-Elgarhy/cmus-rpc/releases/download/$VERSION/cmus-rpc.jar"
sudo mv ./cmus-rpc.jar "$INSTALL_PATH"/cmus-rpc.jar

printf "\nDownloaded in %s/cmus-rpc.jar\n" $INSTALL_PATH

echo "Create the executable file in /bin"
# shellcheck disable=SC2024
sudo echo "exec /usr/bin/java -jar $INSTALL_PATH/cmus-rpc.jar \$@" >> /bin/cmus-rpc

sudo chmod +x /bin/cmus-rpc

printf "\nDone, enjoy :D\n"

echo "Please type cmus-rpc --help to show the available options"
10 changes: 10 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/env sh

VER="@1"

if [ -z $VER ];then
echo "Please pass the version."
exit 1
fi


15 changes: 15 additions & 0 deletions scripts/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/env sh

if (( "$EUID" != 0 )); then
echo "Please this script with sudo!"
exit 1
fi

echo "Remove jar file.."
sudo rm -r /usr/share/java/cmus-rpc

echo "Remove execrable file..."
sudo rm /bin/cmus-rpc

echo "Done :/"

0 comments on commit 46a25e5

Please sign in to comment.