Created
March 1, 2018 09:27
-
-
Save TonyWhite/3fc2ea416304a5eef35b2995bb8cc24c to your computer and use it in GitHub Desktop.
HomeJar - Execute a jar file in Linux Home directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Name=HomeJar | |
Comment=Jar executor in Home directory | |
Exec=homejar %f | |
Icon=homejar.svg | |
Terminal=false | |
Type=Application | |
Categories=Settings;System; | |
StartupNotify=false | |
MimeType=x-java-archive; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Execute a jar file in Home directory | |
file_name=${1} | |
if [ ${file_name} ]; then | |
if [ -s ${file_name} ]; then | |
# Navigate to home | |
cd ~ | |
# Execute file | |
java -jar ${file_name} | |
else | |
echo "ERROR 404 \"${file_name}\" NOT FOUND" | |
fi | |
else | |
echo "Need for Jar file" | |
fi | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Need root access | |
if (( $EUID != 0 )); then | |
echo "Please run as root" | |
exit | |
fi | |
# Install script | |
cp homejar.sh /usr/bin/homejar | |
# Add desktop entries | |
cp homejar.desktop /usr/share/applications/homejar.desktop | |
# Install icon | |
cp homejar.svg /usr/share/pixmaps/homejar.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Need root access | |
if (( $EUID != 0 )); then | |
echo "Please run as root" | |
exit | |
fi | |
# uninstall script | |
rm /usr/bin/homejar | |
# Remove desktop entries | |
rm /usr/share/applications/homejar.desktop | |
# Uninstall icon | |
rm /usr/share/pixmaps/homejar.svg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment