48 lines
1.2 KiB
Bash
48 lines
1.2 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
usage(){
|
||
|
echo "Copies the rat-times binary, data, and icon to the specified directory,"
|
||
|
echo "then copies the desktop file to ~/.local/share/applications, while"
|
||
|
echo "setting the correct path"
|
||
|
echo ""
|
||
|
echo "Example Usage: install-linux.sh ~/Applications"
|
||
|
}
|
||
|
|
||
|
if [ $# -eq 0 ]; then
|
||
|
>&2 echo "No arguments provided, please provide a valid path for installation"
|
||
|
usage
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
|
||
|
if [ $1 = "--help" ]; then
|
||
|
usage
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
if [ $1 = "-h" ]; then
|
||
|
usage
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
dir_resolve(){
|
||
|
cd "$1" 2>/dev/null || return $? # cd to desired directory; if fail, quell any error messages but return exit status
|
||
|
echo "`pwd -P`" # output full, link-resolved path
|
||
|
}
|
||
|
|
||
|
if APP_PATH="`dir_resolve \"$1\"`"; then
|
||
|
SHORTCUT_PATH="$HOME/.local/share/applications/rat-times.desktop"
|
||
|
mkdir -p $APP_PATH
|
||
|
cp rat-times.x86_64 rat-times.pck rat-times.svg $APP_PATH
|
||
|
sed "s@REPLACE_WITH_PATH@$APP_PATH@g" rat-times.desktop > $SHORTCUT_PATH
|
||
|
echo "Rat Times is installed. To remove, please delete:"
|
||
|
echo "$APP_PATH/rat-times.x86_64"
|
||
|
echo "$APP_PATH/rat-times.pck"
|
||
|
echo "$APP_PATH/rat-times.svg"
|
||
|
echo "$SHORTCUT_PATH"
|
||
|
else
|
||
|
echo "Could not reach $1"
|
||
|
fi
|
||
|
|
||
|
|