Files
love-release/install.sh
Antonin Décimo 5bbf17401a Add configuration. See #5 #8.
What's new:
- --config flag to pass a INI config file to parse. See config.ini.
- Updated the modules scripts for configuration. Now needs to unset
  variables passed by CLI or config.
- Fix release directory that was added in love file (maybe).
- Properly escapes sed arguments.
- chmod +x to getopt.sh and read_ini.sh
- Fix #12
2014-08-22 14:07:44 +02:00

32 lines
876 B
Bash
Executable File

#!/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
fi
echo "Installing..."
BINARY_DIR=/usr/bin
INSTALL_DIR=/usr/share/love-release
MANPAGE_DIR=/usr/share/man/man1
SED_ARG=$(echo "$INSTALL_DIR" | sed -e 's/[\/&]/\\&/g')
mkdir -p "$BINARY_DIR"
cp ./love-release.sh "$BINARY_DIR"/love-release
sed -i -e "s/INSTALL_DIR=/INSTALL_DIR=$SED_ARG/g" "$BINARY_DIR"/love-release
mkdir -p "$INSTALL_DIR"
cp ./README.md "$INSTALL_DIR"
cp ./config.ini "$INSTALL_DIR"
cp -r ./scripts "$INSTALL_DIR"
cp -r ./include "$INSTALL_DIR"
mkdir -p "$MANPAGE_DIR"
cp love-release.1 "$MANPAGE_DIR"/love-release.1
sed -i -e "s/scripts/$SED_ARG\/scripts/g" -e "s/config.ini/$SED_ARG\/config.ini/g" "$MANPAGE_DIR"/love-release.1
gzip -9 -f "$MANPAGE_DIR"/love-release.1
echo "Done !"