mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 07:20:02 +03:00
This *should* allow for easy setup to work on any XDG-compliant desktop environment. Just run `scripts/linux-setup.sh` and it will: 1. Determine the 'root' directory of the EDMarketConnector source you're using. 2. Check you have `${HOME}/bin` in PATH and it exists as a directory. 3. Copy `scripts/edmarketconnector.sh` to there, replacing the string `EDMC_PATH` with the 'root' directory. 4. Copy .png (icon) and .desktop files into ~/.local/share/... locations. Then the desktop environment should have a menu entry for "E:D Market Connector", which attempts to run `edmarketconnector`, which should now be the shell script present in ${HOME}/bin.
75 lines
3.1 KiB
Bash
75 lines
3.1 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# Set up necessary support files to make running EDMarketConnect streamlined
|
|
# on Linux.
|
|
#
|
|
|
|
###########################################################################
|
|
# Shell script launcher
|
|
#
|
|
# This needs to be in an appropriate component of $PATH so that the
|
|
# reference in the .desktop file will work.
|
|
###########################################################################
|
|
#######################################################
|
|
# Determine where edmarketconnector.sh needs to go
|
|
#######################################################
|
|
# Really we need this to be "${HOME}/bin", so check that is in $PATH
|
|
if [[ ":$PATH:" != *":$HOME/bin:"* ]];
|
|
then
|
|
echo "You need to have '${HOME}/bin' in your PATH"
|
|
echo "Please fix this (might require relogging) and try again"
|
|
exit 1
|
|
fi
|
|
EDMC_BIN_PATH="${HOME}/bin"
|
|
if [ ! -d "${EDMC_BIN_PATH}" ];
|
|
then
|
|
echo "'${EDMC_BIN_PATH}' must exist and be a directory!"
|
|
exit 2
|
|
fi
|
|
#######################################################
|
|
|
|
#######################################################
|
|
# Determine where the source is located
|
|
#######################################################
|
|
# We know where this script is situated within an unzip/git clone of
|
|
# the source code, so set EDMC_PATH based on that.
|
|
# This is in `scripts/` of the source, so one directory up
|
|
EDMC_PATH="$(dirname $0)/.."
|
|
# And we need the *full* absolute path
|
|
EDMC_PATH="$(realpath ${EDMC_PATH})"
|
|
echo "EDMC_PATH = ${EDMC_PATH}"
|
|
#######################################################
|
|
|
|
|
|
#######################################################
|
|
# Copy an edited version of edmarketconnector.sh into place
|
|
#######################################################
|
|
echo "Copying launcher shell script into place..."
|
|
sed -e "s#EDMC_PATH#${EDMC_PATH}#g;" \
|
|
< "${EDMC_PATH}/scripts/edmarketconnector.sh" \
|
|
> "${EDMC_BIN_PATH}/edmarketconnector"
|
|
#######################################################
|
|
###########################################################################
|
|
|
|
###########################################################################
|
|
# Desktop file
|
|
#
|
|
# This needs to be in a path where any XDG-compliant environment will be
|
|
# able to find it.
|
|
###########################################################################
|
|
echo "Copying .desktop file into place ..."
|
|
install -d -m700 "${HOME}/.local/share/applications"
|
|
install -t "${HOME}/.local/share/applications" "${EDMC_PATH}/io.edcd.EDMarketConnector.desktop"
|
|
###########################################################################
|
|
|
|
###########################################################################
|
|
# Icon file
|
|
#
|
|
# This needs to be in a path where any XDG-compliant environment will be
|
|
# able to find it.
|
|
###########################################################################
|
|
echo "Copying icon file into place..."
|
|
install -d -m700 "${HOME}/.local/share/icons/hicolor/512x512/apps"
|
|
install -t "${HOME}/.local/share/icons/hicolor/512x512/apps" "${EDMC_PATH}/io.edcd.EDMarketConnector.png"
|
|
###########################################################################
|