hydrus/setup_desktop.sh

45 lines
1019 B
Bash
Raw Normal View History

2022-11-23 21:01:41 +00:00
#!/bin/bash
2023-04-12 20:34:43 +00:00
pushd "$(dirname "$0")" || exit 1
2022-11-23 21:01:41 +00:00
INSTALL_DIR="$(readlink -f .)"
DESKTOP_SOURCE_PATH=$INSTALL_DIR/static/hydrus.desktop
DESKTOP_DEST_PATH=$HOME/.local/share/applications/hydrus.desktop
echo "Install folder appears to be $INSTALL_DIR"
if [ ! -f "$DESKTOP_SOURCE_PATH" ]; then
echo "Sorry, I do not see the template file at $DESKTOP_SOURCE_PATH! Was it deleted, or this script moved?"
2023-04-12 20:34:43 +00:00
popd || exit 1
2022-11-23 21:01:41 +00:00
exit 1
fi
if [ -f "$DESKTOP_DEST_PATH" ]; then
echo "You already have a hydrus.desktop file at $DESKTOP_DEST_PATH. Would you like to overwrite it? y/n "
else
echo "Create a hydrus.desktop file at $DESKTOP_DEST_PATH? y/n "
fi
2023-04-12 20:34:43 +00:00
read -r affirm
2022-11-23 21:01:41 +00:00
2023-04-12 20:34:43 +00:00
if [ "$affirm" = "y" ]; then
2022-11-23 21:01:41 +00:00
:
2023-04-12 20:34:43 +00:00
elif [ "$affirm" = "n" ]; then
popd || exit
2022-11-23 21:01:41 +00:00
exit 0
else
echo "Sorry, did not understand that input!"
2023-04-12 20:34:43 +00:00
popd || exit 1
2022-11-23 21:01:41 +00:00
exit 1
fi
2023-07-26 20:57:00 +00:00
sed -e "s#Exec=.*#Exec=${INSTALL_DIR}/hydrus_client.sh#" -e "s#Icon=.*#Icon=${INSTALL_DIR}/static/hydrus.png#" "$DESKTOP_SOURCE_PATH" > "$DESKTOP_DEST_PATH"
2022-11-23 21:01:41 +00:00
echo "Done!"
2023-04-12 20:34:43 +00:00
popd || exit