hydrus/setup_desktop.sh

45 lines
1.0 KiB
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
2024-02-21 21:09:02 +00:00
echo "Sorry, I do not see the template file at $DESKTOP_SOURCE_PATH! Was it deleted, or this script moved?"
popd || exit 1
exit 1
2022-11-23 21:01:41 +00:00
fi
if [ -f "$DESKTOP_DEST_PATH" ]; then
2024-02-21 21:09:02 +00:00
echo "You already have a hydrus.desktop file at $DESKTOP_DEST_PATH. Would you like to overwrite it? y/n "
2022-11-23 21:01:41 +00:00
else
2024-02-21 21:09:02 +00:00
echo "Create a hydrus.desktop file at $DESKTOP_DEST_PATH? y/n "
2022-11-23 21:01:41 +00:00
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
2024-02-21 21:09:02 +00:00
:
2023-04-12 20:34:43 +00:00
elif [ "$affirm" = "n" ]; then
2024-02-21 21:09:02 +00:00
popd || exit
exit 0
2022-11-23 21:01:41 +00:00
else
2024-02-21 21:09:02 +00:00
echo "Sorry, did not understand that input!"
popd || exit 1
exit 1
2022-11-23 21:01:41 +00:00
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