You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

#! /bin/sh
install_dir="$1"
if [ -z "$install_dir" ]; then
echo "Please specify a directory to install InfoTren to."
echo "Example:"
echo " $0 ~/infotren"
exit 3
fi
if [ ! -d "$install_dir" ]; then
if [ -d $(dirname "$install_dir") ]; then
mkdir "$install_dir"
else
echo "$install_dir doesn't exist. Please specify a directory to install InfoTren to."
echo "Example:"
echo " $0 ~/infotren"
exit 1
fi
fi
if [ ! -f ./infotren.desktop ]; then
if [ -f "$(dirname $0)/infotren.desktop" ]; then
cd "$(dirname $0)"
else
echo "Run this script from inside the infotren directory."
exit 2
fi
fi
echo "Installing InfoTren to $install_dir"
cp -r . "$install_dir"
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME=~/.local/share
fi
if [ ! -d "$XDG_DATA_HOME/applications" ]; then
mkdir -p "$XDG_DATA_HOME/applications"
fi
echo "Installing infotren.desktop to $XDG_DATA_HOME/applications/infotren.desktop"
cat infotren.desktop | sed "s|Exec=|Exec=$install_dir/info_tren|g" > "$XDG_DATA_HOME/applications/infotren.desktop"