Better installation process

- ask user confirmation
- detects if love-release should be installed system-wide or in user
  space
- moved completion form /etc/bash_completion.d/love-release to
  /usr/share/bash-completion/completions/love-release
This commit is contained in:
Antonin Décimo
2014-10-04 09:56:57 +02:00
parent 691b38767a
commit c04739df10
2 changed files with 35 additions and 13 deletions

View File

@@ -2,10 +2,13 @@
`love-release.sh` -- Bash script to generate Love 2D game releases
### INSTALLATION
Clone and run as root `install.sh`, or edit `install.sh` to choose
locations in user-space.
Close and reopen your terminal to make completion available, or execute :
`. /etc/bash_completion.d/love-release`
git clone https://github.com/MisterDA/love-release.git
cd love-release
# Install system-wide
sudo ./install.sh
# Install in user space
./install.sh
### SYNOPSIS
`love-release.sh [-adlmw] [-n project_name] [-r release_dir] [-v love_version] [FILES...]`

View File

@@ -1,16 +1,35 @@
#!/usr/bin/env bash
if [ $UID -ne 0 ]; then
echo "This script must be run as root, or you can change the installation directories by editing it." >&2
exit 1
if [ $UID -eq 0 ]; then
read -n 1 -p "Do you wish to install love-release system-wide ? [Y/n]: " yn
case $yn in
[Yy]*|"" ) echo;;
* ) echo -e "\nInstallation aborted."; exit;;
esac
echo "Installing..."
BINARY_DIR=/usr/bin
INSTALL_DIR=/usr/share/love-release
MANPAGE_DIR=/usr/share/man/man1
COMPLETION_DIR=$(pkg-config --variable=completionsdir bash-completion)
else
read -n 1 -p "Do you wish to install love-release in your user directory ? [Y/n]: " yn
case $yn in
[Yy]*|"" ) echo;;
* ) echo -e "\nInstallation aborted."; exit;;
esac
echo "Installing..."
BINARY_DIR="$HOME"/bin
INSTALL_DIR="$HOME"/.local/share/love-release
MANPAGE_DIR="$HOME"/.local/share/man/man1
COMPLETION_DIR="$HOME"/.bash_completion
echo "Add these lines to your shell rc file:"
echo " export PATH=\"$BINARY_DIR:\$PATH\""
echo " export MANPATH=\"$MANPAGE_DIR:\""
fi
echo "Installing..."
BINARY_DIR=/usr/bin
INSTALL_DIR=/usr/share/love-release
MANPAGE_DIR=/usr/share/man/man1
COMPLETION_DIR=/etc/bash_completion.d
SED_ARG=$(echo "$INSTALL_DIR" | sed -e 's/[\/&]/\\&/g')
mkdir -p "$BINARY_DIR"